Commit graph

418 commits

Author SHA1 Message Date
Raph Levien ecdd7fd817
Merge pull request #132 from linebender/dx12_desc
Better DX12 descriptor management
2021-11-23 07:34:31 -08:00
Raph Levien 0762cc763c Implement clear_buffers on Metal
Since clearing functionality is not built-in, use a compute shader.

Simplify tests greatly; they don't need the workaround.
2021-11-20 22:24:52 -08:00
Raph Levien 657f219ce8 Better DX12 descriptor management
Reduce allocation of descriptor heaps. This change also enables clearing
of buffers, as the handles are needed at command dispatch time.

Also updates the tests to use clear_buffers on DX12. Looking forward to
being able to get rid of the compute shader workaround on Metal.

This is a followup on #125, and progress toward #95
2021-11-20 16:36:43 -08:00
Raph Levien 95d356c08f
Merge pull request #128 from linebender/prefix_war
Fix write-after-read in prefix test
2021-11-16 08:10:20 -08:00
Raph Levien 80b6150bd7
Merge pull request #129 from nilsmartel/patch-1
Use proper hyperlink in README
2021-11-15 07:16:23 -08:00
Nils Martel 96f39af14b
Use proper hyperlink in README 2021-11-15 11:25:17 +01:00
Raph Levien 8015eb25a1 Also fix write-after-read in elements.com
On further testing, this resolves a hard lockup on Intel 630 on the
mmark stress test, so is worth getting into the repo.
2021-11-14 08:23:37 -08:00
Raph Levien 69b6632085 Fix write-after-read in prefix test
Thanks to Jeff Bolz for spotting the write-after-read hazard on the
sh_flag accesses. This fixes observed failures on Nvidia Turing and
Ampere on DX12.
2021-11-14 07:13:15 -08:00
Raph Levien 76a6f1fec8
Merge pull request #127 from linebender/atomic
Increase testing of atomics
2021-11-14 07:10:39 -08:00
Raph Levien f32f2d7f95 Add linked list DXIL
Not sure why it wasn't in the previous commit.
2021-11-12 16:01:27 -08:00
Raph Levien d66f67fa09 Actually add README 2021-11-12 15:27:47 -08:00
Raph Levien 4c42da2d46
Merge pull request #126 from linebender/dx12
Improve DX12 portability
2021-11-12 15:24:24 -08:00
Raph Levien 27bedd9ef1 Add README
Also verify linked list results.
2021-11-12 15:23:31 -08:00
Raph Levien c6965de557 Add linked list test
Measure bandwidth of building linked lists with atomics.
2021-11-12 10:23:31 -08:00
Raph Levien 10a624ee75 Add message passing litmus test
This is our version of the standard message passing litmus test for
atomics. It does a bunch in parallel and permutes the reads and writes
extensively, so it's been more sensitive than existing tests.
2021-11-11 16:17:04 -08:00
Raph Levien 825a1eb04c Add atomic versions of prefix
This adds both regular and Vulkan memory model atomic versions of the
prefix sum test, compiled by #ifdef. The build chain is getting messy,
but I think it's important to test this stuff.
2021-11-11 15:26:47 -08:00
Raph Levien 3f1bbe4af1 Commit DXIL to repo
We're following the policy of committing all translated shaders to the
git repo rather than rebuilding at runtime. Here are the new DXIL ones.
2021-11-11 13:05:22 -08:00
Raph Levien f9d0aa078b Use DXIL shader compilation
Integrate DXC for translating HLSL for use in DX12. This will work
around FXC limitations and unlock the use of more advanced HLSL features
such as subgroups.

This hardcodes the use of DXIL, but it could be adapted (with a bit of
effort) to choose between DXIL and HLSL at runtime.
2021-11-11 12:55:10 -08:00
Raph Levien 7a021793ee Configure number of iterations 2021-11-11 07:26:32 -08:00
Raph Levien a0648a2153 Portability fixes
The MSL translation of the prefix example had its bindings permuted; a
flag prevents this (but, as is typical for shader translation,
potentially creates other problems).

Also use explicit unsigned literal to avoid DXC warnings.
2021-11-11 07:08:39 -08:00
Raph Levien fbfd4ee81b Add workaround for buffer clearing
Add a clear stage and associated tests, and also use it on non-Vulkan
backends to clear the state buffer.

While that's a workaround and will go away when we implement the actual
clear command, it's also a nice demo of how the new "stage" structure
composes.
2021-11-10 17:36:54 -08:00
Raph Levien 94949a6906 Mac port of bind layout rework
This gets it working on mac. Also delete old implementation.

There's also an update to winit 0.25 in here, because it was easier to
roll forward than fix inconsistent Cargo.lock. At some point, we should
systematically update all deps.
2021-11-10 13:40:16 -08:00
Raph Levien 74f2b4fd1c Rework bind layout
Use an array of bindtypes rather than the previous situation, which was
a choice of buffer counts, or a heavier builder pattern.

The main thing this unlocks is distinguishing between readonly and
read/write buffers, which is important for DX12.

This is WIP, the Metal part hasn't been done, and the old stuff not
deleted.

Part of #125
2021-11-10 11:25:16 -08:00
Raph Levien 19fedf36db
Merge pull request #123 from linebender/tests
Start testing framework, with prefix sum
2021-11-10 11:10:45 -08:00
Raph Levien 5a389b27c9
Merge pull request #124 from linebender/enable_vkmm
Actually turn on memory model
2021-11-09 14:42:50 -08:00
Raph Levien bd39d26bce Improve collection and reporting of test results
Have a structured way of gathering test results, rather than the
existing ad hoc approach of just printing stuff.

The details are still pretty primitive, but there's room to grow.
2021-11-09 14:40:53 -08:00
Raph Levien 0a9dd3a386 Actually turn on memory model 2021-11-07 17:03:11 -08:00
Raph Levien 3c7943fa8c
Merge pull request #122 from linebender/ash_0.33
Upgrade to Ash 0.33
2021-11-07 17:02:44 -08:00
Raph Levien 3820e4b2f4 Add missing file
Also add finish_timestamps call, which is needed for DX12 (there are
other issues but this is an easy fix for that one).
2021-11-06 21:46:01 -07:00
Raph Levien b36ca7fc2e Add generated shaders 2021-11-06 16:25:56 -07:00
Raph Levien 4ed339d434 Add tree reduction prefix sum test
Do a tree reduction in addition to the existing decoupled look-back, to
explore the tradeoff between performance and compatibility.
2021-11-06 16:19:26 -07:00
Raph Levien 33d7b25a92 Start testing framework
This adds a prefix sum test. This patch is also trying to get a little
more serious about structuring both the test runner (toward the goal of
collecting proper statistics) and pipeline stages for the tests.

Still WIP but giving good results.
2021-11-06 11:24:34 -07:00
Raph Levien d04ae44618 Upgrade to Ash 0.33
This was motivated by experiments with the Vulkan memory model. To use
that, we actually need to explicitly enable the relevant feature on
device creation time. That's a lot easier to do now that push_next works
on the structs in that chain. This PR doesn't do that though, it only
upgrades the dependency and cleans up deprecations.
2021-11-05 14:01:50 -07:00
Raph Levien b0b0f33c3c
Merge pull request #120 from linebender/element_barrier
Add memory barrier to elements shader
2021-11-05 13:38:13 -07:00
Raph Levien 95aad3e6c7 Put memory barrier reliably before flag write 2021-11-02 13:02:12 -07:00
Raph Levien e50d5c1f58 Add memory barrier to elements shader
The flag read needs acquire semantics. There are a number of ways that
could be expressed, but a generally portable way is to have a barrier
after. However, in the translation to Metal, that barrier needs to be in
uniform control flow. This patch does some workarounds to ensure that.
2021-11-02 12:50:11 -07:00
Raph Levien c648038967
Merge pull request #117 from linebender/cleanup
Reuse command buffers
2021-10-27 07:23:29 -07:00
Raph Levien ad4be401fc
Merge pull request #118 from rosehuds/rose/max-image-count
Vulkan: account for no limit on image count
2021-10-27 07:23:13 -07:00
Rose Hudson 1bdd2a7c86 Vulkan: account for no limit on image count
when clamping image count within device bounds, some devices can report
max_image_count = 0 to indicate no limit on image count. this triggers
assertion in clamp because max < min.

therefore if the device reports zero we treat it as `u32::MAX`

see https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkSurfaceCapabilitiesKHR.html
2021-10-27 10:45:28 +01:00
Raph Levien 59e850a7b1 Reuse command buffers
Reuse submitted command buffers rather than continually allocating them.

This patch also improves the story across the different backends. On
DX12 it was reusing allocators without resetting them, which could be a
leak. And on Metal the reset "fails," so there's always a new alloc.
2021-10-23 09:21:19 -07:00
Raph Levien b423e6c25d Warning cleanup
This patch gets rid of warnings and runs cargo fmt.

A lot of the warnings were unused items (especially in DX12 land). At
some point we might want to bring some of that back, at which point it
might be useful to refer to what was deleted in this commit.
2021-10-23 09:21:19 -07:00
Raph Levien 086e547aef
Merge pull request #115 from linebender/double_buffer
Double-buffer scene buffer
2021-10-23 09:20:03 -07:00
Raph Levien 5c699e6ac3
Merge pull request #114 from linebender/scale_ctx
Coarser grain ScaleContext
2021-10-23 09:18:00 -07:00
Raph Levien 7adb300671 Double-buffer scene buffer
Pipeline the CPU and GPU work so that two frames can be in flight at
once.

This dramatically improves the performance especially on Android. Note
that I've also changed the default configuration to be 3 frames in
flight and FIFO mode.
2021-10-21 14:28:27 -07:00
Raph Levien 529e5cce5e Coarser grain ScaleContext
This patch sets up a ScaleContext for the duration of a draw_text call,
where it was previously per-glyph.
2021-10-21 12:10:57 -07:00
Raph Levien 8b4a6c54cd
Merge pull request #113 from linebender/cleanup_cmdbuf2
Clean up command buffers
2021-10-21 12:04:29 -07:00
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