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.
* replace one_minus_focal_x and abs_one_minus_focal_x variables with the actual expressions
* replace division by r^2-1 with multiplication by reciprocal
* revert chain selects to branchy code for clarity. Branching is dynamically uniform so shouldn't affect performance
* add suggested comment describing gradient kind/flags constants
Adds full support for COLRv1 radial gradients based on the two-point conical gradient algorithm at https://skia.org/docs/dev/design/conical/
Also adds robustness to degenerate cases in gradient encoding:
* Radial where p0 == p1 && r0 == r1 renders transparent solid
* Empty stops render as transparent solid
* Single stop renders as solid
* Move the vello crate to the root of the crate
* Add warning that README is work in progress
* Add newline in warning
* Move the unlicense into the shader folder
* Fixup wgsl-analyzer include paths
2023-01-05 09:32:09 +00:00
Renamed from vello/shader/draw_leaf.wgsl (Browse further)