Commit Graph

3314 Commits

Author SHA1 Message Date
Philip Rebohle dadace33b1 vkd3d: Fix potential hang in d3d12_command_queue_Release.
This can happen if the fence thread starts with a delay and
the queue gets destroyed shortly after being created.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-16 21:42:39 +01:00
Hans-Kristian Arntzen 34a09967d5 vkd3d: Prefer compute queues for TRANSFER.
TRANSFER + CONCURRENT is generally death for compression.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-16 21:41:37 +01:00
Hans-Kristian Arntzen 95fe4b61a6 vkd3d: Do not drop pending signals when signaling fence on CPU.
There isn't much of a reason why we should have to do this. The original
implementation was more of a hack if anything.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-16 21:41:37 +01:00
Hans-Kristian Arntzen e7672c3233 vkd3d: Refactor where max pending timeline value is computed.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-16 21:41:37 +01:00
Hans-Kristian Arntzen dbdbf94083 vkd3d: Ensure that virtual timeline values are updated in-order.
Increment physical value one by one, find the exact timeline value we're
supposed to signal and perform the update.

Select lowest physical timeline value correctly.
Array can be reordered now, so lowest value isn't necessarily first.

Fixes some super weird hangs in Control DXR.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-16 21:41:37 +01:00
Philip Rebohle eab288bb4e vkd3d: Simplify fence worker implementation.
Avoids potential busy-waiting on the driver with WAIT_ANY_BIT.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-16 12:43:24 +01:00
Philip Rebohle 93a80d5eaa vkd3d: Create one fence worker per command queue.
Rather than one per device. This solves issues with D3D12 fences
being signalled too late because the fence worker is waiting on
a different set of semaphores while the fence is being enqueued.

Greatly increases performance in Horizon Zero Dawn and Death
Stranding with multi-queue mode enabled.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-16 12:43:24 +01:00
Philip Rebohle 34bca90a9c vkd3d: Implement internal reference counting for d3d12_fence.
This will be necessary once we introduce fence workers per
command queue, since we cannot reliably store pointers to
queues.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-16 12:43:24 +01:00
Hans-Kristian Arntzen 102ea2211b vkd3d: Ignore IASetVertexBuffers for NULL pViews.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-15 14:55:53 +00:00
Hans-Kristian Arntzen 5b2cc545e8 vkd3d: Convert RTAS geometry flags.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-15 14:55:03 +00:00
Hans-Kristian Arntzen c425343f41 vkd3d: Remove FIXME spam for pResourceAfter = NULL cases. 2021-03-15 14:10:27 +01:00
Philip Rebohle 0e4ef88d18 vkd3d: Don't broadcast semaphore waits when zeroing memory.
Instead, let queues wait on demand.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 7185e9776d vkd3d: Introduce vkd3d_queue_add_wait.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 724257c0d8 vkd3d: Add multi_queue config flag.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 859aa3fd5a vkd3d: Use VK_SHARING_MODE_CONCURRENT if multi-queue is enabled.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 1e3c91579e vkd3d: Create one vkd3d queue per Vulkan device queue.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 3cd93781ff vkd3d: Create multiple queues per queue family if possible.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 6967b1e92b vkd3d: Wait for queue idle before destroying vkd3d queue.
Fixes a potential issue where we may destroy objects that
are still in use by the GPU.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle b0309f6f90 vkd3d: Introduce d3d12_device_allocate_vkd3d_queue.
Replaces d3d12_device_get_vkd3d_queue when mapping D3D12
command queues to Vulkan device queues.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 7359686609 vkd3d: Introduce d3d12_device_get_vkd3d_queue_family.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Philip Rebohle 4c0a0b0467 vkd3d: Introduce vkd3d_queue_family_info.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-15 12:52:00 +01:00
Hans-Kristian Arntzen b4f48bf2d6 meta: Update README with new VKD3D_CONFIG flags.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-13 06:26:27 +00:00
Hans-Kristian Arntzen b44bfa7066 vkd3d: Remove obsolete comment.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-13 06:26:27 +00:00
Hans-Kristian Arntzen 43370c6426 vkd3d: Only enable DXR if requested.
The implemnentation is not complete enough to safely enable it, since
some games will try to create RTPSOs by default, leading to crashes.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 58615cd5dc vkd3d: Allow devices with recursion of 1 to be accepted.
We can fail RTPSOs later if they for whatever reason use recursion.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen d9be9b57f2 vkd3d: Actually use RGBA16 formats for RT VBO.
It's really supposed to load 4 components and ignore. RGB16 is not
mandatory, so just use the "expected" formats after all.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 2b6658da67 vkd3d: Enable RT tier 1.0 if possible.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 3adc385167 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen c5c45b851f vkd3d-shader: Add missing stage conversion for RT.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 4f2776ff93 vkd3d-shader: Dump RT export SPIR-V.
Need one unique blob per export.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 3358fca922 vkd3d: Implement local root signature association.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 028b87ab61 vkd3d: Fix some trivial bugs with local root signatures.
Did not properly allocate bindings.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-12 12:20:10 +01:00
Hans-Kristian Arntzen 4f40a5a6d2 tests: Tests multiple local root signatures.
Runtime behavior here is extremely weird and contradicts spec wording in
many ways:

- Default local root signatures can override explicit ones.
- Runtime silently fails if the associated subobject is not part of the
  PSO array.
- Order of default local root signatures doesn't appear to matter at
  all.

All in all, very confusing, and there is zero help from validation
layer, so we'll have to deduce this from whatever applications want.
Hopefully they are somewhat sane, and don't try to rely on very awkward
matching rules.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-11 13:57:55 +01:00
Philip Rebohle 85f15916c4 vkd3d: Optimize unmapping adjacent resource regions.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-11 13:57:45 +01:00
Philip Rebohle 2ef8106136 vkd3d: Optimize sparse binding for buffers and full subresources.
Compacts ranges and only issues one bind for buffer ranges and
full subresource updates, rather than one bind per tile.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-10 13:18:44 +01:00
Philip Rebohle ead9f2d620 vkd3d: Store subresource index in d3d12_sparse_image_region.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-10 13:18:44 +01:00
Hans-Kristian Arntzen ff78b2df1c vkd3d: Dump DXIL when parsing entry points as well.
Parse can fail, and it's is useful to debug that.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 13:08:25 +01:00
Hans-Kristian Arntzen 73d55ec65a dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 13:08:25 +01:00
Hans-Kristian Arntzen cd876284e0 vkd3d: Fix some const warnings on MSVC.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 10:48:01 +00:00
Hans-Kristian Arntzen ce62d3d700 vkd3d: Fix MSVC build errors.
args... is a GNU extension.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 10:48:01 +00:00
Hans-Kristian Arntzen 369f48e499 tests: Add test for RTAS update.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:22 +01:00
Hans-Kristian Arntzen 0bf3a1d441 vkd3d-shader: Recognize recent descriptor range flag.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:05 +01:00
Hans-Kristian Arntzen 56e7cbec80 test: Test CBV table hoisting.
Adds some spicy edge cases with array size of 1 w/ nonuniform access, etc.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:05 +01:00
Hans-Kristian Arntzen 13d132f1c4 vkd3d: Add support for hoisting CBV descriptors to push descriptors.
Bindless CBV is *pretty* bad on NVIDIA, so add a code path which can
promote descriptor table CBVs into push descriptors.

We can safely do this with Root Signature 1.1 STATIC or
the somewhat obscure STATIC_KEEPING_BUFFER_BOUNDS_CHECKS.

With VOLATILE, which basically all titles are using,
we can still force this behavior through a config flag,
but this is an incorrect speed hack. It works in most
titles however, since bindless CBV is exceptionally rare.

We only hoist descriptors when the root signature range has 1 descriptor
anyway, so we should avoid any reasonable bindless scenario.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:05 +01:00
Hans-Kristian Arntzen d758a6e296 vkd3d: Convert Root Signatures to 1.1.
We will be able make use of the use STATIC vs VOLATILE flags.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:05 +01:00
Hans-Kristian Arntzen c409d0f30a vkd3d: Optimize R32UI texel buffer creation.
There is no need to scan through the Vulkan format list,
especially since texel buffer creation happens in the hot path
in cases where we know we need to create R32UI texel buffer views.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:05 +01:00
Hans-Kristian Arntzen 3e876c2857 vkd3d: Log VKD3D_CONFIG with INFO.
Useful to make sure we actually passed it correctly ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-10 11:46:05 +01:00
Hans-Kristian Arntzen c351dfc8d3 vkd3d: Remove dead code from d3d12_command_list.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-05 15:49:28 +01:00
Joshua Ashton ce9ae01c79 build: Warn about VLA usage
Using consts for array sizes is a C++-ism, and in GCC in C-mode it won't fold literal constants, and will instead prefer to make a VLA.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-04 15:50:28 +00:00
Hans-Kristian Arntzen 38bb845800 tests: Refactor raytracing test to be a bit more extensible.
Fixes a lot of the worst hardcoding, test different IBO / VBO formats.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-04 16:30:29 +01:00