Commit Graph

3398 Commits

Author SHA1 Message Date
Georg Lehmann 1af017c284 include: Add some new dxgi formats.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-06-24 12:55:17 +02:00
Hans-Kristian Arntzen c108bec58f vkd3d: Fix trivial indentation nit.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:41:09 +02:00
Hans-Kristian Arntzen 9900301886 vkd3d: Use read-write lock for fallback pipeline cache.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:41:09 +02:00
Hans-Kristian Arntzen bb723e859b vkd3d: Use read-write locks for render pass cache.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:41:09 +02:00
Hans-Kristian Arntzen 5fe135f3fb vkd3d: Ensure shader visibility happens for DEPTH_READ | RESOURCE scenarios.
If we're doing a layout transition of depth-stencil aspects, we need to ensure all potential
accesses are made visible.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:32:48 +02:00
Hans-Kristian Arntzen 8225edc726 vkd3d: Rewrite resource state implementation.
- Honor resource barriers for resource states which cannot automatically
  decay or promote. This includes COLOR_ATTACHMENT, UNORDERED_ACCESS and
  VRS image. If SIMULTANEOUS_ACCESS is used, we can still promote, and
  we handle that by setting common layout to GENERAL for these resources.

- Avoid redundant barriers in render passes since normal resource
  barriers will always make sure we are already in
  COLOR_ATTACHMENT_OPTIMAL.

- Do not force GENERAL layout if resource has UNORDERED_ACCESS flag set.
  As this is not a promotable state, we have to explicitly transition
  into it. I tested this on validation layers, where even COMMON state
  refuses to promote to UAV state. The exception here of course is
  SIMULTANOUS_ACCESS, but we handle that properly now.

- Verify that UAV or SIMULTANEOUS access is not used together with DSV
  state. This is explicitly banned in the API docs.

- Actually emit image barriers. Batch the image transitions as that's
  what D3D12 docs encourage app developers to do, and it also expects
  that drivers can optimize this. Ensure that we respect the in-order
  resource barrier rules by splitting batches if there are overlaps in
  the transitions.

- Ensure that correct image layout is used when clearing a suspended
  render pass attachment.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:32:48 +02:00
Hans-Kristian Arntzen 177679a766 vkd3d: Add VKD3D_RESOURCE_SIMULTANEOUS_ACCESS.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:32:48 +02:00
Hans-Kristian Arntzen 02398c4eef vkd3d: Normalize depth-stencil layouts if only one aspect is used.
Avoid using the separate layouts if we're only using formats with one
aspects. This makes it more likely to match layouts with common layout,
and we can avoid awkward transition barriers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-22 14:32:48 +02:00
Philip Rebohle 014a3c0b94 vkd3d: Handle plane slice index in descriptor creation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-06-21 21:23:03 +02:00
Samuel Pitoiset bf04b324c6 vkd3d: remove few occurrences of RADV/ACO
We recently dropped this from Mesa because ACO is the default
compiler since August 2020, so it's implicit.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2021-06-18 16:11:26 +02:00
Samuel Pitoiset 72d9b322b8 vkd3d: reject creating a resource that is placed if the heap is too small
The spec is pretty clear that it's invalid usage. Return E_INVALIDARG
like native drivers.

This is a workaround for the inventory GPU hang with Cyberpunk 2077
which is actually a game bug. Luckily the game handles this error
properly.

The problem is that the game always assume that an image with 2 mips
is smaller than the same image but with 6 mips. This is not always
true if the swizzle mode is different and a recent Mesa update changed
that. Then the game creates a D3D12 heap that is too small and this
triggered a memory violation and then a GPU hang with RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2021-06-17 16:42:23 +02:00
Hans-Kristian Arntzen 1ea31701c5 vkd3d: Move F1 2020 workaround over to quirks system.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +02:00
Hans-Kristian Arntzen 28c8a595fa vkd3d: Pass down shader quirks for Necromunda.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +02:00
Hans-Kristian Arntzen cb61a4c83a vkd3d-shader: Implement sample explicit LOD override.
In control flow, we can force LOD 0.0 to avoid undefined result when
games sample with implicit LOD in non-quad uniform control flow.

Behavior on different implementations is:
- Helper lanes come to life and interpolate shader input.
- LOD is clamped to 0.0 in divergent control flow.

This hack is not safe in general, since we force 0.0 even when the
control flow is quad uniform.

This is the most practical solution for the problem for now.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +02:00
Hans-Kristian Arntzen a08e493a3a vkd3d-shader: Add interface for shader workarounds.
Don't really have much of a choice for the short term. :\

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +02:00
Hans-Kristian Arntzen 4c101a4e81 vkd3d-shader: Keep track of early returns.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +02:00
Hans-Kristian Arntzen 9207d4f019 vkd3d: Ignore BlendEnable if write mask is 0.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +02:00
Hans-Kristian Arntzen 8589a425fe vkd3d-shader: Emit NoContraction for MAD/DFMA.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:01:46 +02:00
Hans-Kristian Arntzen 5c971f216e vkd3d: Invalidate binding state on query resolve.
Fixes random broken AO in Necromunda on RADV.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 15:59:05 +02:00
Hans-Kristian Arntzen 7ab0846242 tests: Add test for placed resource runtime validation.
Runtime validates resource size.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 15:53:35 +02:00
Philip Rebohle 6d1d60e898 tests: Test tile mappings for 3D textures.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-06-14 15:53:33 +02:00
Philip Rebohle 14617a7bb2 tests: Test resource tiling for 3D textures.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-06-14 15:53:33 +02:00
Philip Rebohle b97a012787 vkd3d: Enable tiled resources tier 3.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-06-14 15:53:33 +02:00
Hans-Kristian Arntzen 42fb018d85 vkd3d: Fix leak of command pools on device destruction.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-11 15:17:45 +02:00
Hans-Kristian Arntzen d7843fa012 vkd3d: Fix potential deadlock in debug ring.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-11 11:04:38 +02:00
Hans-Kristian Arntzen 58854b0a9c vkd3d: Fix potential deadlock in descriptor QA checks.
If we destroy device right after creating it, we risk a deadlock.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-11 11:04:38 +02:00
Hans-Kristian Arntzen 76a8914d6b vkd3d: Add validation error workaround.
Our internal copy shaders are fine, but we get benign errors about
sample count being wrong since we alias descriptors.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-10 14:19:04 +02:00
Hans-Kristian Arntzen abe0995e88 vkd3d: Use correct allocation size for memory block.
We cannot use the memory requirement output, since we will zero-clear
memory with a size that might be larger than the VkBuffer size.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-10 14:16:01 +02:00
Hans-Kristian Arntzen fda8cba2b8 tests: Add missing resource barrier to some tests.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-10 13:57:32 +02:00
Hans-Kristian Arntzen 8056a71415 tests: Fix wrong resource state in test_bufinfo_instruction.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-10 13:57:32 +02:00
Hans-Kristian Arntzen 3c6174cafc tests: Fix type mismatch in test_draw_uav_only.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-10 13:57:32 +02:00
Hans-Kristian Arntzen b922292852 vkd3d: Fix view object leak when creating fallback UAV clear view.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-10 13:50:54 +02:00
rochaudhari 1699743c37 vkd3d: Enable binary import and image view handle extensions
Signed-off-by: Roshan Chaudhari <rochaudhari@nvidia.com>

Reviewed-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2021-06-10 11:26:34 +02:00
rochaudhari ba997f0736 vk-headers: Update subprojects/Vulkan-Headers to 1.2.180
This is needed for VK_NVX_binary_import and VK_NVX_image_view_handle.

Signed-off-by: Roshan Chaudhari <rochaudhari@nvidia.com>

Reviewed-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
2021-06-10 11:26:34 +02:00
conor42 3b1f34217c vkd3d-shader: Fix a bug in constant double vector handling.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
2021-06-09 20:54:02 -07:00
conor42 2ad16f89d3 tests: Modify dadd test to use a double2 vector.
Tests a codepath in vkd3d_dxbc_compiler_get_constant() where
component_count != 1.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
2021-06-09 20:54:02 -07:00
Hans-Kristian Arntzen 20a96cab57 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-08 15:35:20 +02:00
Hans-Kristian Arntzen a09819250f tests: Add null descriptor mismatch type test.
Verifies that we splat null descriptors appropriately.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-07 13:21:31 +02:00
Hans-Kristian Arntzen 47f978fec3 tests: Test clearing a NULL UAV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-07 13:21:31 +02:00
Hans-Kristian Arntzen 9983a1720f vkd3d: Splat null descriptors to all sets.
Some games end up writing the wrong descriptor type when using null
descriptors, and to be robust against that, we have to clear out
all descriptors when creating null descriptors.

If we copy a null descriptor, we will also have to copy from all sets.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-07 13:21:31 +02:00
Hans-Kristian Arntzen 969776c1f8 vkd3d: Ignore NULL descriptor ClearUAV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-07 13:21:31 +02:00
Hans-Kristian Arntzen c7c17d05ed vkd3d: Fix descriptor QA checks for CBV_AS_SSBO.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-07 13:21:06 +02:00
Hans-Kristian Arntzen ec5b4ccecf vkd3d: Ensure that swapchain is eventually recreated.
Latch SUBOPTIMAL state.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-02 19:46:05 +02:00
Joshua Ashton efa0eccc59 vkd3d: Low latency presentation and acquire semaphores
In cases where acquire image is blocking, we should call that after
presentation to avoid latency when the app calls present.

This avoids weird inverse frame cadences with Mesa WSI right now,
as acquiring an image is always a blocking call until it is complete.

In cases when we aren't blocking, this kicks off the acquisition so
it can be waited upon by the next present blit pass.

Use another set of semaphores to wait for the image acquisition on the
GPU.

In the non-blocking vkAcquireNextImageKHR case, this means that a
potential bubble of time between waiting on the fence and submitting
the blit + presentation is eliminated.

Runaway presentation in this setup is avoided by frame latency objects
and normal frame latency which is always 3 according to documentation.

Be careful about handling SUBOPTIMAL. Semaphores will be signaled, but
we might want to tear down the swapchain. In these cases, we need to
wait for the semaphore to be signaled first, which can only be done by
submitting a wait, since QueueWaitIdle or DeviceWaitIdle don't cover
WSI.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-02 19:46:05 +02:00
Joshua Ashton 92ed98ccea vkd3d: Handle frame latency without WAITABLE_OBJECT
Documentation says that this should always be 3 without WAITABLE_OBJECT
unlike in D3D11 where it will use the DXGI device's frame latency.

This stops runaway presentations in the non-blocking acquire image case
with the new semaphore setup.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-06-02 19:46:05 +02:00
Hans-Kristian Arntzen 6f5f55c84a vkd3d: Avoid oldSwapchain.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-02 19:46:05 +02:00
Hans-Kristian Arntzen 582138b063 tests: Fix Clear UAV test constant.
Was using 0x8000 / 0xffff instead of 0x200 / 0x3ff, rounded differently
on NV.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-28 17:42:00 +02:00
Hans-Kristian Arntzen 616538aa47 tests: Add missing UAV barrier in bindless counter test.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-28 15:56:18 +02:00
Hans-Kristian Arntzen fee18f1820 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-28 15:41:49 +02:00
Hans-Kristian Arntzen a83c99ba77 vkd3d-shader: Don't apply offset buffers for non-bindless resources.
Fixes root descriptors when BDA support is disabled.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-27 23:30:51 +02:00