pub struct BindGroupLayoutEntry {
pub binding: u32,
pub visibility: ShaderStages,
pub ty: BindGroupEntryType,
}Expand description
A single entry inside a GpuBindGroupLayoutDescriptor.
Together these describe one slot of the bind group layout used by
a render / compute pipeline. The visibility field names the
shader stages that can read the binding as ShaderStage values
combined with |; a hand-written 0x1 / 0x2 / 0x4 there
silently produced a binding the shader could not see.
Fields§
§binding: u32The binding slot (matches @binding(N) in the shader).
visibility: ShaderStagesThe shader stages that can read this binding. Combine several
with |, e.g. ShaderStage::Vertex | ShaderStage::Fragment.
ty: BindGroupEntryTypeThe resource kind bound at this slot.
Implementations§
Source§impl BindGroupLayoutEntry
impl BindGroupLayoutEntry
Sourcepub fn uniform<V: Into<ShaderStages>>(binding: u32, visibility: V) -> Self
pub fn uniform<V: Into<ShaderStages>>(binding: u32, visibility: V) -> Self
Convenience constructor for a uniform-buffer binding slot.
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.
Sourcepub fn storage<V: Into<ShaderStages>>(
binding: u32,
visibility: V,
read_only: bool,
) -> Self
pub fn storage<V: Into<ShaderStages>>( binding: u32, visibility: V, read_only: bool, ) -> Self
Convenience constructor for a storage-buffer binding slot.
read_only = true selects read-only-storage (matches var<storage, read>);
read_only = false selects storage (matches var<storage, read_write>).
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.bool- Whether shaders may only read from the buffer.
Sourcepub fn texture<V: Into<ShaderStages>>(
binding: u32,
visibility: V,
sample_type: &str,
) -> Self
pub fn texture<V: Into<ShaderStages>>( binding: u32, visibility: V, sample_type: &str, ) -> Self
Convenience constructor for a sampled texture binding slot.
sample_type must be one of "float", "unfilterable-float",
"depth", "sint", "uint".
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.&str- The texel sample type name used by the shader.
Sourcepub fn texture_multisampled<V: Into<ShaderStages>>(
binding: u32,
visibility: V,
sample_type: &str,
) -> Self
pub fn texture_multisampled<V: Into<ShaderStages>>( binding: u32, visibility: V, sample_type: &str, ) -> Self
Convenience constructor for a multisampled sampled texture binding slot.
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.&str- The texel sample type name used by the shader.
Sourcepub fn storage_texture<V: Into<ShaderStages>>(
binding: u32,
visibility: V,
format: &str,
read_only: bool,
) -> Self
pub fn storage_texture<V: Into<ShaderStages>>( binding: u32, visibility: V, format: &str, read_only: bool, ) -> Self
Convenience constructor for a storage-texture binding slot.
format is a GpuTextureFormat string such as "rgba8unorm" or "r32float".
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.&str- The storage texture format name.bool- Whether shaders may only read from the texture.
Sourcepub fn sampler<V: Into<ShaderStages>>(binding: u32, visibility: V) -> Self
pub fn sampler<V: Into<ShaderStages>>(binding: u32, visibility: V) -> Self
Convenience constructor for a filtering sampler binding slot.
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.
Sourcepub fn sampler_non_filtering<V: Into<ShaderStages>>(
binding: u32,
visibility: V,
) -> Self
pub fn sampler_non_filtering<V: Into<ShaderStages>>( binding: u32, visibility: V, ) -> Self
Convenience constructor for a non-filtering sampler binding slot.
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.
Sourcepub fn sampler_comparison<V: Into<ShaderStages>>(
binding: u32,
visibility: V,
) -> Self
pub fn sampler_comparison<V: Into<ShaderStages>>( binding: u32, visibility: V, ) -> Self
Convenience constructor for a comparison sampler binding slot.
§Arguments
u32- The binding index within the bind group.V- The shader stages that can access the slot. Either a loneShaderStage, or aShaderStagesmask built with|when more than one stage reads this binding.