Commit graph

30 commits

Author SHA1 Message Date
Chad Brokaw a6307a2520 predicate image loads on non-zero mask 2023-03-15 08:37:00 -04:00
Chad Brokaw d12b711fe1 premultiply alpha before filtering 2023-03-10 02:04:21 -05:00
Chad Brokaw a8585781cd move atlas rect to info
Atlas offset and image size were originally stored in the ptcl but are not tile dependent. Moving these to info saves 8 bytes per image tile.
2023-03-10 01:42:50 -05:00
Chad Brokaw 165b3a083b Let's add images 2023-03-09 17:18:03 -05:00
Chad Brokaw 15efb8b3f6 fixes after rebase
* remove SceneBuilder::finish() calls
* remove old Config struct
* comment about syncing structs in config.wgsl
2023-03-03 20:46:50 -05:00
Arman Uguray 3bbf108df5 Renamed clear_color to base_color; addressed review comments 2023-03-02 14:29:44 -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 f657b88018 use matrix math! 2023-02-23 01:19:04 -05:00
Chad Brokaw 659ab2ff7e simplify 2023-02-22 23:25:45 -05:00
Chad Brokaw 1f938e5f49 linear algebra refresher 2023-02-22 23:18:51 -05:00
Chad Brokaw 3c15bff867 Proper inverse of translation components 2023-02-22 23:08:38 -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
Raph Levien 27e6fdd267 Partially revert uniform load of bump.failed
Just load the atomic bump counter directly instead of piping it through a shared variable, when workgroupUniformLoad is not available. The value is in fact dynamically uniform, but that depends on the stage not setting its own failure flag, a fairly subtle invariant.

I think there was a write-after-read hazard for the reuse of sh_part_count[0]. However, doing the experiment of just changing that doesn't fix the problem on mac. It's possible there's a shader compilation problem (possibly the same one as provoking the storageBarrier workaround in tile_alloc), or also possibly a logic error I'm not understanding.

In any case, this change does appear to fix the hangs on mac.

Fixes #267
2023-01-29 09:01:13 -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
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 db7d93b85c remove unnecessary limit adjustment 2023-01-17 22:56:52 -05:00
Chad Brokaw f0587b6770 add comment about syncing BumpAllocators struct 2023-01-17 22:51:46 -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
Daniel McNab 3902e65618
Fix missing barriers in the pathtag_scans (#255)
Co-authored-by: Raph Levien <raph.levien@gmail.com>

Co-authored-by: Raph Levien <raph.levien@gmail.com>
2023-01-16 20:20:20 +00:00
Raph Levien 02d8b28439
Merge pull request #245 from linebender/reuse_buf
Prototype of buffer reuse
2023-01-13 11:18:03 -08:00
Raph Levien 5c469013c7 Fix even-odd rule
This works with winding numbers even larger than 2.
2023-01-12 21:08:51 -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
Raph Levien 080277bcd9
Merge pull request #241 from linebender/fine_fixes
Fixes to fine rasterization
2023-01-08 13:50:51 -08:00
Duane Johnson 3e8a4813f0
Update references to piet-gpu where it makes sense (#240) 2023-01-08 16:15:51 +00:00
Raph Levien 29a16eb210 Fixes to fine rasterization
The area bug was found and fixed by @dfrg, and is adapted from #239. I wanted to move it to a separate PR so that one would be more focused on API.

The other bug is currently silent because the two quantities swapped are both 4, but it is triggered when experimenting with tuning for performance.
2023-01-08 07:41:01 -08: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