and `macos_app` examples.
`winit` does not create an autorelease pool, so the Metal backend had not taken
the presence of one into account. Now the Metal backend creates and flushes
autorelease pools as necessary.
Closes#334.
Closes#376.
Each bundle of four pixels on a scanline is packed into the RGBA channels of
the mask texture. The area LUT is also expanded to be RGBA so that four pixels'
worth of areas can be looked up at once.
Nice improvement on `paris-30k` from MPVG.
Closes#262.
to `surfman`.
This is a large commit; explanations of each change follow.
This adds an optional compute shader path, off by default, for rendering fills
to alpha masks. It usually does not improve performance at present, but it
provides a good baseline for further optimizations. Later improvements will
likely aim to avoid writes to the mask texture entirely. Supporting
infrastructure for compute shader has been added to `pathfinder_gpu` for the
OpenGL and Metal backends.
The Metal backend has been optimized to avoid unneccessary buffer allocations
and reflection. As part of this, argument buffers have been removed, as the
current SPIRV-Cross compiler no longer requires them.
The GPU renderer has been improved to avoid stalls. Now, separate buffers are
allocated for each fill batch and for each frame. This can be extended in the
future to allow for separate buffers for tile draw operations as well.
SDL usage has been removed in favor of the native Rust `surfman` and `winit`.
Because `surfman` allows for selection of the integrated GPU on multi-GPU
system, it is chosen by default. The demo supports a new
`--high-performance-gpu` option to opt into the discrete GPU.
In particular, this fixes the usvg-to-Pathfinder transform conversion and the
definition of `Transform2F::row_major()`.
Makes `drops.svg` from the MPVG samples work.
We can do more tile-based optimization, but this should be enough to ensure a
correct rendering.
This temporarily breaks subpixel AA, but it should be fixable by modifying
`blur.fs.glsl`.
Closes#271.
These cannot be implemented with the standard OpenGL blending functions, so we
have to do them manually in a shader, which requires a good deal of machinery
to create intermediate framebuffers and so forth.
This commit substantially reworks the `pathfinder_gpu` API to better support
modern APIs like Metal. It should open the door to `gfx-rs`, `wgpu`, Vulkan,
and D3D12 backends relatively straightforwardly.
A new example, `canvas_metal_minimal`, has been added.
Note that the new Metal shaders require a patched version of `spirv-cross` to
build properly. An upstream patch is forthcoming.
The Metal shaders are checked into the repository for convenience, but they
should not be directly edited. Instead, edit the corresponding GLSL shader in
the top-level `shaders/` directory, and rerun `make` in there.
distance-to-edge for stencil analytic antialiasing.
This improves the rendering quality of stencil AAA significantly.
Additionally, this adds an approximation of Core Graphics' (macOS')
defringing filter.
Closes#73.
This doesn't break meshes the way the previous "discard if too thin"
code did. It fixes several issues observed on Wikipedia when using
Pathfinder in Firefox.
Closes#72.
The new `vXDist` values *can* be deduced simply from the `vUV` values
and first-order derivatives thereof, and therefore they're technically
redundant. However, calculating them in this way increases the
complexity and ALU load in the fragment shader. It's simpler to just
compute the additional values in the vertex shader and use
interpolation.
technique similar to the new MCAA.
This new technique simplifies the code significantly by unifying lines,
curves, and transformed curves. Blog posts forthcoming.
approximation of area based on approximate first-order line distance.
This enables support for full affine transforms in MCAA. It also greatly
simplifies the shader and reduces the amount of work that the GPU needs
to do for fragment shading.
Experimental testing has shown the area approximation to be accurate to
about 4%.
This removes a whole lot of code from `pathfinder_path_utils`. Hopefully
the remaining code can go upstream.
These changes regress quality of stroke widths for cubic curves, because
they move fill-to-stroke conversion before cubic-to-quadratic
conversion. To fix that, we will need to recursively subdivide when
doing fill-to-stroke conversion.
enable early Z for SVG.
Additionally, this switches the B-quad patches for XCAA to be convex
hulls instead of bounding boxes, reducing fragment shader load.
This is a large speedup for the Ghostscript tiger demo: 5x or more.
Closes#33.
ECAA algorithm for multicolor SVG.
This is much faster than both Skia and the previous XCAA algorithm
while maintaining slightly higher quality than the latter.
There are a couple of known issues:
* Vertical inflection points of hairlines with very steep slopes can
become very light or even drop out occasionally. I suspect this is due
to floating point error.
* Rarely, single columns of pixels can disappear from a mesh. Cause TBD.
Besides these bugs, this technique can be cleaned up and probably made
faster, but it's a sizable improvement as is.