Remove all wgsl-analyzer errors (#210)

* Fix missing import

* Format
This commit is contained in:
Daniel McNab 2022-11-25 16:43:21 +00:00 committed by GitHub
parent 5dbeb992e9
commit 7d5063b187
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 14 deletions

View file

@ -1,14 +1,15 @@
{ {
"wgsl-analyzer.customImports": { "wgsl-analyzer.customImports": {
"bbox": "${workspaceFolder}/piet-wgsl/shader/shared/bbox.wgsl", "bbox": "${workspaceFolder}/piet-wgsl/shader/shared/bbox.wgsl",
"blend": "${workspaceFolder}/piet-wgsl/shader/shared/blend.wgsl",
"bump": "${workspaceFolder}/piet-wgsl/shader/shared/bump.wgsl", "bump": "${workspaceFolder}/piet-wgsl/shader/shared/bump.wgsl",
"clip": "${workspaceFolder}/piet-wgsl/shader/shared/clip.wgsl", "clip": "${workspaceFolder}/piet-wgsl/shader/shared/clip.wgsl",
"config": "${workspaceFolder}/piet-wgsl/shader/shared/config.wgsl", "config": "${workspaceFolder}/piet-wgsl/shader/shared/config.wgsl",
"cubic": "${workspaceFolder}/piet-wgsl/shader/shared/cubic.wgsl", "cubic": "${workspaceFolder}/piet-wgsl/shader/shared/cubic.wgsl",
"drawtag": "${workspaceFolder}/piet-wgsl/shader/shared/drawtag.wgsl", "drawtag": "${workspaceFolder}/piet-wgsl/shader/shared/drawtag.wgsl",
"segment": "${workspaceFolder}/piet-wgsl/shader/shared/segment.wgsl",
"pathtag": "${workspaceFolder}/piet-wgsl/shader/shared/pathtag.wgsl", "pathtag": "${workspaceFolder}/piet-wgsl/shader/shared/pathtag.wgsl",
"ptcl": "${workspaceFolder}/piet-wgsl/shader/shared/ptcl.wgsl", "ptcl": "${workspaceFolder}/piet-wgsl/shader/shared/ptcl.wgsl",
"segment": "${workspaceFolder}/piet-wgsl/shader/shared/segment.wgsl",
"tile": "${workspaceFolder}/piet-wgsl/shader/shared/tile.wgsl" "tile": "${workspaceFolder}/piet-wgsl/shader/shared/tile.wgsl"
}, },
"wgsl-analyzer.diagnostics.nagaVersion": "main", "wgsl-analyzer.diagnostics.nagaVersion": "main",

View file

@ -28,20 +28,20 @@ fn main(
let width_in_tiles = config.width_in_tiles; let width_in_tiles = config.width_in_tiles;
let ix = wg_id.x * width_in_tiles + local_id.x; let ix = wg_id.x * width_in_tiles + local_id.x;
var backdrop = 0; var backdrop = 0;
if (local_id.x < width_in_tiles) { if local_id.x < width_in_tiles {
backdrop = tiles[ix].backdrop; backdrop = tiles[ix].backdrop;
} }
sh_backdrop[local_id.x] = backdrop; sh_backdrop[local_id.x] = backdrop;
// iterate log2(WG_SIZE) times // iterate log2(WG_SIZE) times
for (var i = 0u; i < firstTrailingBit(WG_SIZE); i += 1u) { for (var i = 0u; i < firstTrailingBit(WG_SIZE); i += 1u) {
workgroupBarrier(); workgroupBarrier();
if (local_id.x >= (1u << i)) { if local_id.x >= (1u << i) {
backdrop += sh_backdrop[local_id.x - (1u << i)]; backdrop += sh_backdrop[local_id.x - (1u << i)];
} }
workgroupBarrier(); workgroupBarrier();
sh_backdrop[local_id.x] = backdrop; sh_backdrop[local_id.x] = backdrop;
} }
if (local_id.x < width_in_tiles) { if local_id.x < width_in_tiles {
tiles[ix].backdrop = backdrop; tiles[ix].backdrop = backdrop;
} }
} }