TS8034
Front-end code BARRIER_PLACEMENT
workgroupBarrier() / storageBarrier() somewhere a barrier cannot stand (§25): in a vertex or fragment entry, which has no workgroup; or as a value, since a barrier is a statement (roadmap 0.2 item 5).
The registry text and every compiler message on these pages are the compiler's own English.
When it fires
workgroupBarrier() / storageBarrier() somewhere a barrier cannot stand (§25): in a vertex or fragment entry, which has no workgroup; or as a value, since a barrier is a statement (roadmap 0.2 item 5). A barrier or a workgroupUniformLoad under control flow the invocations do not share is UNIFORMITY (§54), not this.
Example
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { workgroupBarrier() return vec4(uv, 0., 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8034 error, line 5: workgroupBarrier() belongs in a compute entry or a function it calls; a fragment entry has no workgroup to wait for.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, 0., 1.)}The rule this enforces
- Rule 8.3 Test
- A builtin WGSL confines by stage may be used in an entry of a permitted stage, and in a helper that no entry of an excluded stage can reach.
See also
-
TS8052UNIFORMITY - A call that needs uniform control flow —
textureSampleand the other implicit-LOD forms, the derivatives, a barrier, orworkgroupUniformLoad— reached under a condition that is not uniform across the invocations that run together (anif, aswitch, a loop's condition, the left side of&&or||, the condition of a?:WGSL writes as anif), or after areturn,breakorcontinuetaken under one (§54).
Source
Where the compiler raises this code at commit 26de7be8, one line per file: