Commit graph

602 commits

Author SHA1 Message Date
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
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
Elias Naur 18c0da02e5
Clarify licensing for WGSL shaders (#205)
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.
2022-11-19 16:45:42 +00:00
Chad Brokaw de998220db
Merge pull request #203 from linebender/clip_checkpoint
Extend pipeline
2022-11-18 17:28:59 -05:00
Chad Brokaw adc9811776 add clips and blends 2022-11-18 17:26:26 -05:00
Chad Brokaw 9adeaf3e82 format 2022-11-16 12:02:11 -05:00
Chad Brokaw 20f7b68514 finish gradient support 2022-11-16 10:49:38 -05:00
Raph Levien ef3ed3c9d7 Checkpoint of clip and gradient work
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.
2022-11-10 19:48:36 -08:00
Raph Levien 5bd3a3639f Fix precedence issue
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.
2022-11-08 19:30:47 -08:00
Chad Brokaw c5dbf7612c
Merge pull request #200 from dfrg/pathfix
More robust path encoding
2022-11-08 11:33:47 -05: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
Raph Levien 494f523c41 Tiger!
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.
2022-11-04 21:41:37 -07:00
Raph Levien 17a74fb370 Almost rendering tiger
We cut'n'pasted the picosvg stuff, kinda ugly.

It renders a number of paths of the tiger. I think the gap might be in prefix sums.
2022-11-04 13:15:05 -07:00
Raph Levien 7ae5aa7491 Mostly working strokes
The fat line in coarse path rendering is not done, but when lines are thin that mostly looks ok. Onward to tiger!
2022-11-04 12:40:54 -07:00
Raph Levien 92d6b1188f Fix color
Get rgba order right in rendering, plus generate separated alpha for png. The latter is just for debugging, we won't generally use separated alpha.
2022-11-04 09:25:06 -07:00
Raph Levien c3d81e0985 Mostly working path rendering
It draws multiple paths and applies affine transformations.

One problem: RGBA writing is byte-reversed and premultiplied.
2022-11-04 08:59:23 -07:00
Raph Levien 06fa3cb9ab Checkpoint
Felt like checkpointing what I have before trying to run the pipeline. Theoretically everything should work.
2022-11-03 19:37:38 -07:00
Raph Levien 5851ef1417 Shaders loaded
This checkpoint loads the shaders for full rendering, but there's a bunch of stuff still needing to be done.
2022-11-03 16:53:34 -07:00
Raph Levien 7ac327c684 Unify scene buffer
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.
2022-11-02 18:07:32 -07:00
Raph Levien 5c6ec1efa3 Checkpoint
Many shader stages written.
2022-11-01 16:20:15 -07:00
Raph Levien 40416fd2ea Another checkpoint 2022-11-01 13:55:58 -07:00
Raph Levien 06ec395b68 Checkpoint coarse rasterization
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.
2022-11-01 13:55:58 -07:00
Raph Levien b6da6d958b Write more shaders
This is super WIP, but represents partially written shaders for more of
the piet-gpu pipeline. Checkpointing as other work is incoming.
2022-11-01 13:55:58 -07:00
Daniel McNab 1b84071d33
WGSL: Allow imports anywhere (#196)
This means we support imports not at the start of a line.
2022-11-01 20:41:47 +00:00
Daniel McNab 3831b58dea Prepare for wgsl-analyzer upgrades (#195)
* Prepare for wgsl-analyzer upgrades

* Fix the exponentials
2022-10-27 10:48:34 -07:00