TS8034
On this page

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

example.shade.ts
"use typeshade"
@fragment
export 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.

example.shade.ts
"use typeshade"
@fragment
export 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

TS8052 UNIFORMITY
A call that needs uniform control flow — textureSample and the other implicit-LOD forms, the derivatives, a barrier, or workgroupUniformLoad — reached under a condition that is not uniform across the invocations that run together (an if, a switch, a loop's condition, the left side of && or ||, the condition of a ?: WGSL writes as an if), or after a return, break or continue taken under one (§54).

Source

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

Edit this page Report a problem