Commit graph

42 commits

Author SHA1 Message Date
Arman Uguray acfd570440 Handle error that can be returned by render_to_texture 2023-03-03 11:32:39 -08:00
Arman Uguray 3bbf108df5 Renamed clear_color to base_color; addressed review comments 2023-03-02 14:29:44 -08:00
Arman Uguray 05fa8c7c39 RenderParams struct for render-time options
The texture and surface render API now takes render-time parameters
(such as clear color, target width/height) as a RenderParams struct.

The examples have been updated to demonstrate this. The with_winit
example now accepts a clear color as a command line option.
2023-03-02 11:25:19 -08:00
Arman Uguray 8eabc12a72 Add a clear_color uniform
Introduced an RGBA8 config parameter to apply as a base blend color in
the fine stage of the full pipeline.
2023-03-02 09:26:31 -08:00
Chad Brokaw 6612b7a8ef
From typo in comment 2023-02-22 21:47:35 -05:00
Chad Brokaw 033870d91e Fix brush transforms
This fixes an incorrect application of the inverse transform for radial gradients in fine.

Also fixes an edge case in `SceneBuilder` where a brush transform is identical to the path transform leading to a corrupt encoding.
2023-02-22 20:10:00 -05:00
Daniel McNab 56939df615 Re-use render context in headless 2023-02-09 09:34:53 +00:00
Daniel McNab 65a7970382 Setup infra for headless examples 2023-02-07 12:52:22 +00:00
Daniel McNab f84e244fd7
Update to wgpu 0.15 (#263) 2023-01-31 16:07:03 +00:00
Raph Levien db018da537 Make wasm port work again
This cheats somewhat, using the non-robust version of the pipeline for
wasm, and blocking on native.
2023-01-26 17:41:30 -08:00
Raph Levien 264fd3ec12 Merge branch 'main' into async 2023-01-26 17:27:53 -08:00
Raph Levien d6cbae2a3f Fixes to get example running in wasm
A number of things were wrong:

* The args were missing to `run`
* The robust memory changes introduced uniformity errors
* `clear_buffer` is a todo for wgpu on wasm
* Some more time calls crept in
* Initializing both env_logger and console_logger fails

In addition, we conditionally opt the shaders into
`workgroupUniformLoad`, as that's available on wasm but not yet native.

Some of the things (args, uniformity errors) are important fixes. Other
things (clear_buffer, wUL being optional) are workarounds for wgpu
limitations and have TODO items to be removed when wgpu catches up.
2023-01-26 12:19:12 -08:00
Raph Levien 3b766d9969 Fix broken non-buffer_labels build 2023-01-25 06:33:38 -08:00
Raph Levien 418256ffd1 Start async wiring
Make async versions of the main library entry points, and invoke those from the with_winit example.

Right now this just prints the contents of the bump buffer before just running the fine dispatch, but it could apply conditional logic.
2023-01-24 21:09:00 -08:00
Raph Levien 17907893af Create Render struct
Separate coarse and fine stages as separate methods of Render struct.
2023-01-24 17:42:53 -08:00
Raph Levien e47c5777cc Make bind_map persistent
We'll be persisting some buffers across recordings, so make the mapping from id to actual resource scoped to the engine rather than a single `run_recording` call.

Part of the change is being explicit about which buffers to free and when. That will enable more fine-grained reuse of buffers, including within a recording.
2023-01-24 17:42:29 -08:00
Joe Neeman 338bd30870 Allow selecting GPU from env 2023-01-21 14:30:40 -06:00
Chad Brokaw 0c0c61dc82 Address review feedback
* Add counts to offsets when comparing against buffer size limits
* Remove multiplication by 4 in blend buffer allocation (we use units of u32)
* Move buffer sizes from BumpAllocators to Config
* Add comments about early exit
2023-01-18 21:36:32 -05:00
Chad Brokaw c66e7a270c
add comments for buffer sizes
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2023-01-17 22:48:53 -05:00
Chad Brokaw 1f7ba765e9
comment typo
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2023-01-17 22:48:11 -05:00
Chad Brokaw 1e8d194b6a initial GPU side work for robust memory
This should handle everything on the GPU side except for blend stack loading/storing in fine.
2023-01-17 14:08:20 -05:00
Chad Brokaw 516fd6c981 Update for peniko changes
This applies updates for the gradient API in peniko and pins the git dependency so prevent further breakage. Also removes Cargo.lock.
2023-01-17 12:31:57 -05:00
Daniel McNab 44058a8578
Improve the svg parser (#247)
* Improve the svg parser

* Handle `opacity`

* Double the segments buffer

* Rotate the multiplication

This matches firefox's output, although it is contrary to my use
of 3d transformation matrices

* Double ptcl size

Seems to be required to show entire scene at 4k
2023-01-16 18:22:35 +00:00
Daniel McNab ed60031185
Add hot reloading of shaders to the winit example (#252) 2023-01-16 17:24:48 +00:00
Daniel McNab db4fc4e449
Give buffers names when buffer_labels feature is enabled (#254) 2023-01-16 17:16:45 +00:00
Spencer C. Imbleau 4fc94a1d4b clippy fixes 2023-01-14 11:07:07 -05:00
Daniel McNab eec111c633
Support click and drag for svgs, as well as scene fragment caching (#244)
* Support caching the image, and click and drag motion

* Remove debug print

* Clean up examples to have command line parsing

* Address review comments
2023-01-13 19:30:08 +00:00
Raph Levien ed437f7ffc Rustfmt 2023-01-12 21:11:54 -08:00
Raph Levien 4907186de4 Prototype of buffer reuse
This helps performance but not all performance issues have been resolved. Nontrivial CPU goes into write_buffer, and it's also possible that there isn't enough overlapping between CPU and GPU work.
2023-01-12 20:43:58 -08:00
Chad Brokaw a9aa3f9cab
Merge pull request #242 from linebender/evenodd
Support even-odd fill rule
2023-01-11 14:13:24 -05:00
Raph Levien 3003e42acb
Merge pull request #235 from linebender/large_pathtag
Support for larger pathtags
2023-01-11 07:56:15 -08:00
Chad Brokaw c6ac5bf590 Support even-odd fill rule
Add logic for handling the even-odd fill rule to `SceneBuilder` and the coarse and fine shaders.
2023-01-10 15:22:04 -05:00
Rose Hudson c5401e777e Update winit example to use new multi-adapter API 2023-01-09 13:00:00 +00:00
Rose Hudson f0faadc356 Add multi-adapter support
some `RenderContext` stuff is now `DeviceHandle` stuff, and device
handles are created alongside surfaces to ensure compatibility, but are
reused if possible.

Fixes #224 wgpu Adapter and Surface might not be compatible
2023-01-09 13:00:00 +00:00
Chad Brokaw 3ea8eef839
Merge pull request #239 from linebender/new-encoding
Public encoding API
2023-01-08 18:41:09 -05:00
Chad Brokaw 3606184cf6 better naming 2023-01-08 18:36:14 -05:00
Chad Brokaw ec956d859b add function to render directly from an encoding 2023-01-08 18:34:22 -05:00
Chad Brokaw 520f6d0d41 Address review feedback.
* remove area clamp in fine (now in #241)
* make DrawTag::info_size() const fn
* document DrawColor rgba field
* change Monoid type parameter to an associated type and describe the additional Default constraint
* consistent parens in PathTag::is_subpath_end
* add comments for 32-bit path segment types in PathTag

* also adds low level encoding functions for the three currently supported brushes
2023-01-08 17:10:05 -05:00
Duane Johnson 3e8a4813f0
Update references to piet-gpu where it makes sense (#240) 2023-01-08 16:15:51 +00:00
Chad Brokaw dbe7f27768 Public encoding API
This exposes significantly more of the previously internal encoding guts.

This is beneficial for its own sake as there always seem to be new and interesting things that are supported by the encoding and GPU pipeline that are not directly exposed by the scene builder.

The secondary purpose is laying the groundwork for scene *de*coding and processing. This will enable us to implement various stages of the pipeline on the CPU.
2023-01-06 16:52:41 -05:00
Raph Levien d94257a7c5 Support for larger pathtags
Previously there was a limit of 256k pathtags in a scene, due to the need for multi-dispatch prefix sum for the pathtag monoid. This patch increases the limit to 64M, which ought to be enough for most applications.

It works by having 4 dispatches for the pathtag prefix sum: 2 to reduce, then 2 to scan.
2023-01-05 14:25:21 -08:00
Daniel McNab ff59839737
Move the vello crate to the workspace root (#231)
* Move the vello crate to the root of the crate

* Add warning that README is work in progress

* Add newline in warning

* Move the unlicense into the shader folder

* Fixup wgsl-analyzer include paths
2023-01-05 09:32:09 +00:00