* Use `add_plugins` as `add_plugin` is deprecated.
* Use `world.resource` instead of unwrapping `world.get_resource`
as it gives better error messages.
* Add the `VelloRenderer` to the render app in the `finish` method
as the `Renderer` is async and may not have initialized by the
time that the Vello plugin is being set up.
The git revision being used was from `0.11` while the current
release is `0.12`. `0.12` is used in `wgpu`, so this lets us
have a single `naga` crate being built.
This prevents having 2 versions of `pollster` pulled into the workspace.
The workspace provided `pollster` `0.3`, while `headless` was still
using `0.2.5`.
When the bounding boxes of a path and its clip are disjoint (i.e. they
do not intersect) the result of their intersection is a negative
rectangle.
When calculating the intersection of the bboxes, the binning stage
ensures that the bbox is non-negative. It then normalizes the
coordinates to bin dimensions and rounds the top-left corner down
to the neareast integer and the bottom-right corner up.
However this rounding causes zero-area bounding boxes to have a non-zero
area and sends the bottom-right corner to the placed in the next bin.
This causes fully clipped out draw objects to be included in binning,
with an incorrect clip bounding box that causes them to be erroneously
drawn with partial clipping.
`binning` now takes care around this logic to make sure that a zero-area
intersected-bbox gets skipped and clipped out. `tile_alloc`, also takes
care in its logic.
Fixes#286 and #333
Fixed several other shader validation errors caught when running
vello_shaders natively on Metal.
These were primarily caused by reading an invalid drawtag while
accessing the scene buffer. Scene buffer access in the offending
pipelines now initialize the draw tag to DRAWTAG_NOP if an
invocation ID would land beyond the valid index range of encoded draw
objects.
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.
* Add GPU profiling
* Fix conditional compilation for `headless`
* Add full profiling
* Productionise
* Fix MacOS trace file
* Try to make it easier to tell what's important
* Resolve CI issues
This turns on clippy checking and also fixes all lints in the code.
Many lints are obvious improvements. Only a small number are slightly annoying, so I think overall worth having a vanilla default config.
Fixes the warnings remaining in the code, which should in turn let us check that in CI.
Also checks the optional features, which are easy enough to break.
I should set up git pre-push hooks. Also, I am surprised this needed a fmt, and would not add all the extra vertical space if it were up to me, but the reason we use default rustfmt is to avoid spending mental energy on such details.
* Bazel builds seem to fail to open relative paths to parent directories
due to hermetic sandboxing of third-party repositories. This adds a
WORKSPACE_MANIFEST_FILE environment variable that allows the caller to
optionally provide an absolute path to the workspace root manifest
file.
* The existing code processed a shader file only if
`FileType::is_file` returns true for it. This is not the case when
sources are accessed via symbolic links, which is possible in a Bazel
sandbox. The code now filters for the ".wgsl" file extension instead
of the file type which should generally be safe.
* 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
This exchanges the per-pixel branching with additional ALU + selects. My expectation is that this will be faster, but that may be hardware/driver dependent and likely requires profiling and examination of generated code.
The original code is kept in a comment with notes to explain the more obfuscated select version.
Previously the generated shader data structures were rooted in
backend-specific top-level mods (`mod wgsl`, `mod msl`, etc). This made
access to per-shader information that is common to all backends (e.g.
workgroup sizes, shader name etc) awkward to access from backend
agnostic code, especially when feature-gated conditional compilation is
used on the client side.
The data structures have been rearranged such that there is a top-level
`ComputeShader` declaration for each stage under a `gen` mod. The
`ComputeShader` struct declares feature-gated fields for backend shader
sources, such that backend specific data is now a leaf node in the
structure rather than the root. This has some additional benefits:
1. Common data doesn't have to be redeclared, saving on code size when
multiple backends are enabled.
2. The backend specific source code was previously encoded as a `[u8]`.
We can now use types that more closely match the expected format, for
example `&str` for WGSL and MSL, `[u32]` for SPIR-V, etc.
3. If we ever need to expose additional backend-specific metadata in the
future, we can bundle them alongside the source code in a
backend-specific data structure at this level of the tree.
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