textureGatherCompare
On this page

textureGatherCompare

Function

Compares the reference depth ref against the four texels a linear filter would blend at the coordinate on mip level 0, through the comparison sampler smp, and returns the four results (0 or 1 each) as a vec4 in the order (umin,vmax), (umax,vmax), (umax,vmin), (umin,vmin), in any stage.

The signature and the sentence under each name are the compiler's own text at commit 26de7be8.

Syntax

declare function textureGatherCompare(
tex: texture_depth_2d,
smp: sampler_comparison,
uv: vec2,
ref: number,
): vec4
declare function textureGatherCompare(
tex: texture_depth_2d_array,
smp: sampler_comparison,
uv: vec2,
layer: number,
ref: number,
): vec4
declare function textureGatherCompare(
tex: texture_depth_cube,
smp: sampler_comparison,
dir: vec3,
ref: number,
): vec4
declare function textureGatherCompare(
tex: texture_depth_cube_array,
smp: sampler_comparison,
dir: vec3,
layer: number,
ref: number,
): vec4

A number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.

type f32 = number & { readonly [f32Tag]?: true }

A declaration you write still needs a width, and a bare number on a field or a parameter is refused; the TypeScript constructs page carries that row with the compiler's own message.

Parameters

Return value

vec4

Description

On a texture_depth_2d_array or a texture_depth_cube_array the layer comes before the reference. Compiles to textureGatherCompare on WGSL; GLSL ES 3.00 has no gather, so a module using it emits WGSL alone.

Targets

WGSL
textureGatherCompare(a, b, c, d)
GLSL ES 3.00
textureGatherCompare has no GLSL ES 3.00 spelling (textureGather is ES 3.10)

Examples

See also

Edit this page Report a problem