Commit graph

103 commits

Author SHA1 Message Date
Raph Levien dc5facd198
Merge pull request #20 from linebender/sorta
A sorta-middle architecture
2020-06-13 13:40:48 -07:00
Raph Levien 65f802894c Merge branch 'master' into sorta 2020-06-13 07:30:40 -07:00
Raph Levien daa7c9dd64 Merge branch 'sort_middle' 2020-06-11 16:17:40 -07:00
Raph Levien 73df5534a1
Merge pull request #19 from linebender/sort_middle
Bring sort_middle branch to master
2020-06-11 16:16:10 -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 79cc9da811 Fancy flattening
Implement same flattening algorithm as kurbo.
2020-06-09 20:45:19 -07:00
Raph Levien eaa1d261c3 Sederberg error metric
Use proper math to compute number of subdivisions. This works but is not
very satisfying, as it over-subdivides.
2020-06-09 18:43:49 -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 3a8227d025 Non-load balanced coarse path raster
This is a bit of a revert of the load-balanced ("more parallel") coarse
path rasterizer, but includes fills and also uses atomicExchange.

I'm doing it this way because it should be considerably easier to do
flattening in this structure, even though there will be some performance
regression.
2020-06-09 15:09:53 -07:00
Raph Levien 7118c8efc1 Fix backdrop of segments to left of viewport
Make sure we account for backdrop in segments clipped out of viewport.
2020-06-09 10:25:22 -07:00
Raph Levien 6db4e20bbb More parallel backdrop propagation
This is a nice improvement but still not great on tiger.
2020-06-06 08:23:40 -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 feeaa31fd1
Merge pull request #17 from linebender/cli_args
Command line arguments
2020-06-05 09:04:55 -07:00
Raph Levien f9f5961428 Use atomicExchange over atomicCompSwap
Significant perf win (approx 2x in the path coarse rasterizer)
2020-06-05 08:24:26 -07:00
Raph Levien e5dd9ae01e More parallel path coarse raster
Use fancier load balancing algorithm for coarse rendering of paths.

Seems to work and an improvement in some cases.
2020-06-04 17:42:33 -07:00
Raph Levien 877da4a98e Faster coarse raster
Store a lot more tile context in shared memory and do the work from
that.
2020-06-04 10:39:08 -07:00
Raph Levien e1aa9b2f5d Remove bbox guard
It's probably not necessary.

This development still work in progress.
2020-06-03 20:59:19 -07:00
Raph Levien 7f4a6523a8 Filter sparse tiles
Have a more-parallel read of the tile structures based on bbox coverage,
and only set the bit when the tile isn't empty.

This is a speedup, but there is some duplicated work and it is possible
to improve it further.
2020-06-03 17:55:42 -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 ff8cee059c Optimize tile allocation
Use parallel scheme to zero out tiles.
2020-06-03 14:46:41 -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 f6ef1c16ab
Merge pull request #16 from linebender/new_merge
More parallel merging in coarse raster
2020-05-31 09:53:20 -07:00
Raph Levien c603cafc6c Merge branch 'more_svg' into new_merge 2020-05-31 09:19:34 -07:00
Raph Levien 2c185c3718 Simplify ringbuf
We don't really need a ring buffer, as we only read what we're actually
going to process.
2020-05-30 21:20:48 -07:00
Raph Levien 192ddc5eab Parallel merge
The fancy stuff :)
2020-05-30 21:11:13 -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 9c0bdd664d
Merge pull request #14 from linebender/faster_k4
Output multiple pixels per thread in k4
2020-05-29 07:54:58 -07:00
Raph Levien 3e83972606 Improve SVG parsing
WIP
2020-05-28 11:48:36 -07:00
Raph Levien 319aa703c4 Output multiple pixels per thread in k4
In kernel 4, compute a chunk of pixels rather than just one per thread.
This is a dramatic speedup.

(This commit cherry-picked from another working branch)
2020-05-28 07:54:24 -07:00
Raph Levien 37a6f6aa51
Merge pull request #13 from linebender/par_coarse
Parallelized segment output in coarse raster
2020-05-28 07:46:42 -07:00
Raph Levien e16f68d89d Fix buffer overrun
Was a little too eager zeroing out sh_is_segment[]
2020-05-26 22:47:28 -07:00
Raph Levien dbcffb10db Reinstate fills
Add fills back in.
2020-05-25 15:27:03 -07:00
Raph Levien 3d422d9243 Allocate segment chunks in slabs
Another speedup might be to special-case when the number of chunks in a
stroke or fill command is 1, then the segment header doesn't need
allocation and memory traffic is reduced. But right now we'll avoid the
complexity.
2020-05-25 12:22:29 -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 55df3e6cc8 Fix linewidth math
Coarse rasterization wasn't entirely taking line width into account.

Also fix swizzle in matrix (not yet used). And fix missing End command
in ptcl output (hasn't been a problem because buffer was cleared).
2020-05-24 09:43:41 -07:00
Raph Levien b5e96b5b87
Merge pull request #12 from linebender/fills
Make fills work in sort-middle pipeline
2020-05-23 10:26:29 -07:00
Raph Levien 7d040dff37 Bit magic for backdrop accumulation
Use bit counting rather than iterating backdrop increments one by one.
A nice if not huge speedup.
2020-05-22 07:30:32 -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 e47c355018
Merge pull request #11 from linebender/line_coverage
Smarter line segment coverage
2020-05-21 08:58:49 -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 0ed759814b Smarter line segment coverage
Compute tile coverage of segments using optimized algorithm. This
algorithm does a bit of setup, then uses an efficient formula to
compute the span per scan-line.
2020-05-19 09:26:44 -07:00
Raph Levien fe1790e724 Fix bbox bug
Bounding boxes were being calculated as way too large in the element
processing.

Also wire up counters so winit binary is happy.
2020-05-16 21:20:25 -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