eliminates double layouts.
This adds an extension to the HTML canvas API that allows you to pass the
`TextMetrics` object returned by `measure_text()` to `fill_text()` and/or
`stroke_text()` to draw the measured text without laying it out again. It
improves performance on the `canvas_nanovg` demo.
Expose EmbeddedResourceLoader to c api
### Background
This PR exposes the c api to the EmbeddedResourceLoader, to prevent some of the issues mentioned [here](https://github.com/servo/pathfinder/issues/234).
### Approach
- Followed `PFFilesystemResourceLoaderLocate` and simply exposed the ERL's new and boxed it in the ResourceLoaderWrapper
- Used the `Create` terminology in the signature to match the rest of the api where a new() is called
### Notes
- I successfully tested it in a little .NET binding project I'm working on.
- Moved the \`gl\` section comment down with the GL methods, as it seemed a little out of place. added a \`resources\` one. then moved the destroy fn in to the new section.
Let me know if I misinterpreted anything or if there are any changes, stylistic or otherwise, that you'd prefer. Thanks!
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.
Its only use is for CoreAnimationLayerRef::from_ptr() in
PFMetalDeviceCreate, so this fixes a warning on other platforms.
The last time I tried to fix this warning I didn’t notice that it was
actually used, and thus 2d2bc14e5c broke
the macOS build in #257.
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.
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.