Commit graph

297 commits

Author SHA1 Message Date
Chad Brokaw 016f9de05f Libify piet-wgsl
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.
2022-11-26 14:27:19 -05:00
Chad Brokaw 5dbeb992e9
Merge pull request #208 from dfrg/peniko
Update piet-scene to depend on peniko
2022-11-23 17:06:26 -05:00
Chad Brokaw eccce74c4b address review feedback 2022-11-23 16:51:30 -05:00
Chad Brokaw fc1a6e9e4e update for improved kurbo/peniko ergonomics
also removes some annoying lingering tabs from blend.wgsl
2022-11-23 12:50:28 -05:00
Chad Brokaw c1e91cb233 prevent encoding empty paths for layers too 2022-11-22 15:17:50 -05:00
Chad Brokaw f19dbdb1b5 Update piet-scene to depend on peniko
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.
2022-11-22 14:49:51 -05:00
Raph Levien 433327cb34 Don't reset query pool twice
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.
2022-11-21 21:43:03 -08:00
Chad Brokaw b2d57872d9 remove redundant PathElement:: 2022-11-07 23:34:56 -05:00
Chad Brokaw a9170c4330 prevent bad encoding with only move-tos 2022-11-07 23:26:51 -05:00
Chad Brokaw 373b027780 more robust path encoding 2022-11-07 23:08:10 -05:00
Chad Brokaw 09773f89a3 fix gradient ramp color packing 2022-10-19 15:20:04 -04:00
Chad Brokaw 6c5a2cb4f4 macOS fixes
* Fix call to removed encoded_scene method in pgpu-render
* Add new ImageFormat::Surface variant to select a pixel format that matches the platform specific surface format. This makes gradients consistent across platforms.
2022-10-19 15:20:04 -04:00
Chad Brokaw c84d1f6df5 format :( 2022-10-19 15:20:04 -04:00
Chad Brokaw d07fda8ef8 Make transforms stateless
Removes the transform state mutator from SceneBuilder and adds transform parameters to push_layer, fill and stroke methods.
2022-10-19 15:20:04 -04:00
Chad Brokaw c0fcdbad58 make gradient ramps late bound
Removes ResourceContext type. This makes scenes and fragments nearly identical. Should they be merged?
2022-10-19 15:20:04 -04:00
Chad Brokaw 782e7d51d2 Remove piet API & replace w/ fragments
Removes the dependency on the piet crate and replaces all uses with the scene crate.  Also does some cleanup of the scene API, renaming some types and moving them all to the crate root for better ergonomics.
2022-10-19 15:19:20 -04:00
Raph Levien c5d71b4349
Pare down winit features to reduce bloat
Co-authored-by: m-hugo <56653363+m-hugo@users.noreply.github.com>
2022-10-18 07:18:45 -07:00
Raph Levien b63df8e9b8 Fix android example
Updates the android example to use latest ash plumbing.
2022-10-17 20:30:57 -07:00
Raph Levien 69d16ac209 Fix ash and raw_window_handle breakage
Follow API changes introduced by ash, ash_window, and raw_window_handle.
Also updates ash_window to 0.12.

Note: this doesn't fix the android client.
2022-10-17 18:12:41 -07:00
Raph Levien 8e3df2573c Update dependencies
Update various dependencies to latest.
2022-09-21 17:26:02 -07:00
Chad Brokaw 5a127e09a5 Expose path rendering in C API
* capi: Add PathIter type and support for encoding fills
* capi: Minimal support for brushes (solid color only)
* Add flush method to command buffers
* Better initial heuristic for memory buffer size based on target dimensions
2022-08-08 01:03:27 -04:00
Chad Brokaw d7773bf877 formatting 2022-07-16 16:49:18 -04:00
Chad Brokaw 2c258363ad restore tile.h to maintain sync with tile.rs 2022-07-16 16:48:04 -04:00
Chad Brokaw 8943fa7ea6 encode absolute transforms
This removes the GPU transform stage, changes shaders to reference transforms directly from the scene, and modifies the render context to maintain a transform stack.
2022-07-15 14:36:20 -04:00
Chad Brokaw d6ffe970f9 Make graphics support non-optional for Vulkan
This also removes the new present flag, deletes some commented code and explains the lack of surface validation in device selection.
2022-07-15 13:14:12 -04:00
Chad Brokaw fb952de1f3
Update piet-gpu/bin/android.rs
Co-authored-by: Raph Levien <raph.levien@gmail.com>
2022-07-15 12:49:40 -04:00
Chad Brokaw 58721dc5c2 fix new API use for android example 2022-07-14 15:03:27 -04:00
Chad Brokaw 8de34f8728 remove shader gen directories 2022-07-14 14:57:17 -04:00
Chad Brokaw 9626eaa19b separate instance and surface creation
This separates creation of Instance and Surfaces, allowing for rendering to multiple windows.
2022-07-14 14:46:46 -04:00
Commit by GitHub Action bbdd4432f5 commit compiled shaders 2022-07-14 14:28:45 +00:00
Commit by GitHub Action d529d3b0e8 merge from dev branch - dev 2022-07-14 14:28:25 +00:00
Raph Levien bfa4abf642
Merge pull request #181 from linebender/mem2
Implement robust dynamic memory
2022-07-14 07:27:38 -07:00
Commit by GitHub Action cac14a0aa7 merge from dev branch 2022-07-14 04:33:57 +00:00
Raph Levien 1a20fe78f6 Portability fixes
Makes the changes work on Windows and Android.
2022-07-13 17:43:28 -07:00
Raph Levien 61598d2da0 Gather timing statistics from RenderDriver
Also change command line binaries to use new abstraction.
2022-07-13 17:01:48 -07:00
Raph Levien 169f053003 Update winit to 0.26.1
This is mostly to silence security warnings about a nix vulnerability.
2022-07-13 12:45:17 -07:00
Raph Levien 9930c9d1de rustfmt 2022-07-13 12:35:21 -07:00
Raph Levien 240f44a228 Implement robust dynamic memory
This is the core logic for robust dynamic memory. There are changes to both shaders and the driver logic.

On the shader side, failure information is more useful and fine grained. In particular, it now reports which stage failed and how much memory would have been required to make that stage succeed.

On the driver side, there is a new RenderDriver abstraction which owns command buffers (and associated query pools) and runs the logic to retry and reallocate buffers when necessary. There's also a fairly significant rework of the logic to produce the config block, as that overlaps the robust memory.

The RenderDriver abstraction may not stay. It was done this way to minimize code disruption, but arguably it should just be combined with Renderer.

Another change: the GLSL length() method on a buffer requires additional infrastructure (at least on Metal, where it needs a binding of its own), so we now pass that in as a field in the config.

This also moves blend memory to its own buffer. This worked out well because coarse rasterization can simply report the size of the blend buffer and it can be reallocated without needing to rerun the pipeline. In the previous state, blend allocations and ptcl writes were interleaved in coarse rasterization, so a failure of the former would require rerunning coarse. This should fix #83 (finally!)

There are a few loose ends. The binaries haven't (yet) been updated (I've been testing using a hand-written test program). Gradients weren't touched so still have a fixed size allocation. And the logic to calculate the new buffer size on allocation failure could be smarter.

Closes #175
2022-07-13 12:34:51 -07:00
Commit by GitHub Action f6ea9308ba commit compiled shaders 2022-07-13 19:27:07 +00:00
Raph Levien 64e6268059 Remove generated shaders from dev branch 2022-07-13 12:22:11 -07:00
Raph Levien b77df99159
Merge pull request #178 from linebender/ci2
Shader compilation in GitHub Actions
2022-07-13 12:21:37 -07:00
Raph Levien db49bed50c Doc improvements
Explain the shader compilation approach. Also add links while I'm at it.
2022-07-13 12:07:55 -07:00
Daniel McNab 35fe9b4d1f Disable the android example when not compiling for android 2022-06-25 14:16:20 +01:00
Raph Levien 9df486ef35 Fix blend memory issues 2022-05-20 14:02:24 -07:00
Raph Levien 368954a643 Merge branch 'master' into blend_mem
This does the merge and also rebuilds the generated shaders.
2022-05-19 15:42:45 -07:00
Raph Levien a4299c1f02
Merge pull request #172 from linebender/query_pool_size
Fix query pool size
2022-05-19 15:39:31 -07:00
Raph Levien d62a40ea34
Update piet-gpu/bin/cli.rs
Co-authored-by: Chad Brokaw <cbrokaw@gmail.com>
2022-05-19 15:35:15 -07:00
Raph Levien 693ecd69e1 Make query pool size an associated constant 2022-05-19 15:28:46 -07:00
Raph Levien ee6694729b Fix query pool size
This was causing harmless warnings on mac but causing rendering to fail
on Pixel 6.
2022-05-19 14:31:00 -07:00
Raph Levien aac6513409 Compile shaders on Windows
Updates DXIL on generated shaders.
2022-05-18 15:41:00 -07:00