Commit graph

678 commits

Author SHA1 Message Date
Raph Levien a7dbeb3b9b
Merge pull request #220 from linebender/raph-browser
Full pipeline running in browser
2022-12-08 10:27:37 -08:00
Chad Brokaw 4b1f9d1921 remove timer 2022-12-08 12:45:45 -05:00
Chad Brokaw 4ea379aaa7 address feedback 2022-12-08 12:43:09 -05:00
Chad Brokaw e5081b51e4 remove unnecessary deps 2022-12-08 12:12:35 -05:00
Chad Brokaw c6b319aca0 fmt 2022-12-08 11:58:09 -05:00
Chad Brokaw 6bd644f7cc
Merge branch 'main' into raph-browser 2022-12-08 11:56:58 -05:00
Chad Brokaw 942817755c replace let with const on web 2022-12-08 11:53:35 -05:00
Raph Levien 12fdae8714
Merge pull request #223 from linebender/fix_222
Increase sizes of binning buffers
2022-12-05 13:46:22 -08:00
Raph Levien e2469fbcaa Increase sizes of binning buffers
Increase the size of the bin header and path buffers to accommodate the actual extents accessed by the shaders.

Also add a missing workgroup barrier, not essential to fixing this bug but found while auditing the code.

Fixes #222
2022-12-05 13:26:16 -08:00
Raph Levien 375f71b46d cargo fmt 2022-11-29 19:51:43 -08:00
Raph Levien 28816a027e Disable timing debug out
Time is not supported in the browser
2022-11-29 19:49:21 -08:00
Raph Levien c4274c7153 Tweak canvas aspect ratio 2022-11-29 19:42:52 -08:00
Raph Levien 340ac1d69c Hacky attempt to get running in browser 2022-11-29 19:36:05 -08:00
Raph Levien 571822248c
Merge pull request #219 from linebender/squeeze
Reduce resource requirements of shaders
2022-11-29 19:02:15 -08:00
Raph Levien 876a3ad581 Combine info and bin_data buffers
We need to reduce the number of buffer bindings to 8 so it can run on
all WebGPU devices. The best candidate was to combine info and bin_data,
which are written by two different stages (draw_leaf and binning,
respectively), both read by coarse, and are unstructured, so the only
real shader change needed is to add the offset for the binning data.

I thought I was going to have to do a blit to make it fit, but
fortunately that wasn't needed.

Progress to #202
2022-11-29 17:39:22 -08:00
Raph Levien e8f8ebbd14 Squeeze pipeline to fit
This commit reduces the workgroup shared memory of binning to fit in
16k (by packing two u16's in a u32), and moves the config binding to
uniform, from readonly storage.

Progress toward #202
2022-11-29 17:23:12 -08:00
Chad Brokaw 2bd75ac86f
Merge pull request #218 from dfrg/blend-group-alpha
Add blend group alpha and sync clip data in clip_leaf
2022-11-29 14:55:44 -05:00
Chad Brokaw d13ec497e2 Address review feedback.
* add comment for ClipInp::path_ix
* update comment for SceneBuilder drawtags
* remove copy of blend data through info buffer. Instead, update EndClip's DrawMonoid::scene_offset to point to the same scene data of the associated EndClip.
2022-11-29 14:52:03 -05:00
Chad Brokaw 28082af9ec clip changes/blend group alpha
Adds blend group alpha. Also changes the clip logic to sync blend mode and alpha from BeginClip to EndClip in clip_leaf.
2022-11-29 13:28:25 -05:00
Chad Brokaw 99199195bf
Merge pull request #217 from dfrg/info-gradients
Read gradient data from info buffer in fine
2022-11-29 13:26:02 -05:00
Chad Brokaw 6d8428e377 fix and offset bug and remove comment 2022-11-28 18:29:57 -05:00
Chad Brokaw c8ed14ae67 read gradient data from info buf 2022-11-28 18:20:29 -05:00
Chad Brokaw ab3ef4381d
Merge pull request #215 from dfrg/small-fixes
Hodgepodge of small fixes
2022-11-28 14:12:22 -05:00
Chad Brokaw 923765aff9 Address review feedback
* Add comment about avoiding NaNs to inverse alpha divisions
* Change inverse alpha computations to use max(a, epsilon) rather than +
* Emit alpha component in blit fragment shader (enables support for partially transparent windows)
2022-11-28 14:07:26 -05:00
Chad Brokaw 4fea305883 Hodgepodge of small fixes
This just a collection of minor fixes to various things I noticed while looking over the code.

Adds a `Device::poll` call to the winit example.
Removes some lingering unnecessary `<f32>`s in the blit shaders.
Removes a duplicated bbox entry in the shared shader inclusion code and collapses nested `concat!`s.

Finally, it reintroduces the computation of separated alpha in the output of fine which I removed in a previous PR. This allows the `render_to_texture` mode to be useful for generating images that can be properly blended over other content. The blit shader has been changed to accommodate this.
2022-11-28 00:03:02 -05:00
Daniel McNab c689767782
Remove the old pipeline (#209)
Remove the old hal and pipeline. 

Update the README to reflect this
2022-11-27 16:02:16 +00:00
Raph Levien 1f9a4d5322
Merge pull request #214 from linebender/stroke_bbox
Fix rendering artifacts with strokes
2022-11-26 20:10:29 -05:00
Raph Levien 2338e3bedd Fix style nit 2022-11-26 17:07:23 -08:00
Raph Levien 3c0752f6ae Fix rendering artifacts with strokes
A number of things weren't being computed correctly for strokes,
including bounding boxes and also incorrectly applying y_edge logic
(which is only correct for fills).
2022-11-26 16:51:22 -08:00
Chad Brokaw cf9b5c5805
Merge pull request #213 from dfrg/libize
Libify piet-wgsl
2022-11-26 16:07:48 -05:00
Chad Brokaw 9ad7f7270e revert rename of SceneBuilder ctors 2022-11-26 16:00:34 -05:00
Chad Brokaw 36fa836735 include shaders in source 2022-11-26 15:51:07 -05:00
Chad Brokaw a4441007c4 make use of Result type in RenderContext 2022-11-26 14:56:43 -05:00
Chad Brokaw 3174e284f2 remove double && 2022-11-26 14:53:51 -05:00
Chad Brokaw 207ab45f16 format 2022-11-26 14:41:30 -05:00
Chad Brokaw 37a9763748 fix longstanding annoying in SceneBuilder ctor
SceneBuilder::new() now takes &mut Scene or &mut SceneFragment
2022-11-26 14:38:26 -05:00
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 30af6704ed
Merge pull request #212 from dfrg/wgpu-realtime
Make the WGSL port interactive
2022-11-25 21:03:26 -05:00
Chad Brokaw ff4f71ef3c wgsl port in realtime
* 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
2022-11-25 17:16:56 -05:00
Raph Levien fddd019567
Merge pull request #211 from linebender/cleanup_vec
Clean up unneeded type annotations in vec
2022-11-25 13:05:17 -05:00
Raph Levien 09aa38799d More cleanup
Missed a few cases (and I'm still not 100% sure I've got them all).
2022-11-25 09:51:11 -08:00
Raph Levien 94a310a245 Clean up unneded type annotations in vec
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.
2022-11-25 09:37:11 -08:00
Daniel McNab 7d5063b187
Remove all wgsl-analyzer errors (#210)
* Fix missing import

* Format
2022-11-25 16:43:21 +00: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
Daniel McNab 0755e8bfaa Allow arbitrary output sizes (#206)
* Support basic resizing

* Fix resizing
2022-11-23 19:32:30 +00: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 98e0499b31
Merge pull request #207 from linebender/fix_query_pools
Don't reset query pool twice
2022-11-22 11:50:44 -05:00