pub enum TextureUsage {
CopySource,
CopyDestination,
TextureBinding,
StorageBinding,
RenderAttachment,
}Expand description
One legal use of a GPU texture, as declared in GpuTextureDescriptor.usage.
Like BufferUsage, the underlying WebGPU field is a bitmask and the
renderer ORs the selected variants together at the call site. A render
target needs RenderAttachment; a sampled texture needs
TextureBinding; a write-once compute output needs StorageBinding.
Variants§
CopySource
The texture may be the source of a texture-to-texture or texture-to-buffer copy.
CopyDestination
The texture may be the destination of queue.writeTexture or of a
texture-to-texture copy.
TextureBinding
The texture is sampled through a texture_2d<f32> binding.
StorageBinding
The texture is written through a texture_storage_2d<...> binding.
RenderAttachment
The texture is bound as a color, depth, or stencil attachment of a render pass.
Implementations§
Source§impl TextureUsage
The GPUTextureUsage bit one use occupies.
impl TextureUsage
The GPUTextureUsage bit one use occupies.
The texture-side counterpart of BufferUsage::usage_bit. Note
that the buffer and texture families share their variant names
but not their values - CopySource is 4 for a buffer and 1
for a texture - which is why the two tables are separate.
Trait Implementations§
Source§impl BitOr for TextureUsage
Combines two texture uses into the bitmask a GpuTextureDescriptor
expects.
impl BitOr for TextureUsage
Combines two texture uses into the bitmask a GpuTextureDescriptor
expects.
The texture counterpart of the | operator on BufferUsage, with
the same single-source-of-truth rationale.