textureDimensionsReturns the dimensions of a texture, or texture’s mip level in texels. Parameters:
t
|
The sampled,
multisampled, depth,
storage, or external texture.
|
level
|
The mip level, with level 0 containing a full size version of the texture.
If omitted, the dimensions of level 0 are returned.
| Returns: The coordinate dimensions of the texture. That is, the result provides the integer bounds on the coordinates of the logical texel address,
excluding the mip level count, array size, and sample count. For textures based on cubes, the results are the dimensions of each face of the cube.
Cube faces are square, so the x and y components of the result are equal. If level is outside the range [0, textureNumLevels(t)) then an indeterminate value
for the return type may be returned. |
fn textureDimensions(t: T) -> u32 | ST is i32, u32, or f32
F is a texel format
A is an access mode
T is texture_1d<ST> or texture_storage_1d<F,A> | |
fn textureDimensions(t: T,
level: L) -> u32 | ST is i32, u32, or f32
T is texture_1d<ST>
L is i32, or u32 | |
fn textureDimensions(t: T) -> vec2<u32> | ST is i32, u32, or f32
F is a texel format
A is an access mode
T is texture_2d<ST>, texture_2d_array<ST>, texture_cube<ST>,
texture_cube_array<ST>, texture_multisampled_2d<ST>,
texture_depth_2d, texture_depth_2d_array, texture_depth_cube,
texture_depth_cube_array, texture_depth_multisampled_2d,
texture_storage_2d<F,A>, texture_storage_2d_array<F,A>,
or texture_external | |
fn textureDimensions(t: T,
level: L) -> vec2<u32> | ST is i32, u32, or f32
T is texture_2d<ST>, texture_2d_array<ST>, texture_cube<ST>,
texture_cube_array<ST>, texture_depth_2d, texture_depth_2d_array,
texture_depth_cube, or texture_depth_cube_array
L is i32, or u32 | |
fn textureDimensions(t: T) -> vec3<u32> | ST is i32, u32, or f32
F is a texel format
A is an access mode
T is texture_3d<ST> or texture_storage_3d<F,A> | |
fn textureDimensions(t: T,
level: L) -> vec3<u32> | ST is i32, u32, or f32
T is texture_3d<ST>
L is i32, or u32 | |
textureGatherA texture gather operation reads from a 2D, 2D array, cube, or cube array texture,
computing a four-component vector as follows:
-
Find the four texels that would be used in a sampling operation with linear filtering,
from mip level 0:
-
Use the specified coordinate, array index (when present), and offset (when present).
-
The texels are adjacent, forming a square, when considering their texture space coordinates (u,v).
-
Selected texels at the texture edge, cube face edge, or cube corners are handled
as in ordinary texture sampling.
-
For each texel, read one channel and convert it into a scalar value.
-
For non-depth textures, a zero-based component parameter specifies the channel to use.
-
For depth textures, yield the texel value. (Depth textures only have one channel.)
-
Yield the four-component vector, arranging scalars produced by the previous step into components
according to the relative coordinates of the texels, as follows:
-
| Result component
| Relative texel coordinate
|
| x
| (umin,vmax)
|
| y
| (umax,vmax)
|
| z
| (umax,vmin)
|
| w
| (umin,vmin)
|
The four texels form the sampled area as described in the
WebGPU sampler descriptor. Parameters:
component
|
Only applies to non-depth textures.
The index of the channel to read from the selected texels.
When provided, the component expression must be a const-expression (e.g. 1).
Its value must be at least 0 and at most 3.
Values outside of this range will result in a shader-creation error.
|
t
|
The sampled or depth texture to read from.
|
s
|
The sampler type.
|
coords
|
The texture coordinates.
|
array_index
|
The 0-based texture array index.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: A four component vector with components extracted from the specified channel from the selected texels, as described above. |
fn textureGather(component: C,
t: texture_2d<ST>,
s: sampler,
coords: vec2<f32>) -> vec4<ST> | C is i32, or u32
ST is i32, u32, or f32 | |
fn textureGather(component: C,
t: texture_2d<ST>,
s: sampler,
coords: vec2<f32>,
offset: vec2<i32>) -> vec4<ST> | C is i32, or u32
ST is i32, u32, or f32 | |
fn textureGather(component: C,
t: texture_2d_array<ST>,
s: sampler,
coords: vec2<f32>,
array_index: A) -> vec4<ST> | C is i32, or u32
A is i32, or u32
ST is i32, u32, or f32 | |
fn textureGather(component: C,
t: texture_2d_array<ST>,
s: sampler,
coords: vec2<f32>,
array_index: A,
offset: vec2<i32>) -> vec4<ST> | C is i32, or u32
A is i32, or u32
ST is i32, u32, or f32 | |
fn textureGather(component: C,
t: texture_cube<ST>,
s: sampler,
coords: vec3<f32>) -> vec4<ST> | C is i32, or u32
ST is i32, u32, or f32 | |
fn textureGather(component: C,
t: texture_cube_array<ST>,
s: sampler,
coords: vec3<f32>,
array_index: A) -> vec4<ST> | C is i32, or u32
A is i32, or u32
ST is i32, u32, or f32 | |
fn textureGather(t: texture_depth_2d,
s: sampler,
coords: vec2<f32>) -> vec4<f32> | | |
fn textureGather(t: texture_depth_2d,
s: sampler,
coords: vec2<f32>,
offset: vec2<i32>) -> vec4<f32> | | |
fn textureGather(t: texture_depth_cube,
s: sampler,
coords: vec3<f32>) -> vec4<f32> | | |
fn textureGather(t: texture_depth_2d_array,
s: sampler,
coords: vec2<f32>,
array_index: A) -> vec4<f32> | A is i32, or u32 | |
fn textureGather(t: texture_depth_2d_array,
s: sampler,
coords: vec2<f32>,
array_index: A,
offset: vec2<i32>) -> vec4<f32> | A is i32, or u32 | |
fn textureGather(t: texture_depth_cube_array,
s: sampler,
coords: vec3<f32>,
array_index: A) -> vec4<f32> | A is i32, or u32 | |
textureGatherCompareA texture gather compare operation performs a depth comparison on four texels in a depth
texture and collects the results into a single vector, as follows:
-
Find the four texels that would be used in a depth sampling operation with linear filtering,
from mip level 0:
-
Use the specified coordinate, array index (when present), and offset (when present).
-
The texels are adjacent, forming a square, when considering their texture space coordinates (u,v).
-
Selected texels at the texture edge, cube face edge, or cube corners are handled
as in ordinary texture sampling.
-
For each texel, perform a comparison against the depth reference value,
yielding a 0.0 or 1.0 value, as controlled by the comparison sampler parameters.
-
Yield the four-component vector where the components are the comparison results with the texels with
relative texel coordinates as follows:
-
| Result component
| Relative texel coordinate
|
| x
| (umin,vmax)
|
| y
| (umax,vmax)
|
| z
| (umax,vmin)
|
| w
| (umin,vmin)
|
Parameters:
t
|
The depth texture to read from.
|
s
|
The sampler comparison.
|
coords
|
The texture coordinates.
|
array_index
|
The 0-based texture array index.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
depth_ref
|
The reference value to compare the sampled depth value against.
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: A four component vector with comparison result for the selected texels, as described above. |
fn textureGatherCompare(t: texture_depth_2d,
s: sampler_comparison,
coords: vec2<f32>,
depth_ref: f32) -> vec4<f32> | | |
fn textureGatherCompare(t: texture_depth_2d,
s: sampler_comparison,
coords: vec2<f32>,
depth_ref: f32,
offset: vec2<i32>) -> vec4<f32> | | |
fn textureGatherCompare(t: texture_depth_2d_array,
s: sampler_comparison,
coords: vec2<f32>,
array_index: A,
depth_ref: f32) -> vec4<f32> | A is i32, or u32 | |
fn textureGatherCompare(t: texture_depth_2d_array,
s: sampler_comparison,
coords: vec2<f32>,
array_index: A,
depth_ref: f32,
offset: vec2<i32>) -> vec4<f32> | A is i32, or u32 | |
fn textureGatherCompare(t: texture_depth_cube,
s: sampler_comparison,
coords: vec3<f32>,
depth_ref: f32) -> vec4<f32> | | |
fn textureGatherCompare(t: texture_depth_cube_array,
s: sampler_comparison,
coords: vec3<f32>,
array_index: A,
depth_ref: f32) -> vec4<f32> | A is i32, or u32 | |
textureLoadReads a single texel from a texture without sampling or filtering. Parameters:
t
|
The sampled,
multisampled,
depth,
storage, or
external
texture
|
coords
|
The 0-based texel coordinate.
|
array_index
|
The 0-based texture array index.
|
level
|
The mip level, with level 0 containing a full size version of the texture.
|
sample_index
|
The 0-based sample index of the multisampled texture.
| Returns: The unfiltered texel data. The logical texel address is invalid if:
-
any element of coords is outside the range [0, textureDimensions(t, level))
for the corresponding element, or
-
array_index is outside the range [0, textureNumLayers(t)), or
-
level is outside the range [0, textureNumLevels(t)), or
-
sample_index is outside the range [0, textureNumSamples(s))
If the logical texel address is invalid, the built-in function returns one of: |
fn textureLoad(t: texture_1d<ST>,
coords: C,
level: L) -> vec4<ST> | C is i32, or u32
L is i32, or u32
ST is i32, u32, or f32 | |
fn textureLoad(t: texture_2d<ST>,
coords: vec2<C>,
level: L) -> vec4<ST> | C is i32, or u32
L is i32, or u32
ST is i32, u32, or f32 | |
fn textureLoad(t: texture_2d_array<ST>,
coords: vec2<C>,
array_index: A,
level: L) -> vec4<ST> | C is i32, or u32
A is i32, or u32
L is i32, or u32
ST is i32, u32, or f32 | |
fn textureLoad(t: texture_3d<ST>,
coords: vec3<C>,
level: L) -> vec4<ST> | C is i32, or u32
L is i32, or u32
ST is i32, u32, or f32 | |
fn textureLoad(t: texture_multisampled_2d<ST>,
coords: vec2<C>,
sample_index: S)-> vec4<ST> | C is i32, or u32
S is i32, or u32
ST is i32, u32, or f32 | |
fn textureLoad(t: texture_depth_2d,
coords: vec2<C>,
level: L) -> f32 | C is i32, or u32
L is i32, or u32 | |
fn textureLoad(t: texture_depth_2d_array,
coords: vec2<C>,
array_index: A,
level: L) -> f32 | C is i32, or u32
A is i32, or u32
L is i32, or u32 | |
fn textureLoad(t: texture_depth_multisampled_2d,
coords: vec2<C>,
sample_index: S)-> f32 | C is i32, or u32
S is i32, or u32 | |
fn textureLoad(t: texture_external,
coords: vec2<C>) -> vec4<f32> | C is i32, or u32 | |
fn textureLoad(t : texture_storage_1d<F, AM>,
coords : C) -> vec4<CF> | C is i32, or u32
AM is read or read_write
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
fn textureLoad(t : texture_storage_2d<F, AM>,
coords : vec2<C>) -> vec4<CF> | C is i32, or u32
AM is read or read_write
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
fn textureLoad(t : texture_storage_2d_array<F, AM>,
coords : vec2<C>,
array_index : A) -> vec4<CF> | C is i32, or u32
AM is read or read_write
A is i32 or u32
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
fn textureLoad(t : texture_storage_3d<F, AM>,
coords : vec3<C>) -> vec4<CF> | C is i32, or u32
AM is read or read_write
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
textureNumLayersReturns the number of layers (elements) of an arrayed texture. Parameters:
t
|
The sampled,
depth, or
storage texture array texture.
| Returns: If the texture is based on cubes, returns the number of cubes in the cube arrayed texture. Otherwise returns the number of layers (homogeneous grids of texels) in the arrayed texture. |
fn textureNumLayers(t: T) -> u32 | F is a texel format
A is an access mode
ST is i32, u32, or f32
T is texture_2d_array<ST>, texture_cube_array<ST>,
texture_depth_2d_array, texture_depth_cube_array,
or texture_storage_2d_array<F,A> | |
textureNumLevelsReturns the number of mip levels of a texture. Parameters:
t
|
The sampled or depth texture.
| Returns: The mip level count for the texture. |
fn textureNumLevels(t: T) -> u32 | ST is i32, u32, or f32
T is texture_1d<ST>, texture_2d<ST>,
texture_2d_array<ST>, texture_3d<ST>,
texture_cube<ST>, texture_cube_array<ST>,
texture_depth_2d, texture_depth_2d_array,
texture_depth_cube, or texture_depth_cube_array | |
textureNumSamplesReturns the number samples per texel in a multisampled texture. Parameters:
t
|
The multisampled texture.
| Returns: The sample count for the multisampled texture. |
fn textureNumSamples(t: T) -> u32 | ST is i32, u32, or f32
T is texture_multisampled_2d<ST>
or texture_depth_multisampled_2d | |
textureSampleSamples a texture. Must only be used in a fragment shader stage. If uniformity analysis cannot prove a call to this function is in uniform control flow,
then a derivative_uniformity diagnostic is triggered. Parameters:
t
|
The sampled or depth
texture to sample.
|
s
|
The sampler type.
|
coords
|
The texture coordinates used for sampling.
|
array_index
|
The 0-based texture array index to sample.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: The sampled value. An indeterminate value results if called in non-uniform control flow. |
fn textureSample(t: texture_1d<f32>,
s: sampler,
coords: f32) -> vec4<f32> | | |
fn textureSample(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>) -> vec4<f32> | | |
fn textureSample(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
offset: vec2<i32>) -> vec4<f32> | | |
fn textureSample(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A) -> vec4<f32> | A is i32, or u32 | |
fn textureSample(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
offset: vec2<i32>) -> vec4<f32> | A is i32, or u32 | |
fn textureSample(t: T,
s: sampler,
coords: vec3<f32>) -> vec4<f32> | T is texture_3d<f32>, or texture_cube<f32> | |
fn textureSample(t: texture_3d<f32>,
s: sampler,
coords: vec3<f32>,
offset: vec3<i32>) -> vec4<f32> | | |
fn textureSample(t: texture_cube_array<f32>,
s: sampler,
coords: vec3<f32>,
array_index: A) -> vec4<f32> | A is i32, or u32 | |
fn textureSample(t: texture_depth_2d,
s: sampler,
coords: vec2<f32>) -> f32 | | |
fn textureSample(t: texture_depth_2d,
s: sampler,
coords: vec2<f32>,
offset: vec2<i32>) -> f32 | | |
fn textureSample(t: texture_depth_2d_array,
s: sampler,
coords: vec2<f32>,
array_index: A) -> f32 | A is i32, or u32 | |
fn textureSample(t: texture_depth_2d_array,
s: sampler,
coords: vec2<f32>,
array_index: A,
offset: vec2<i32>) -> f32 | A is i32, or u32 | |
fn textureSample(t: texture_depth_cube,
s: sampler,
coords: vec3<f32>) -> f32 | | |
fn textureSample(t: texture_depth_cube_array,
s: sampler,
coords: vec3<f32>,
array_index: A) -> f32 | A is i32, or u32 | |
textureSampleBiasSamples a texture with a bias to the mip level. Must only be used in a fragment shader stage. If uniformity analysis cannot prove a call to this function is in uniform control flow,
then a derivative_uniformity diagnostic is triggered. Parameters:
t
|
The sampled texture to sample.
|
s
|
The sampler type.
|
coords
|
The texture coordinates used for sampling.
|
array_index
|
The 0-based texture array index to sample.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
bias
|
The bias to apply to the mip level before sampling.
This value will be clamped in the range [-16.0, 15.99].
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: The sampled value. |
fn textureSampleBias(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
bias: f32) -> vec4<f32> | | |
fn textureSampleBias(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
bias: f32,
offset: vec2<i32>) -> vec4<f32> | | |
fn textureSampleBias(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
bias: f32) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleBias(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
bias: f32,
offset: vec2<i32>) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleBias(t: T,
s: sampler,
coords: vec3<f32>,
bias: f32) -> vec4<f32> | T is texture_3d<f32>, or texture_cube<f32> | |
fn textureSampleBias(t: texture_3d<f32>,
s: sampler,
coords: vec3<f32>,
bias: f32,
offset: vec3<i32>) -> vec4<f32> | | |
fn textureSampleBias(t: texture_cube_array<f32>,
s: sampler,
coords: vec3<f32>,
array_index: A,
bias: f32) -> vec4<f32> | A is i32, or u32 | |
textureSampleCompareSamples a depth texture and compares the sampled depth values against a reference value. Must only be used in a fragment shader stage. If uniformity analysis cannot prove a call to this function is in uniform control flow,
then a derivative_uniformity diagnostic is triggered. Parameters:
t
|
The depth texture to sample.
|
s
|
The sampler_comparison type.
|
coords
|
The texture coordinates used for sampling.
|
array_index
|
The 0-based texture array index to sample.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
depth_ref
|
The reference value to compare the sampled depth value against.
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: A value in the range [0.0..1.0]. Each sampled texel is compared against the reference value using the comparison
operator defined by the sampler_comparison, resulting in either a 0 or 1
value for each texel. If the sampler uses bilinear filtering then the returned value is
the filtered average of these values, otherwise the comparison result of a
single texel is returned. An indeterminate value results if called in non-uniform control flow. |
fn textureSampleCompare(t: texture_depth_2d,
s: sampler_comparison,
coords: vec2<f32>,
depth_ref: f32) -> f32 | | |
fn textureSampleCompare(t: texture_depth_2d,
s: sampler_comparison,
coords: vec2<f32>,
depth_ref: f32,
offset: vec2<i32>) -> f32 | | |
fn textureSampleCompare(t: texture_depth_2d_array,
s: sampler_comparison,
coords: vec2<f32>,
array_index: A,
depth_ref: f32) -> f32 | A is i32, or u32 | |
fn textureSampleCompare(t: texture_depth_2d_array,
s: sampler_comparison,
coords: vec2<f32>,
array_index: A,
depth_ref: f32,
offset: vec2<i32>) -> f32 | A is i32, or u32 | |
fn textureSampleCompare(t: texture_depth_cube,
s: sampler_comparison,
coords: vec3<f32>,
depth_ref: f32) -> f32 | | |
fn textureSampleCompare(t: texture_depth_cube_array,
s: sampler_comparison,
coords: vec3<f32>,
array_index: A,
depth_ref: f32) -> f32 | A is i32, or u32 | |
textureSampleCompareLevelSamples a depth texture and compares the sampled depth values against a reference value. Parameters:
t
|
The depth texture to sample.
|
s
|
The sampler_comparison type.
|
coords
|
The texture coordinates used for sampling.
|
array_index
|
The 0-based texture array index to sample.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
depth_ref
|
The reference value to compare the sampled depth value against.
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: A value in the range [0.0..1.0]. The textureSampleCompareLevel function is the same as textureSampleCompare, except that: |
fn textureSampleCompareLevel(t: texture_depth_2d,
s: sampler_comparison,
coords: vec2<f32>,
depth_ref: f32) -> f32 | | |
fn textureSampleCompareLevel(t: texture_depth_2d,
s: sampler_comparison,
coords: vec2<f32>,
depth_ref: f32,
offset: vec2<i32>) -> f32 | | |
fn textureSampleCompareLevel(t: texture_depth_2d_array,
s: sampler_comparison,
coords: vec2<f32>,
array_index: A,
depth_ref: f32) -> f32 | A is i32, or u32 | |
fn textureSampleCompareLevel(t: texture_depth_2d_array,
s: sampler_comparison,
coords: vec2<f32>,
array_index: A,
depth_ref: f32,
offset: vec2<i32>) -> f32 | A is i32, or u32 | |
fn textureSampleCompareLevel(t: texture_depth_cube,
s: sampler_comparison,
coords: vec3<f32>,
depth_ref: f32) -> f32 | | |
fn textureSampleCompareLevel(t: texture_depth_cube_array,
s: sampler_comparison,
coords: vec3<f32>,
array_index: A,
depth_ref: f32) -> f32 | A is i32, or u32 | |
textureSampleGradSamples a texture using explicit gradients. Parameters:
t
|
The sampled texture to sample.
|
s
|
The sampler.
|
coords
|
The texture coordinates used for sampling.
|
array_index
|
The 0-based texture array index to sample.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
ddx
|
The x direction derivative vector used to compute the sampling locations.
|
ddy
|
The y direction derivative vector used to compute the sampling locations.
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: The sampled value. |
fn textureSampleGrad(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
ddx: vec2<f32>,
ddy: vec2<f32>) -> vec4<f32> | | |
fn textureSampleGrad(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
ddx: vec2<f32>,
ddy: vec2<f32>,
offset: vec2<i32>) -> vec4<f32> | | |
fn textureSampleGrad(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
ddx: vec2<f32>,
ddy: vec2<f32>) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleGrad(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
ddx: vec2<f32>,
ddy: vec2<f32>,
offset: vec2<i32>) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleGrad(t: T,
s: sampler,
coords: vec3<f32>,
ddx: vec3<f32>,
ddy: vec3<f32>) -> vec4<f32> | T is texture_3d<f32>, or texture_cube<f32> | |
fn textureSampleGrad(t: texture_3d<f32>,
s: sampler,
coords: vec3<f32>,
ddx: vec3<f32>,
ddy: vec3<f32>,
offset: vec3<i32>) -> vec4<f32> | | |
fn textureSampleGrad(t: texture_cube_array<f32>,
s: sampler,
coords: vec3<f32>,
array_index: A,
ddx: vec3<f32>,
ddy: vec3<f32>) -> vec4<f32> | A is i32, or u32 | |
textureSampleLevelSamples a texture using an explicit mip level. Parameters:
t
|
The sampled or depth texture to
sample.
|
s
|
The sampler type.
|
coords
|
The texture coordinates used for sampling.
|
array_index
|
The 0-based texture array index to sample.
This value will be clamped to the range [0, textureNumLayers(t) - 1].
|
level
|
The mip level, with level 0 containing a full size version of the texture.
For the functions where level is a f32, fractional values may interpolate
between two levels if the format is filterable according to the
Texture Format Capabilities.
|
offset
|
The optional texel offset applied to the unnormalized texture coordinate
before sampling the texture. This offset is applied before applying any
texture wrapping modes.
The offset expression must be a const-expression (e.g. vec2<i32>(1, 2)).
Each offset component must be at least -8 and at most 7. Values outside
of this range will result in a shader-creation error.
| Returns: The sampled value. |
fn textureSampleLevel(t: texture_1d<f32>,
s: sampler,
coords: f32,
level: f32) -> vec4<f32> | | |
fn textureSampleLevel(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
level: f32) -> vec4<f32> | | |
fn textureSampleLevel(t: texture_2d<f32>,
s: sampler,
coords: vec2<f32>,
level: f32,
offset: vec2<i32>) -> vec4<f32> | | |
fn textureSampleLevel(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
level: f32) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleLevel(t: texture_2d_array<f32>,
s: sampler,
coords: vec2<f32>,
array_index: A,
level: f32,
offset: vec2<i32>) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleLevel(t: T,
s: sampler,
coords: vec3<f32>,
level: f32) -> vec4<f32> | T is texture_3d<f32>, or texture_cube<f32> | |
fn textureSampleLevel(t: texture_3d<f32>,
s: sampler,
coords: vec3<f32>,
level: f32,
offset: vec3<i32>) -> vec4<f32> | | |
fn textureSampleLevel(t: texture_cube_array<f32>,
s: sampler,
coords: vec3<f32>,
array_index: A,
level: f32) -> vec4<f32> | A is i32, or u32 | |
fn textureSampleLevel(t: texture_depth_2d,
s: sampler,
coords: vec2<f32>,
level: L) -> f32 | L is i32, or u32 | |
fn textureSampleLevel(t: texture_depth_2d,
s: sampler,
coords: vec2<f32>,
level: L,
offset: vec2<i32>) -> f32 | L is i32, or u32 | |
fn textureSampleLevel(t: texture_depth_2d_array,
s: sampler,
coords: vec2<f32>,
array_index: A,
level: L) -> f32 | A is i32, or u32
L is i32, or u32 | |
fn textureSampleLevel(t: texture_depth_2d_array,
s: sampler,
coords: vec2<f32>,
array_index: A,
level: L,
offset: vec2<i32>) -> f32 | A is i32, or u32
L is i32, or u32 | |
fn textureSampleLevel(t: texture_depth_cube,
s: sampler,
coords: vec3<f32>,
level: L) -> f32 | L is i32, or u32 | |
fn textureSampleLevel(t: texture_depth_cube_array,
s: sampler,
coords: vec3<f32>,
array_index: A,
level: L) -> f32 | A is i32, or u32
L is i32, or u32 | |
textureSampleBaseClampToEdgeSamples a texture view at its base level,
with texture coordinates clamped to the edge as described below. Parameters:
t
|
The sampled or external texture to sample.
|
s
|
The sampler type.
|
coords
|
The texture coordinates used for sampling.
Before sampling, the given coordinates will be clamped to the rectangle
[ half_texel, 1 - half_texel ]
where
half_texel = vec2(0.5) / vec2<f32>(textureDimensions(t))
Note: The half-texel adjustment ensures that,
independent of the sampler’s addressing
and filter modes,
wrapping will not occur.
That is, when sampling near an edge, the sampled texels
will be at or adjacent to that edge, and not selected from the opposite edge.
| Returns: The sampled value. |
fn textureSampleBaseClampToEdge(t: T,
s: sampler,
coords: vec2<f32>) -> vec4<f32> | T is texture_2d<f32> or texture_external | |
textureStoreWrites a single texel to a texture. Parameters:
t
|
The write-only storage texture or
read-write storage texture
|
coords
|
The 0-based texel coordinate.
|
array_index
|
The 0-based texture array index.
|
value
|
The new texel value.
value is converted using the inverse channel transfer function.
| Note: The logical texel address is invalid if:
-
any element of coords is outside the range [0, textureDimensions(t))
for the corresponding element, or
-
array_index is outside the range of [0, textureNumLayers(t))
If the logical texel address is invalid, the built-in function will not be executed. |
fn textureStore(t: texture_storage_1d<F,AM>,
coords: C,
value: vec4<CF>) | F is a texel format
C is i32, or u32
AM is write or read_write
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
fn textureStore(t: texture_storage_2d<F,AM>,
coords: vec2<C>,
value: vec4<CF>) | F is a texel format
C is i32, or u32
AM is write or read_write
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
fn textureStore(t: texture_storage_2d_array<F,AM>,
coords: vec2<C>,
array_index: A,
value: vec4<CF>) | F is a texel format
C is i32, or u32
AM is write or read_write
A is i32, or u32
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |
fn textureStore(t: texture_storage_3d<F,AM>,
coords: vec3<C>,
value: vec4<CF>) | F is a texel format
C is i32, or u32
AM is write or read_write
CF depends on the storage texel format F.
See the texel format table for the mapping of texel
format to channel format. | |