Commit graph

12 commits

Author SHA1 Message Date
Arman Uguray a016fc19de [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.
2023-06-28 12:39:24 -07:00
Chad Brokaw 7b68630d6a refactor common scale ratio code 2023-05-15 14:54:44 -04:00
Chad Brokaw 58c7df469d Address review feedback
* 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
2023-05-15 14:45:38 -04:00
Chad Brokaw b103a55301 rework radial gradients
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
2023-05-09 18:09:53 -04:00
Chad Brokaw ced6309a3b support two point radial with r0 > 0.0 2023-05-06 03:27:53 -04:00
Chad Brokaw a8585781cd move atlas rect to info
Atlas offset and image size were originally stored in the ptcl but are not tile dependent. Moving these to info saves 8 bytes per image tile.
2023-03-10 01:42:50 -05:00
Chad Brokaw 165b3a083b Let's add images 2023-03-09 17:18:03 -05:00
Chad Brokaw f657b88018 use matrix math! 2023-02-23 01:19:04 -05:00
Chad Brokaw 659ab2ff7e simplify 2023-02-22 23:25:45 -05:00
Chad Brokaw 1f938e5f49 linear algebra refresher 2023-02-22 23:18:51 -05:00
Chad Brokaw 3c15bff867 Proper inverse of translation components 2023-02-22 23:08:38 -05:00
Daniel McNab ff59839737
Move the vello crate to the workspace root (#231)
* 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)