TS8071
프런트엔드 코드 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).
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
발생 조건
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).
예제
"use typeshade"
function lift(x: f32): f32 { console.log("x =", x) return x}
@vertexexport function vs(@builtin("vertex_index") vi: u32): vec4 { return vec4(lift(f32(vi)), 0., 0., 1.)}
@fragmentexport function fs(@builtin("position") p: vec4): vec4 { return vec4(p.x, 0., 0., 1.)}WGSL이 console 호출을 기록하게 하는 옵션인 { console: 'gpu' }를 주고 컴파일했습니다.
빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8071 warning, 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.
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"use typeshade"
function lift(x: f32): f32 { return x}
@vertexexport function vs(@builtin("vertex_index") vi: u32): vec4 { return vec4(lift(f32(vi)), 0., 0., 1.)}
@fragmentexport function fs(@builtin("position") p: vec4): vec4 { console.log("x =", p.x) return vec4(p.x, 0., 0., 1.)}이 코드가 적용하는 규칙
- 규칙 11.9 테스트
- A
consolecall 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 }.
함께 보기
소스
커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.