Commit graph

45 commits

Author SHA1 Message Date
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 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 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 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 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
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 06cad48dca Start output stage in coarse pass
Still very much WIP but it's progress.
2020-05-14 17:27:18 -07:00
Raph Levien cc89d0e285 Starting coarse rasterizer
Working down the pipeline.

WIP
2020-05-13 21:39:47 -07:00
Raph Levien 9a0b17ff5b Use different output strategy for binning
Iterate over bin bounding box.

Seems to work, and is a dramatic improvement.
2020-05-12 21:43:29 -07:00
Raph Levien 64daf843b0 Better output allocation in binning 2020-05-12 20:35:40 -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
msiglreith abd238bff3 Address review comments 2020-05-05 18:13:07 +02: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 1797914ac8 Fix artifacts
We were overwriting `end` when clipping, then reusing it when reading
the path, for continuity.
2020-05-02 16:20:04 -07: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 9539d8871f Clear item ref on empty segments 2020-05-01 09:13:16 -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
Raph Levien cb06b1bc3d Implement stroked polylines
This version seems to work but the allocation of segments has low
utilization. Probably best to allocate in chunks rather than try to
make them contiguous.
2020-04-28 18:45:59 -07:00
Raph Levien 55e35dd879 Dynamic allocation of intermediate buffers
When the initial allocation is exceeded, do an atomic bump allocation.
This is done for both tilegroup instances and per tile command lists.
2020-04-25 10:45:47 -07:00
Raph Levien e1c0e448ef Encode stroke in scene
This just adds the first step of polyline stroking, which is adding it
to the scene. Also just a bit of cleaning up of dimensions into one
header file.
2020-04-25 08:24:46 -07:00
Raph Levien 8d51ccbc74 Add draft kernel 4
Render from ptcl rather than original scene.
2020-04-21 19:30:14 -07:00
Raph Levien 6976f877e0 Add first draft of kernel 3
A fairly simple approach, but it adds the translation (not tested yet
in scene encoding) and does bounding box culling.
2020-04-21 18:49:50 -07:00
Raph Levien 2ed89dd65e First draft of kernel 1
Output of kernel 1 is validated by simple inspection, next step is to
wire it up properly.
2020-04-20 18:07:18 -07:00
Raph Levien 957f710b91 Render random circles
Poor performance but it renders something.
2020-04-17 21:18:39 -07:00
Raph Levien 3c35899a2f Render circles
WIP
2020-04-17 16:01:37 -07:00
Raph Levien 228bfc88cd Add scene types
This patch adds a module that contains both scene and ptcl types (very
lightly adapted from piet-metal), as well as infrastructure for encoding
Rust-side.

WIP, it's not wired up in either the shader or on the Rust side.
2020-04-16 18:19:58 -07:00
Raph Levien 86e52a3f47 Start image rendering
Populates the piet-gpu subdir, with an extremely simple renderer. The
main program saves the image to a PNG.

Contains a few fixes (I was confused about the need for multiple
bindings, as opposed to multiple descriptors within a binding).
2020-04-16 14:04:40 -07:00