TS8071
On this page

TS8071

Front-end code CONSOLE_NOT_RECORDED

A warning under compile(src, { console: 'gpu' }): a console call that the WGSL does not record. The message gives the reason: a vertex entry reaches the call, an argument has no fixed size or is not a value, or the stage has no room for another storage buffer. The call still reaches the sink on the CPU (Rule 11.9).

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

example.shade.ts
"use typeshade"
function lift(x: f32): f32 {
console.log("x =", x)
return x
}
@vertex
export function vs(vi: builtin<"vertex_index">): vec4 {
return vec4(lift(f32(vi)), 0., 0., 1.)
}
@fragment
export function fs(p: builtin<"position">): vec4 {
return vec4(p.x, 0., 0., 1.)
}

Compiled with { console: 'gpu' }, the option under which the WGSL records console calls.

Compiled at build time against the pinned compiler, this program gets:

TS8071 warning, line 4: This console.log() is not recorded on the GPU, because the vertex entry "vs" reaches it, and a vertex stage cannot write a storage buffer. It still reaches the sink when the function runs on the CPU.

How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts
"use typeshade"
function lift(x: f32): f32 {
return x
}
@vertex
export function vs(vi: builtin<"vertex_index">): vec4 {
return vec4(lift(f32(vi)), 0., 0., 1.)
}
@fragment
export function fs(p: builtin<"position">): vec4 {
console.log("x =", p.x)
return vec4(p.x, 0., 0., 1.)
}

The rule this enforces

Rule 11.9 Test
A console call computes nothing a shader reads: its arguments must be evaluated once, in order, on every target, and the call then delivers an event, { method, args, span, invocation }.

See also

Source

Where the compiler raises this code at commit af54ddad5, one line per file:

Edit this page Report a problem