Commit Graph

13 Commits

Author SHA1 Message Date
Michael Pfaff 5e41738e4c Improve C API
I ran `cargo fmt` on the project, which in hindsight was a poor choice.
I'm not correcting it right now.
2024-08-09 03:17:33 -04:00
Ibiyemi Abiodun 474458725e
updated canvas_nanovg example 2021-06-05 18:23:10 -04:00
Patrick Walton 41c0c5f071 Upgrade to the latest master surfman 2020-05-08 12:47:58 -07:00
Patrick Walton 90fb36f199 Switch to using surfman in X11 mode.
Partially addresses #310.
2020-05-08 12:22:46 -07:00
Patrick Walton ac83f79d94 Add a compute shader path, optimize GPU memory management, and switch from SDL
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.
2020-04-30 13:33:29 -07:00
Patrick Walton 0b43f629cd Cache loaded fonts and glyph outlines.
Approximately a 70% CPU time improvement on the NanoVG demo.
2020-04-16 16:28:44 -07:00
Patrick Walton 5efdf2a04a Implement the missing pieces of `TextMetrics` for canvas.
This required a `font-kit` upgrade, and with it a `skribo` upgrade.
2020-04-14 15:01:30 -07:00
Patrick Walton 895f73096e Switch back to instanced drawing for tiles.
Improves tile build time by something around 2x in the NanoVG demo.
2020-04-08 17:16:54 -07:00
Patrick Walton ae97ccea5a Improve ergonomics of the canvas font interface, and use the right fonts in the
NanoVG demo.
2020-04-01 16:25:13 -07:00
Patrick Walton a1f0ae097a Add thumbnail images to the NanoVG demo 2020-03-30 16:18:41 -07:00
Patrick Walton 55df287fec Move radial gradients from the CPU to the GPU 2020-03-26 21:24:20 -07:00
Patrick Walton f607b607b0 Composite render targets using tiles, taking the Z-buffer into account.
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.
2020-03-02 20:10:10 -08:00
Patrick Walton 25f9346160 Add an incomplete port of the NanoVG example app 2020-02-19 11:00:03 -08:00