Commit graph

872 commits

Author SHA1 Message Date
Raph Levien
a3d3f39fbd Wait on query results
This shouldn't be necessary, but was causing NOT_READY errors.
2021-10-19 17:26:45 -07:00
Raph Levien
6039916631 Wait on in-flight command buffers on exit
If there is a command buffer in flight on exit from the winit app, wait
on it so that the resources get destroyed cleanly.

There may be a more aggressive strategy to quick-exit, but this is
probably the most reliable approach and I see it in other code bases.
2021-10-19 17:25:08 -07:00
Raph Levien
f73da22a69 Clean up command buffers
This patch deallocates command buffers after command submission completes (the same time as other resources are released).

It should be portable and robust on all back-ends, but not necessarily the most efficient. But reuse of command buffers, as well as more efficient allocation on Vulkan and DX12, are for followup work.
2021-10-19 17:17:41 -07:00
Raph Levien
cbebb56981
Merge pull request #112 from linebender/anim
Render COLRv0 emoji; animate
2021-10-19 15:31:04 -07:00
Raph Levien
056446c23d Cargo fmt 2021-09-06 10:19:55 -07:00
Raph Levien
4b2a720289 Animating scene
Make the scene dependent on timing.

This commit patches the HAL to reuse command buffers; this works well on
Vulkan and prevents a leak, but breaks the other back-ends. That will
require a solution, possibly including plumbing up the resource lifetime
responsibilities to the client.

Other things might be hacky as well.
2021-09-06 10:18:14 -07:00
Raph Levien
dadb95aba1
Merge pull request #110 from linebender/canvas_size
Make canvas size dynamic
2021-09-06 10:02:52 -07:00
Raph Levien
ef5ef2745c Render color emoji layers
A bit hacky still, but does render color in Segoe color emoji.
2021-08-27 08:25:05 -07:00
Raph Levien
02ee369428 Start work on emoji
WIP
2021-08-20 12:20:27 -07:00
Elias Naur
039cfcf0de piet-gpu/shader: treat memoryBarrierBuffer as a control barrier
memoryBarrierBuffer is mapped to the threadgroup_barrier function in
Metal, which is a control barrier that must be executed by all threads
(or none). This change establishes that property for the two memory
barriers we have.

While here, remove ENABLE_IMAGE_INDICES completely; it was disabled in
an earlier change.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-20 20:41:35 +02:00
Raph Levien
9cab8b8131 Switch to swash
Use swash instead of ttf-parser.

We can definitely do higher-level use of the swash crate, but this
leaves the integration pretty much as-is.
2021-08-18 12:11:06 -07:00
Raph Levien
660d7b8e91 Make canvas size dynamic
Instead of hard-coding the canvas size, pass it in on renderer creation.

It's still fixed on desktop, but on Android it gets the size from the
window.
2021-08-17 08:34:23 -07:00
Raph Levien
698a1546d2
Merge pull request #109 from linebender/gradient
Basic implementation of gradients
2021-08-17 08:33:52 -07:00
Raph Levien
59728868de Merge branch 'master' into gradient 2021-08-16 10:53:19 -07:00
Raph Levien
c08e6c300d Small cleanup
Fix winit and android targets.
2021-08-11 13:10:37 -07:00
Raph Levien
05e81acebc Basically get gradients working
Separate out render context upload from renderer creation. Upload ramps
to GPU buffer. Encode gradients to scene description. Fix a number of
bugs in uploading and processing.

This renders gradients in a test image, but has some shortcomings. For
one, staging buffers need to be applied for a couple things (they're
just host mapped for now). Also, the interaction between sRGB and
premultiplied alpha isn't quite right. The size of the gradient ramp
buffer is fixed and should be dynamic.

And of course there's always more optimization to be done, including
making the upload of gradient ramps more incremental, and probably
hashing of the stops instead of the processed ramps.
2021-08-09 16:16:46 -07:00
Raph Levien
3af033f71f
Merge pull request #108 from linebender/path_hang2
Retain subdivision results
2021-07-19 10:22:55 -07:00
Raph Levien
62df7c0bd5 Remove leftover debug stuff
In response to review by Elias.
2021-07-19 08:39:44 -07:00
Raph Levien
29a8975a9a Retain subdivision results
Don't recompute the parameters from quadratic subdivision, but rather
retain them across the two phases (summing the subdivision estimate, and
generating the subdivisions). The motivation for this is that the values
were subtly different (differing by 1 or 2 least signficant bits) across
the two phases. It *might* also be faster depending on ALU/memory
relative performance.

Fixes #107
2021-07-15 11:18:48 -07:00
Tatsuyuki Ishi
bc7b2106b0
Merge pull request #77 from ishitatsuyuki/blend-scratch
Remove manual blend stack spilling and rely on scratch memory instead
2021-07-13 09:49:34 +09:00
Raph Levien
6f707c4c62 Start work on gradients
WIP. Most of the GPU-side work should be done (though it's not tested
end-to-end and it's certainly possible I missed something), but still
needs work on encoding side.
2021-07-12 06:56:52 -07:00
Raph Levien
a542833646
Merge pull request #105 from DJMcNab/linguist-highlighting
Linguist highlighting
2021-07-11 18:53:33 -07:00
Daniel McNab
98862ab1c7
Fix name of folder 2021-07-11 18:11:35 +01:00
Daniel McNab
0095a38556
Highlight shaders as glsl 2021-07-11 18:11:12 +01:00
Tatsuyuki Ishi
1e5dcebecd
Merge pull request #104 from ishitatsuyuki/winit-clap 2021-06-26 11:53:40 +09:00
Ishi Tatsuyuki
afe72804e1 Add command line parameters to winit
So that I don't need to modify lib.rs every time I want to benchmark...
2021-06-26 11:42:33 +09:00
Ishi Tatsuyuki
7a2dc37d36 Remove manual blend stack spilling and rely on scratch memory instead
v2: Add a panic when the nested blend depth exceeds the limit.
v3: Rebase and partially remove code introduced in 22507de.
2021-06-25 17:13:01 +09:00
Raph Levien
379fb1caaa
Merge pull request #89 from linebender/text
Start text rendering
2021-06-23 07:56:24 -07:00
Tatsuyuki Ishi
090c99e277
Merge pull request #99 from ishitatsuyuki/bd 2021-06-12 15:29:34 +09:00
Ishi Tatsuyuki
e610c71f13 Adjust metal workgroup limits 2021-06-12 15:28:30 +09:00
Ishi Tatsuyuki
d77dfb8c00 Runtime querying of threadgroup size 2021-06-08 16:29:40 +09:00
Ishi Tatsuyuki
c2772ceac7 Boost backdrop parallelism for the prefix sums 2021-06-08 15:09:32 +09:00
Raph Levien
8b65942f65
Merge pull request #103 from linebender/dx12_fixes
Fix some dx12 bugs
2021-06-01 15:24:54 -07:00
Raph Levien
074fafad1e Turn off reuse of command buffers for now
It worked ok on Vulkan but is causing problems on DX12 and Metal. Punt
for now and come back to this later when we do more sophisticated
resource management.
2021-05-31 21:09:15 -07:00
Raph Levien
87a84eb490 Fix some dx12 bugs
Missing a potential barrier, and had src and dst switched on blit.
2021-05-31 20:39:38 -07:00
Raph Levien
e2b14ea4be
Merge pull request #102 from linebender/api_reorg
API reorg
2021-05-31 20:37:50 -07:00
Raph Levien
431486a766 Merge branch 'master' into api_reorg 2021-05-31 06:46:18 -07:00
Raph Levien
ccbfdeb810
Merge pull request #101 from linebender/metal
[metal] Wire up swapchain presentation
2021-05-31 06:44:16 -07:00
Raph Levien
bae185efbd API reorg
Move types into the toplevel and hide implementation details. Remove
deref of hub CmdBuf to mux. Restrict public visibility of internals.

Most items have some docs, though improvements are still possible. In
particular, there should be detailed safety info.
2021-05-29 21:11:02 -07:00
Raph Levien
0c35b74699 Wire up swapchain presentation
This gets a swapchain displayed and fills out a number of the image
related parts of the API: image creation, binding to descriptor sets,
and blitting.
2021-05-28 21:41:04 -07:00
Raph Levien
84a834ee88
Merge pull request #100 from linebender/cleanup
API changes and cleanup
2021-05-28 21:40:47 -07:00
Raph Levien
7d7c86c44b API changes and cleanup
Add workgroup size to dispatch call (needed by metal). Change all fence
references to mutable for consistency.

Move backend traits to a separate file (move them out of the toplevel
namespace in preparation for the hub types going there, to make the
public API nicer).

Add a method and macro for automatically choosing shader code, and
change collatz example to generate all 3 kinds on build.
2021-05-28 16:14:39 -07:00
Raph Levien
641891b01f
Merge pull request #93 from linebender/metal
Metal back-end
2021-05-28 16:07:33 -07:00
Raph Levien
af4b568589 Merge branch 'master' into metal 2021-05-28 14:47:05 -07:00
Raph Levien
126bea0486
Merge pull request #98 from linebender/dx12
More work on DX12 backend
2021-05-28 14:04:52 -07:00
Raph Levien
5481621184 First light on running a compute shader
A bunch of loose ends remain, including needing to plumb the size of the
workgroup through. Image and swapchains also need to be added. But it
does run collatz.

Progress towards #95.
2021-05-28 14:03:44 -07:00
Raph Levien
c2965254db Merge branch 'dx12' into metal 2021-05-27 16:12:21 -07:00
Raph Levien
b4ba6886d8 Tweak wait_and_reset mutable fence signature
A reference to a slice of mutable references is not a thing.
2021-05-27 16:10:14 -07:00
Raph Levien
84dabcf049 Merge branch 'dx12' into metal 2021-05-27 16:02:12 -07:00
Raph Levien
b6292c644f Make fences mutable
Change the interface for fences to accept mutable references. This will
actualy help the Metal backend more than dx12 (avoiding interior
mutability) but more accurately captures intent and matches gfx-hal.
2021-05-27 15:53:12 -07:00