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 dimension or of an element kind that the read does not take, a layer, mip level or sample index that is not a whole number of 0 or more, or a level, bias or depth_ref that is not an f32. A texture that is wrong for the call, such as a sampled texture handed to textureStore, is TYPE_MISMATCH.
The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.
The registry text and every compiler message on these pages are the compiler's own English.
Example
"use typeshade"
declare const tex: texture_2d<f32>declare const smp: sampler
@fragmentexport function main(uv: location<0, 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(uv: location<0, vec2>): vec4 { return textureSample(tex, smp, uv)}See also
-
SD0015 - array-texture layer must be an integer
Source
Where the compiler raises this code at commit af54ddad5, one line per file: