From 3831b58deae83528cfaaa43876bcf4e805229291 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 27 Oct 2022 18:45:48 +0100 Subject: [PATCH] Prepare for wgsl-analyzer upgrades (#195) * Prepare for wgsl-analyzer upgrades * Fix the exponentials --- .vscode/settings.json | 8 +++----- piet-wgsl/shader/fine.wgsl | 4 ++-- piet-wgsl/shader/path_coarse.wgsl | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e619026..323cd81 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,8 @@ { "wgsl-analyzer.customImports": { - // Update as appropriate to proper path - // temporary solution - // "config": "file:C:\\Users\\Daniel\\Documents\\repositories\\linebender\\piet-gpu\\piet-wgsl\\shader\\shared\\config.wgsl", - // "segment": "file:C:\\Users\\Daniel\\Documents\\repositories\\linebender\\piet-gpu\\piet-wgsl\\shader\\shared\\segment.wgsl", - // "pathtag": "file:C:\\Users\\Daniel\\Documents\\repositories\\linebender\\piet-gpu\\piet-wgsl\\shader\\shared\\pathtag.wgsl" + "config": "${workspaceFolder}/piet-wgsl/shader/shared/config.wgsl", + "segment": "${workspaceFolder}/piet-wgsl/shader/shared/segment.wgsl", + "pathtag": "${workspaceFolder}/piet-wgsl/shader/shared/pathtag.wgsl" }, "wgsl-analyzer.diagnostics.nagaVersion": "main" } diff --git a/piet-wgsl/shader/fine.wgsl b/piet-wgsl/shader/fine.wgsl index 92fdafe..9d62793 100644 --- a/piet-wgsl/shader/fine.wgsl +++ b/piet-wgsl/shader/fine.wgsl @@ -45,7 +45,7 @@ fn main( @builtin(workgroup_id) wg_id: vec3, ) { let tile_ix = wg_id.y * config.width_in_tiles + wg_id.x; - let xy = vec2(f32(global_id.x * PIXELS_PER_THREAD), f32(global_id.y)); + let xy = vec2(f32(global_id.x * PIXELS_PER_THREAD), f32(global_id.y)); let tile = tiles[tile_ix]; var area: array; let backdrop_f = f32(tile.backdrop); @@ -59,7 +59,7 @@ fn main( let y0 = clamp(y, 0.0, 1.0); let y1 = clamp(y + segment.delta.y, 0.0, 1.0); let dy = y0 - y1; - if (dy != 0.0) { + if dy != 0.0 { let vec_y_recip = 1.0 / segment.delta.y; let t0 = (y0 - y) * vec_y_recip; let t1 = (y1 - y) * vec_y_recip; diff --git a/piet-wgsl/shader/path_coarse.wgsl b/piet-wgsl/shader/path_coarse.wgsl index fa24952..23590d5 100644 --- a/piet-wgsl/shader/path_coarse.wgsl +++ b/piet-wgsl/shader/path_coarse.wgsl @@ -132,7 +132,7 @@ let MAX_QUADS = 16u; @compute @workgroup_size(256) fn main( @builtin(global_invocation_id) global_id: vec3, - @builtin(local_invocation_id) local_id: vec3, + @builtin(local_invocation_id) local_id: vec3, ) { // Obtain exclusive prefix sum of tag monoid let ix = global_id.x; @@ -295,7 +295,7 @@ fn main( tile_seg.delta = dp; var y_edge = mix(lp0.y, lp1.y, (tile_x0 - lp0.x) * recip_dx); if xymin.x < tile_x0 { - let p = vec2(tile_x0, y_edge); + let p = vec2(tile_x0, y_edge); if dp.x < 0.0 { tile_seg.delta = p - lp0; } else {