TS8071
On this page

TS8071

Front-end code CONSOLE_NOT_RECORDED

A warning under compile(src, { console: 'gpu' }): a console call the WGSL does not record, on the call, with the reason (a vertex entry reaches it, an argument has no fixed size or is not a value, the stage has no room for another storage buffer).

The registry text and every compiler message on these pages are the compiler's own English.

When it fires

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

Example

example.shade.ts
"use typeshade"
function lift(x: f32): f32 {
console.log("x =", x)
return x
}
@vertex
export function vs(@builtin("vertex_index") vi: u32): vec4 {
return vec4(lift(f32(vi)), 0., 0., 1.)
}
@fragment
export function fs(@builtin("position") p: vec4): 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(@builtin("vertex_index") vi: u32): vec4 {
return vec4(lift(f32(vi)), 0., 0., 1.)
}
@fragment
export function fs(@builtin("position") p: vec4): 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 26de7be8, one line per file:

Edit this page Report a problem