Skip to main content

TextureSampleType

Type Alias TextureSampleType 

Source
pub type TextureSampleType = TextureSampleType;
Expand description

Type of the values read from a texture in a shader.

Aliased Type§

pub enum TextureSampleType {
    Float {
        filterable: bool,
    },
    Depth,
    Sint,
    Uint,
}

Variants§

§

Float

Sampling returns floats.

Example WGSL syntax:

ⓘ
@group(0) @binding(0)
var t: texture_2d<f32>;

Example GLSL syntax:

layout(binding = 0)
uniform texture2D t;

Fields

§filterable: bool

If this is false, the texture can’t be sampled with a filtering sampler.

Even if this is true, it’s possible to sample with a non-filtering sampler.

§

Depth

Sampling does the depth reference comparison.

This is also compatible with a non-filtering sampler.

Example WGSL syntax:

ⓘ
@group(0) @binding(0)
var t: texture_depth_2d;

Example GLSL syntax:

layout(binding = 0)
uniform texture2DShadow t;
§

Sint

Sampling returns signed integers.

Example WGSL syntax:

ⓘ
@group(0) @binding(0)
var t: texture_2d<i32>;

Example GLSL syntax:

layout(binding = 0)
uniform itexture2D t;
§

Uint

Sampling returns unsigned integers.

Example WGSL syntax:

ⓘ
@group(0) @binding(0)
var t: texture_2d<u32>;

Example GLSL syntax:

layout(binding = 0)
uniform utexture2D t;