Texture

A 2D Vulkan texture: device-local image + view + sampler. Construction uploads every supplied mip level through one staging buffer, transitions the image to ShaderReadOnlyOptimal and creates a sampler covering the whole chain. Block-compressed levels are uploaded as blocks, never decompressed.

Properties

Width

(uint) : Image width in pixels.

Height

(uint) : Image height in pixels.

MipLevels

(uint) : Number of mip levels the image holds, at least one.

Format

(Format) : The Vulkan format of the image.

SizeBytes

(ulong) : Bytes of device memory the image occupies across every mip level.

DescriptorInfo

(DescriptorImageInfo): Combined image-sampler descriptor info for binding into a descriptor set.

Public Methods

Update

public void Update(ReadOnlySpan<byte> rgba)

Replaces mip level 0 with fresh, tightly-packed RGBA8 pixels. Valid only for a single-level texture, which is the shape render-to-texture callers (the UI compositor, video surfaces) use. The image is transitioned out of shader-read, the pixels are copied through a transient staging buffer, and it is transitioned back. Every step blocks on the graphics queue, so treat this as a synchronous upload and call it at most once per frame.

Parameters:

  • rgba (ReadOnlySpan): Tightly-packed RGBA8 pixels for mip level 0; length must be WidthHeight4.

Dispose

public void Dispose()