Skip to content

Commit

Permalink
Make draw_leaf pass uniformity analysis (#535)
Browse files Browse the repository at this point in the history
It was in fact uniform, but required a little arithmetic to infer that. Refactor the math slightly so it's clear even to a simplistic analysis.
  • Loading branch information
raphlinus authored Mar 27, 2024
1 parent eea9710 commit 5cc08d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions shader/draw_leaf.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ fn main(
let remainder = num_blocks_total % WG_SIZE;
let first_block = n_blocks_base * wg_id.x + min(wg_id.x, remainder);
let n_blocks = n_blocks_base + u32(wg_id.x < remainder);
var ix = first_block * WG_SIZE + local_id.x;
let ix_end = ix + n_blocks * WG_SIZE;
while ix != ix_end {
var block_start = first_block * WG_SIZE;
let blocks_end = block_start + n_blocks * WG_SIZE;
while block_start != blocks_end {
let ix = block_start + local_id.x;
let tag_word = read_draw_tag_from_scene(ix);
agg = map_draw_tag(tag_word);
workgroupBarrier();
Expand Down Expand Up @@ -262,7 +263,7 @@ fn main(
}
clip_inp[m.clip_ix] = ClipInp(ix, i32(path_ix));
}
ix += WG_SIZE;
block_start += WG_SIZE;
// break here on end to save monoid aggregation?
prefix = combine_draw_monoid(prefix, sh_scratch[WG_SIZE - 1u]);
}
Expand Down

0 comments on commit 5cc08d4

Please sign in to comment.