textureSampleCompareLevel
이 페이지에서

textureSampleCompareLevel

함수

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.

이름마다 붙은 시그니처와 설명은 커밋 26de7be8의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

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

매개변수나 반환 위치에 쓰인 number는 스칼라가 들어갈 자리입니다. 앰비언트 파일은 GPU 스칼라를 브랜드가 붙은 number로 선언하고 그 브랜드는 선택이라서, 리터럴도 브랜드가 붙은 스칼라도 이 자리에 들어갑니다.

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

직접 쓰는 선언에는 여전히 너비가 필요합니다. 필드나 매개변수에 number만 적으면 거부되며, 그 행과 컴파일러가 낸 메시지는 TypeScript에서 페이지에 있습니다.

매개변수

반환값

f32

설명

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.

대상별 출력

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

예제

함께 보기

이 페이지 편집 문제 보고