textureLoad()
함수, 내장 함수 분류
Load one texel from a 2D texture at integer coordinates, returning vec4<f32>, vec4<u32> or vec4<i32> to match the texture's element.
import { textureLoad } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function textureLoad<K extends TextureLoad2dKey>( tex: ReadonlyNode<K>, coord: NodeLike, level: NodeLike,): Node<TexelKey<K>>;function textureLoad<K extends TextureLoadArrayKey>( tex: ReadonlyNode<K>, coord: NodeLike, layer: ReadonlyNode<'i32' | 'u32'> | number, level: NodeLike,): Node<TexelKey<K>>;매개변수
texReadonlyNode<K>coordNodeLikelevelNodeLike
반환값
예외
SD0015A JS number level lifts to a u32 literal, so 0 emits a valid integer level on both targets, and a fractional level throws SD0015.
설명
WGSL requires the mip level
argument; pass 0 for the base level. A JS number level lifts to a u32 literal, so 0
emits a valid integer level on both targets, and a fractional level throws SD0015. The
coordinate is usually a vec2<i32>; any vector or scalar node is accepted here and the
GPU compiler checks it. The CPU evaluation returns a placeholder under its gpuStubs
option.
For an integer texture this is the read to use: integer texels cannot be filtered, so
textureSample and textureSampleLevel reject those keys at tsc.
대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| 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, 2146행, 커밋 c66579bf 기준