textureSampleLevel()
함수, 내장 함수 분류
Sample a 2D texture at an explicit mip level, returning vec4<f32>.
import { textureSampleLevel } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function textureSampleLevel( tex: ReadonlyNode<'texture_2d<f32>'>, smp: ReadonlyNode<'sampler'>, uv: ReadonlyNode<'vec2<f32>'>, level: ReadonlyNode<'f32'> | number,): Node<'vec4<f32>'>;function textureSampleLevel( tex: ReadonlyNode<'texture_2d_array<f32>'>, smp: ReadonlyNode<'sampler'>, uv: ReadonlyNode<'vec2<f32>'>, layer: ReadonlyNode<'i32' | 'u32'> | number, level: ReadonlyNode<'f32'> | number,): Node<'vec4<f32>'>;매개변수
texReadonlyNode<'texture_2d<f32>'>smpReadonlyNode<'sampler'>uvReadonlyNode<'vec2<f32>'>levelReadonlyNode<'f32'> | number
반환값
Node<'vec4<f32>'>
설명
Sample a 2D texture at an explicit mip level, returning vec4<f32>. It needs no
derivatives, so it is legal in every stage and is the form a vertex or compute shader uses
in place of textureSample, for a displacement map read in a vertex shader, say. A JS
number level lifts to an f32 literal. Spelled textureSampleLevel(t, s, uv, l) on WGSL
and textureLod(t, uv, l) on GLSL, where the sampler is part of the texture. The CPU
evaluation returns a placeholder under its gpuStubs option.
대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| WGSL (WebGPU) | 지원 |
|
| GLSL ES 3.00 (WebGL2) | 지원 |
|
| CPU 오라클 | 스텁 | The oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with |
관련 가이드
함께 보기
소스
src/core/ir/node.ts, 2082행, 커밋 c66579bf 기준