mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-07 19:31:31 +11:00
[draw_leaf] Don't write past the end of the draw_monoids buffer
The number of global invocations for draw_leaf can exceed the size of the draw_monoids buffer which gets conservatively set to the number of draw objects. Added an explicit bounds check to prevent the invalid write. This is not an issue when targeting wgpu as the WGSL compiler emits implicit bounds checking. When targeting Metal, we disable implicit bounds checks as that requires an extra buffer binding containing buffer sizes. This was caught by Xcode's Metal shader validation and resulted in visual artifacts in native rendering.
This commit is contained in:
parent
8ded5ac7dc
commit
a016fc19de
|
@ -90,7 +90,9 @@ fn main(
|
|||
m = combine_draw_monoid(m, sh_scratch[local_id.x - 1u]);
|
||||
}
|
||||
// m now contains exclusive prefix sum of draw monoid
|
||||
draw_monoid[ix] = m;
|
||||
if ix < config.n_drawobj {
|
||||
draw_monoid[ix] = m;
|
||||
}
|
||||
let dd = config.drawdata_base + m.scene_offset;
|
||||
let di = m.info_offset;
|
||||
if tag_word == DRAWTAG_FILL_COLOR || tag_word == DRAWTAG_FILL_LIN_GRADIENT ||
|
||||
|
|
Loading…
Reference in a new issue