textureSampleCompareLevel
On this page

textureSampleCompareLevel

Function

Compares the reference depth ref against the shadow map at uv through the comparison sampler smp at mip level 0, in any stage; returns an f32, how much of the filter footprint passed.

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

Syntax

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

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

f32

Description

On a texture_depth_2d_array the layer comes before the reference, and on a texture_depth_cube the coordinate is a vec3 direction. Compiles to textureSampleCompareLevel on WGSL and to textureLod at level zero on a sampler2DShadow on GLSL, where the reference folds into the coordinate.

Targets

WGSL
textureSampleCompareLevel(a, b, c, d)
GLSL ES 3.00
textureLod(a, vec3(c, d), 0.0)

Examples

See also

Edit this page Report a problem