Skip to content

Commit

Permalink
[binning] Do not use numerical operators on atomics (#539)
Browse files Browse the repository at this point in the history
This fixes a comparison expression and a compound-assignment
expression that used an atomic as an operand. These should be
treated as illegal based on my understanding of the WGSL
specification (and are rejected by Tint) but Naga accepts
them and injects appropriate atomic operations during code generation.

See gfx-rs/wgpu#5474 for more details.
  • Loading branch information
armansito authored Apr 1, 2024
1 parent aad292d commit 854120a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shader/binning.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ fn main(
atomicStore(&sh_bitmaps[i][local_id.x], 0u);
}
if local_id.x == 0u {
let failed = bump.lines > config.lines_size;
let failed = atomicLoad(&bump.lines) > config.lines_size;
sh_previous_failed = u32(failed);
}
// also functions as barrier to protect zeroing of bitmaps
let failed = workgroupUniformLoad(&sh_previous_failed);
if failed != 0u {
if global_id.x == 0u {
bump.failed |= STAGE_FLATTEN;
atomicOr(&bump.failed, STAGE_FLATTEN);
}
return;
}
Expand Down

0 comments on commit 854120a

Please sign in to comment.