Skip to content

Commit

Permalink
Fix incorrect transcription of fallback function.
Browse files Browse the repository at this point in the history
  • Loading branch information
b0nes164 committed Sep 20, 2024
1 parent dc1e4b4 commit 5ca145b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions vello_shaders/shader/pathtag_scan_csdldf.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn main(
//Broadcast the results and flag into device memory
if local_id.x == WG_SIZE - 1u {
for (var i = 0u; i < PATH_MEMBERS; i += 1u) {
//atomicStore(&reduced[part_ix][i], (agg.p[i] << 2u) | select(FLAG_INCLUSIVE, FLAG_REDUCTION, part_ix != 0u));
atomicStore(&reduced[part_ix][i], (agg.p[i] << 2u) | select(FLAG_INCLUSIVE, FLAG_REDUCTION, part_ix != 0u));
}
}

Expand Down Expand Up @@ -206,17 +206,19 @@ fn main(
if local_id.x == WG_SIZE - 1u {
//Fallback
for (var i = 0u; i < PATH_MEMBERS; i += 1u) {
let fallback_payload = (f_agg.p[i] << 2u) | select(FLAG_INCLUSIVE, FLAG_REDUCTION, fallback_ix != 0u);
let prev_payload = atomicMax(&reduced[fallback_ix][i], fallback_payload);
if prev_payload == 0u {
prev_reduction.p[i] += f_agg.p[i];
} else {
prev_reduction.p[i] += prev_payload >> 2u;
}
if fallback_ix == 0u || (prev_payload & FLAG_MASK) == FLAG_INCLUSIVE {
atomicStore(&reduced[part_ix][i], ((agg.p[i] + prev_reduction.p[i]) << 2u) | FLAG_INCLUSIVE);
sh_tag_broadcast[i] = prev_reduction.p[i];
inc_complete.s[i] = true;
if red_complete.s[i] {
let fallback_payload = (f_agg.p[i] << 2u) | select(FLAG_INCLUSIVE, FLAG_REDUCTION, fallback_ix != 0u);
let prev_payload = atomicMax(&reduced[fallback_ix][i], fallback_payload);
if prev_payload == 0u {
prev_reduction.p[i] += f_agg.p[i];
} else {
prev_reduction.p[i] += prev_payload >> 2u;
}
if fallback_ix == 0u || (prev_payload & FLAG_MASK) == FLAG_INCLUSIVE {
atomicStore(&reduced[part_ix][i], ((agg.p[i] + prev_reduction.p[i]) << 2u) | FLAG_INCLUSIVE);
sh_tag_broadcast[i] = prev_reduction.p[i];
inc_complete.s[i] = true;
}
}
}

Expand Down

0 comments on commit 5ca145b

Please sign in to comment.