TS8041
Front-end code 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.
The registry text and every compiler message on these pages are the compiler's own English.
When it fires
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
"use typeshade"
declare const tex: texture_2d<f32>declare const smp: sampler
@fragmentexport function main(@location(0) uv: vec2): vec4 { return textureSample(tex, smp, vec3(uv, 0.))}Compiled at build time against the pinned compiler, this program gets:
TS8041 error, line 8: textureSample on a texture_2d<f32> takes a vec2 coordinate; got vec3.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
declare const tex: texture_2d<f32>declare const smp: sampler
@fragmentexport function main(@location(0) uv: vec2): vec4 { return textureSample(tex, smp, uv)}See also
-
SD0015 - array-texture layer must be an integer
-
TS8003TYPE_MISMATCH - Two types that do not fit where they meet (an operator, a condition, a declaration, a return or an argument), or a constant the compiler folds that WGSL refuses: a shift amount past 31, a divisor of 0, clamp bounds that cross or an f32 past its range.
Source
Where the compiler raises this code at commit 26de7be8, one line per file: