This creates a new Renderer type that offers fairly simple render_to_texture and render_to_surface methods, the latter of which handles the final blit internally. Also adds a util module with some helpers for device and surface creation.
There is a new winit example in piet-wgsl/examples/winit that shows how to make use of it all. This should be fairly trivial to adapt to glazier/xilem.
* add writeable image support to engine
* add external resources to engine
* update fine to output to a texture
* copy over original piet-gpu test scenes
* put it all in a pretty (resizable!) window
Now that wgsl-analyzer 0.6 is released, most explicit type annotations on vec can be dropped (the exception being when it is a type conversion).
Also changes mix to select when the selector is actually boolean.
This adds a new dependency on peniko, reintroduces kurbo for geometry (!), removes the now defunct types from piet-scene and updates all the test scenes to use the new types.
When invoked in non robust memory mode (ie not using RenderDriver), both
the render_coarse and render_fine calls reset the query pool, which in
turn causes the fetch of the query pool to hang (in Vulkan).
This is not an issue in robust memory mode because there are two
different query pools, and both should indeed be reset.
This patch makes the second reset conditional on the query pool being
fresh.
Fixes an observed hang with the xilem prototype on Windows.
As stated by the README, the intention is for the shaders to be
provided under the terms of the Unlicense in addition to the MIT
and Apache-2.0 licenses.
While here, add a self-contained UNLICENSE file to replace the
external reference to unlicense.org.
This is a checkpoint of partly completed work. Much of the GPU side is done, very little of the CPU side.
For clips, the clip_els bindings (binding 6 of draw_leaf) are not added. Clip logic is missing from coarse. The overflow buffer is missing from fine, as is its size calculation in coarse (but it should work as long as the max depth fits within BLEND_STACK_SPLIT).
For gradients, the texture binding is missing (binding 6) is missing from fine, as is the infrastructure in engine to deal with texture resources, and of course porting over the logic to fill it.
The code is not tested, bugs may lurk.
Note that this is evidence in favor of https://github.com/gfx-rs/naga/issues/2098 - my code is actually wrong, and it was caught by trying to port it to run in Chrome Canary.
Still one flaw, fat lines aren't expanded with strokes in path coarse rasterization. But that's a small visual ding, and can be fixed
That said, there is some really strange stuff going on in tile_alloc. It's using storage to do a uniform broadcast (the result of bump allocation for the workgroup), which is not great at all. It should be using workgroup storage, but on my mac it behaves as if the workgroup barrier is not in place. Investigating.
All streams of the scene are combined into a single buffer. This is very much like existing piet-gpu, however the various outputs from the compute stages (whether computed on CPU or GPU) will retain their separate bindings, which is more native to WGSL.
There's a touch of ergonomics loss, in particular when we do transforms we'll need to unmarshal them by hand, but I think overall not too bad.
The bones of coarse rasterization are in place (so far, fills only). Still not suitable for end-to-end (need to generate bounding boxes, among other things), but getting closer.
This lets us use https://github.com/wgsl-analyzer/wgsl-analyzer for writing the wgsl files.
The imports (for wgsl-analyzer) have to be machine specific at the moment - to use this you need to configure .vscode/settings.json yourself. The alternative is to point them at static files on GitHub, which is tempting to make things easier, but would potentially go out of sync with what is actually used.