Commit graph

60 commits

Author SHA1 Message Date
Raph Levien facc9e0982 Use sampler for texture images
Provide images to fine rasterization kernel as readonly textures with a
sampler, rather than storage images. That lets us use the GPU's hardware
for sampling, which should be considerably more efficient.

There are a bunch of parameters that are hardcoded, but it does seem to
work.
2020-11-25 18:05:10 -08:00
Raph Levien 047a0830d1 Towards wiring up images to k4
This patch passes a dynamically sized array of textures to the fine
rasterizer.

A bunch of the low level Vulkan stuff is done, but only enough of the
shaders and encoders to do minimal testing. We'll want to switch from
storage images to sampled images, track the actual array of textures
during encoding, use that to build the descriptor set (which will need
to be more dynamic), and of course run image elements through the
pipeline.

Progress towards #38
2020-11-24 22:11:38 -08:00
Raph Levien 6b06d249ab Builder pattern for pipelines
Use a builder pattern for pipelines and descriptor sets, so we can go
richer without hugely complicating existing code.

WIP
2020-11-24 22:11:38 -08:00
Raph Levien a60c2dd3c8 Scratch buffer for clip stack
We keep a small window of the clip stack in registers in the fine
rasterization kernel, and when that window is exceeded, spill to global
memory, so the clip stack can be unbounded.
2020-11-22 18:14:09 -08:00
Raph Levien d14895b107 Continuing work on clips
I realized there's a problem with encoding clip bboxes relative to the
current transform (see #36 for a more detailed explanation), so this is
changing it to absolute bboxes.

This more or less gets clips working. There are optimization
opportunities (all-clear and all-opaque mask tiles), and it doesn't deal
with overflow of the blend stack, but it seems to basically work.
2020-11-20 18:25:27 -08:00
Raph Levien f53d00e6bc Add transforms and state stack
Actually handle transforms in RenderCtx (was implemented in renderer but
not actually plumbed through). This also requires maintaining a state
stack, which will also be required for clipping.

This PR also starts work on encoding clipping, including tracking
bounding boxes.

WIP, none of this is tested yet.
2020-11-20 18:25:27 -08:00
Raph Levien 47e24ec9d5 Start adding support for creating images
This is still WIP, focused on creating image resources and making them
available GPU-side.

Progress toward #38
2020-11-19 16:32:29 -08:00
Raph Levien 75c4b62730 Add hub abstraction
The hub does a little better lifetime tracking of resources (so
Rust-side references can be dropped), and in the future will be used for
dynamic selection of backend.

The migration is still a bit half-baked, as there are a bunch of
Vulkan-specific types in the signatures, but it shouldn't be too much
work to sort that out. Perhaps it can wait until there is a second
backend though.

The main motivation for this is to create image objects with lifetime
tracking, one of the things required for #38.
2020-11-18 16:06:08 -08:00
Raph Levien 8e2f2aeeba Update dependencies
Update to latest versions of all dependencies. Among other things, this
gets us on piet 0.2, though almost all of the changes were around text,
which is not yet implemented.
2020-11-14 08:25:43 -08:00
Elias Naur 326f7f0d03 shader: delete more unused code and variables
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-09-13 13:03:56 +02:00
bhmerchant@gmail.com d836d21d12 Clean up bits of right edge tracking logic left over from sort-middle. 2020-08-12 19:57:14 -07:00
msiglreith 1cc5c7ac0d Shader documentation and a slight cleanup 2020-06-28 15:37:27 +02:00
msiglreith eed71721eb Update winit example 2020-06-14 23:32:59 +02:00
Raph Levien 65f802894c Merge branch 'master' into sorta 2020-06-13 07:30:40 -07:00
Raph Levien b23113461b Minor cleanups
Get rid of warnings. Do cargo update to bump deps.
2020-06-10 14:10:28 -07:00
Raph Levien b571e0d10c Continue wiring up gpu-side flattening
All segments given to path coarse raster are cubics. Flatten to
quadratics.

This works but the quality is not (yet) good.
2020-06-09 17:56:11 -07:00
Raph Levien 0f44bc8b78 Start GPU-side flattening
This starts the work on GPU-side flattening by plumbing curves through.
2020-06-09 16:01:47 -07:00
Raph Levien af0a1af8e1 Make fills work
The backdrop propagation is slow but it does work.
2020-06-05 22:40:44 -07:00
Raph Levien 63ba45c774 Fix performance issues
Use larger workgroup for tile initialization (utilization was poor).
Provide correct element count to coarse rasterizer.
2020-06-03 15:32:58 -07:00
Raph Levien 70a9c17e23 Continue building out pipeline
Plumbs the new tiling scheme to k4. This works (stroke only) but still
has some performance issues.
2020-06-03 12:21:09 -07:00
Raph Levien 294f6fd1db Experiment with new sorting scheme
Path segments are unsorted, but other elements are using the same
sort-middle approach as before.

This is a checkpoint. At this point, there are unoptimized versions
of tile init and coarse path raster, but it isn't wired up into a
working pipeline. Also observing about a 3x performance regression in
element processing, which needs to be investigated.
2020-06-03 09:29:25 -07:00
Raph Levien f3cb904f86 Add command line args for loading svg 2020-05-31 09:57:25 -07:00
Raph Levien c603cafc6c Merge branch 'more_svg' into new_merge 2020-05-31 09:19:34 -07:00
Raph Levien 121f29fef6 Merge one segment at a time
No parallelism yet, but seems to improve performance.
2020-05-30 08:51:52 -07:00
Raph Levien 894ef156e1 Change to new merge strategy in binning
WIP

We get "device lost" on NV :/
2020-05-29 20:06:16 -07:00
Raph Levien 3e83972606 Improve SVG parsing
WIP
2020-05-28 11:48:36 -07:00
Raph Levien dbcffb10db Reinstate fills
Add fills back in.
2020-05-25 15:27:03 -07:00
Raph Levien 8eaf49a04d Checkpoint parallel output
Parallel segment output seems to be working for strokes.
2020-05-25 12:14:18 -07:00
Raph Levien 24b3def0a1 Start work on parallel segment output
Output of segments is in parallel. Getting closer, some problems with
chaining but mostly correct.
2020-05-24 21:02:19 -07:00
Raph Levien a616b4d010 Rework right_edge computation in elements
Trying to fit it into the fancy monad doesn't really work, so use a
more straightforward approach to compute it from the aggregate.

Also add yEdge logic (basically copying piet-metal). With a fix to
ELEMENT_BINNING_RATIO (which I had simply gotten wrong), the example
renders almost correctly, with small bounding box artifacts.
2020-05-21 10:00:56 -07:00
Raph Levien ed4ed30708 Adding backdrop logic
Calculation of backdrops kinda works but with issues, so WIP.
2020-05-20 16:03:27 -07:00
Raph Levien 076e6d600d Progress on wiring up fills
Write the right_edge to the binning output.

More work on encoding the fill/stroke distinction and plumbing that
through the pipeline. This is a bit unsatisfying because of the code
duplication; having an extra fill/stroke bool might be better, but I
want to avoid making the structs bigger (this could be solved by
better packing in the struct encoding).

Fills are plumbed through to the last stage. Backdrop is WIP.
2020-05-20 11:14:19 -07:00
Raph Levien 03da52cff8 Start implementing fills
This should get the "right_edge" value for each segment plumbed through
to the binning phase. It also needs to be plumbed to coarse raster and
wired up there.

Also considering WIP because none of this logic has been tested yet.
2020-05-19 20:40:04 -07:00
Raph Levien 9bb06ec340 Correct rendering (on Intel)
Handle multiple passes in coarse raster. Doesn't work on NV, WIP to
find out why.
2020-05-16 06:43:31 -07:00
Raph Levien 93044b469b Fix prefix sum
First, add decoupled lookback.

Second, fix problem with monoid that was overly aggressive in resetting
the bbox.
2020-05-15 20:09:39 -07:00
Raph Levien 868b0320a4 Render strokes
As of this point, it mostly renders stroke outlines for tiger. Some
dropouts are because the scan in the elements pass doesn't do lookback
yet, others are probably a bug.
2020-05-15 17:38:17 -07:00
Raph Levien 1240da3870 Delete old-style kernels and buffers
Pave the way for the coarse raster pass to write to the ptcl buffer.
2020-05-15 15:24:37 -07:00
Raph Levien 3a6428238b Start writing tiles
This is the first checkpoint where it actually runs a pipeline end to
end, though it's far from accurate.
2020-05-15 14:31:52 -07:00
Raph Levien cc89d0e285 Starting coarse rasterizer
Working down the pipeline.

WIP
2020-05-13 21:39:47 -07:00
Raph Levien 343e4c3075 Binning stage
Adds a binning stage. This is a first draft, and a number of loose ends
exist.
2020-05-12 17:34:15 -07:00
Raph Levien 736f883f66 Store annotated elements
Apply transform to paths and annotate with computed linewidth and
bounding box information, storing the result.
2020-05-12 12:13:39 -07:00
Raph Levien 9a8854ffab Experimenting with sort-middle
Starting a prototype that explores the sort-middle approach. This
commit has a prefix sum pass computing state per element.
2020-05-12 08:54:09 -07:00
Raph Levien 8d01aba237 Update to piet 0.13
Get rid of kurbo patch, as we now use kurbo through piet. Also clean up
some warnings.
2020-05-12 08:26:48 -07:00
msiglreith e2ed54361d Fix rebase issues and split into library and cli/winit binaries 2020-05-04 17:05:54 +02:00
msiglreith b38e43f0c2 Initial work for surface support
surface: handle extensions

Implement swapchain creation and blit image to screen
2020-05-04 16:24:42 +02:00
Raph Levien dcdd35e0b8 Implement solid color cmd
Avoids empty fill segment list, which was a minor bug.

Also increase tolerance to 0.25 to juice performance.
2020-05-02 10:53:16 -07:00
Raph Levien aa83d782ed Fills
Adds fills, and has more or less working tiger render (with artifacts).
2020-05-01 19:42:20 -07:00
Raph Levien 19ecd0a158
Merge pull request #3 from linebender/chunk_segments
Use linked list strategy for segments
2020-04-30 21:40:04 -07:00
Raph Levien aa8b71e922 Reset query pool before use
Quiets validation errors now that we can see them :)
2020-04-29 18:18:04 -07:00
Raph Levien b23fe25177 Use linked list strategy for segments
Trying to allocate them contiguously wasn't good.
2020-04-28 22:25:57 -07:00