TS8041
이 페이지에서

TS8041

프런트엔드 코드 TEXTURE_ARGUMENT

A plain argument of a texture read that the target has no overload for: a coordinate or gradient of the wrong width for the texture's dim or of an element kind the read does not take (a sampled read is by normalised f32, a texel fetch by whole i32/u32 texel), a layer, mip level or sample index that is not an integer or is not a whole number of 0 or more, and a level, bias or depth_ref that is not an f32.

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

발생 조건

A plain argument of a texture read that the target has no overload for: a coordinate or gradient of the wrong width for the texture's dim or of an element kind the read does not take (a sampled read is by normalised f32, a texel fetch by whole i32/u32 texel), a layer, mip level or sample index that is not an integer or is not a whole number of 0 or more, and a level, bias or depth_ref that is not an f32. Only a bare numeric literal is retargeted instead; anything else used to reach the backend unchanged, where Tint answers "no matching call" about generated code the author never wrote and GLSL ES 3.00 silently rounds.

One code for the whole family, on purpose. The width check and the fractional-literal check were TYPE_MISMATCH before this; splitting the family by which property of the argument is wrong gave two codes to one sentence shape and no caller a reason to care, and the 1d coordinate check moved between the two by being rewritten. The texture itself being wrong — a sampled texture handed to textureStore, a depth texture read plainly, an access mode that forbids the call — stays TYPE_MISMATCH: that is the binding's declaration, not the call's argument.

예제

example.shade.ts
"use typeshade"
declare const tex: texture_2d<f32>
declare const smp: sampler
@fragment
export function main(@location(0) uv: vec2): vec4 {
return textureSample(tex, smp, vec3(uv, 0.))
}

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

TS8041 error, 8행: textureSample on a texture_2d<f32> takes a vec2 coordinate; got vec3.

고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

example.shade.ts
"use typeshade"
declare const tex: texture_2d<f32>
declare const smp: sampler
@fragment
export function main(@location(0) uv: vec2): vec4 {
return textureSample(tex, smp, uv)
}

함께 보기

SD0015
array-texture layer must be an integer
TS8003 TYPE_MISMATCH
연산자나 조건, 선언, 반환, 인자처럼 두 값이 만나는 자리에서 타입이 서로 맞지 않거나, 컴파일러가 접는 상수를 WGSL이 거부합니다. 31을 넘는 시프트 양, 0인 제수, 서로 엇갈린 clamp 경계, 범위를 넘는 f32 값이 그렇습니다.

소스

커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

이 페이지 편집 문제 보고