Prepare for wgsl-analyzer upgrades (#195)

* Prepare for wgsl-analyzer upgrades

* Fix the exponentials
This commit is contained in:
Daniel McNab 2022-10-27 18:45:48 +01:00 committed by Raph Levien
parent afa706bd7e
commit 3831b58dea
3 changed files with 7 additions and 9 deletions

View file

@ -1,10 +1,8 @@
{ {
"wgsl-analyzer.customImports": { "wgsl-analyzer.customImports": {
// Update as appropriate to proper path "config": "${workspaceFolder}/piet-wgsl/shader/shared/config.wgsl",
// temporary solution "segment": "${workspaceFolder}/piet-wgsl/shader/shared/segment.wgsl",
// "config": "file:C:\\Users\\Daniel\\Documents\\repositories\\linebender\\piet-gpu\\piet-wgsl\\shader\\shared\\config.wgsl", "pathtag": "${workspaceFolder}/piet-wgsl/shader/shared/pathtag.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"
}, },
"wgsl-analyzer.diagnostics.nagaVersion": "main" "wgsl-analyzer.diagnostics.nagaVersion": "main"
} }

View file

@ -45,7 +45,7 @@ fn main(
@builtin(workgroup_id) wg_id: vec3<u32>, @builtin(workgroup_id) wg_id: vec3<u32>,
) { ) {
let tile_ix = wg_id.y * config.width_in_tiles + wg_id.x; 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>(f32(global_id.x * PIXELS_PER_THREAD), f32(global_id.y));
let tile = tiles[tile_ix]; let tile = tiles[tile_ix];
var area: array<f32, PIXELS_PER_THREAD>; var area: array<f32, PIXELS_PER_THREAD>;
let backdrop_f = f32(tile.backdrop); let backdrop_f = f32(tile.backdrop);
@ -59,7 +59,7 @@ fn main(
let y0 = clamp(y, 0.0, 1.0); let y0 = clamp(y, 0.0, 1.0);
let y1 = clamp(y + segment.delta.y, 0.0, 1.0); let y1 = clamp(y + segment.delta.y, 0.0, 1.0);
let dy = y0 - y1; let dy = y0 - y1;
if (dy != 0.0) { if dy != 0.0 {
let vec_y_recip = 1.0 / segment.delta.y; let vec_y_recip = 1.0 / segment.delta.y;
let t0 = (y0 - y) * vec_y_recip; let t0 = (y0 - y) * vec_y_recip;
let t1 = (y1 - y) * vec_y_recip; let t1 = (y1 - y) * vec_y_recip;

View file

@ -295,7 +295,7 @@ fn main(
tile_seg.delta = dp; tile_seg.delta = dp;
var y_edge = mix(lp0.y, lp1.y, (tile_x0 - lp0.x) * recip_dx); var y_edge = mix(lp0.y, lp1.y, (tile_x0 - lp0.x) * recip_dx);
if xymin.x < tile_x0 { if xymin.x < tile_x0 {
let p = vec2(tile_x0, y_edge); let p = vec2<f32>(tile_x0, y_edge);
if dp.x < 0.0 { if dp.x < 0.0 {
tile_seg.delta = p - lp0; tile_seg.delta = p - lp0;
} else { } else {