Commit Graph

3141 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen c2c674194d vkd3d: Add Add/Sub/And atomic u32 intrinsics.
Will be used for reader-writer spinlocks.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen f96e60b6ac vkd3d: Make hashmap compatible with reader-writer locks.
Yield insertion when there is a match.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen e0382cc451 vkd3d: Add extra typeless copy usage flags after clearing them.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-27 16:27:39 +01:00
Hans-Kristian Arntzen f46756ed85 vkd3d: Report if RTV/DSV resource does not set render target usage.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-27 16:27:39 +01:00
Hans-Kristian Arntzen c38fd9bfc3 vkd3d: Bind WHOLE_SIZE when using null SSBO descriptor.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-27 13:13:39 +01:00
Philip Rebohle 8c0958824a tests: Remove todo from 64-bit predicate test.
This is supported properly now as long as the device supports
buffer_device_address.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-27 12:43:39 +01:00
Philip Rebohle 2ec68af1d5 vkd3d: Add fallback path for predication using indirect draws.
Official AMD drivers do not support VK_EXT_conditional_rendering,
so we'll use indirect draws instead to emulate the feature.

This also handles 64-bit predicates in combination with the
Vulkan extension, which was not possible previously.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-27 12:43:39 +01:00
Philip Rebohle 82d9ba1ebf vkd3d: Add meta shader to generate predicated draw/dispatch commands.
The idea is to use indirect draws and dispatches to implement
predication. For predicated indirect draws, we'll use indirect
count.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-27 12:43:39 +01:00
Joshua Ashton e27a153a22 vkd3d-shader: Fix saturates of fp64 types
Closes: #419

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-27 11:11:59 +01:00
Hans-Kristian Arntzen 9cd082da69 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-25 20:22:37 +01:00
Joshua Ashton 22794c67a4 include: Add missing enum flag operator definitions
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-25 15:58:45 +01:00
Joshua Ashton 3e5a3c835a include: Fix definition of D3D12_RESOURCE_ALIASING_BARRIER
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-25 15:58:45 +01:00
Joshua Ashton 6b9f7b7339 include: Fix typo in d3d12 header
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-25 15:58:45 +01:00
Joshua Ashton fcb4764228 include: Update D3D12 headers
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-25 15:58:45 +01:00
Hans-Kristian Arntzen 1ce5ea8073 vkd3d: Fix segfault when freeing pipeline library.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-25 10:26:36 +01:00
Hans-Kristian Arntzen 8a102d6a1c dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-24 18:58:06 +01:00
Philip Rebohle 2c9bacd760 vkd3d: Perform binary occlusion query fixup on scratch buffer.
Potentially avoids some unnecessary host memory access. Use BDA for
the compute shader so that we can ignore alignment restrictions on
some GPU architectures.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-24 16:45:55 +01:00
Philip Rebohle 78076a9a84 vkd3d: Introduce d3d12_resource_get_va.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-24 16:45:55 +01:00
Philip Rebohle afb85c79cd vkd3d: Add code to create, destroy and recycle scratch buffers.
Command lists may need to allocate temporary device memory for
certain operations. In order to avoid frequent alloc/free calls,
we'll recycle these scratch buffers until a certain threshold.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-24 16:45:55 +01:00
Hans-Kristian Arntzen c0b34fdb7b tests: Add unaligned VBO read test.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-24 15:07:29 +01:00
Hans-Kristian Arntzen 19193bf932 vkd3d: Sanitize VBO strides and VBO offsets.
Realign VBO strides and offsets if we have to, for sake of
robustness. Violating these rules is against D3D12 spec, but it does not
cause crashes on native drivers. On RDNA we can hit hangs with unaligned
vertex attributes. It appears that native drivers apply some kind of
fixup here to avoid the crash, even if the result is not what we expect.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-24 15:07:29 +01:00
Hans-Kristian Arntzen 10b503c893 vkd3d: Fallback to NULL VA when binding non-existent VBO.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-24 15:07:29 +01:00
Philip Rebohle 9d57489225 vkd3d-shader: Correctly handle infinity in f32tof16.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-23 15:46:55 +01:00
Philip Rebohle ced72326be tests: Test f32tof16 behaviour with infinity and high numbers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-23 15:46:55 +01:00
Philip Rebohle 8cbecfb9f6 vkd3d: Fix offset for predicate buffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-20 11:23:06 +01:00
Philip Rebohle 35f6aa22c7 tests: Remove todo for binary occlusion query test.
This test passes correctly now.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 22:08:42 +01:00
Philip Rebohle fb6f078ba9 vkd3d: Fix up binary occlusion query results.
In D3D12, these return 1 rather than an actual sample count.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 22:08:42 +01:00
Philip Rebohle 89aea3304c vkd3d: Always add STORAGE_BUFFER_BIT to readback buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 22:08:42 +01:00
Philip Rebohle fdd0dbafe4 vkd3d: Add meta compute shader to resolve binary occlusion queries.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 22:08:42 +01:00
Philip Rebohle 6886bb7f11 vkd3d: Handle empty viewports.
Assassin's Creed Valhalla relies on this.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 14:31:39 +01:00
Philip Rebohle ecc504922e vkd3d: Consider mip level for 3D UAV slice check.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 14:20:28 +01:00
Hans-Kristian Arntzen ffc1fa646c vkd3d: Mask out attachments which cannot safely be written to.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-19 14:13:59 +01:00
Hans-Kristian Arntzen 0dc0d75967 vkd3d: Use VK_IMAGE_LAYOUT_UNDEFINED for unused attachments.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-19 14:13:59 +01:00
Georg Lehmann 11bdc76aa0 vkd3d: Use static init for device map.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2020-11-18 18:29:48 +00:00
Georg Lehmann 24100cac07 vkd3d: Add Win32 PTHREAD_MUTEX_INITIALIZER.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2020-11-18 18:29:48 +00:00
Hans-Kristian Arntzen d0328e8760 vkd3d: Fix uninitialized variable in initial WSI transition.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 16:40:17 +01:00
Hans-Kristian Arntzen 9617a0f598 vkd3d: Disable RAW_VA root CBVs on NVIDIA.
BDA cannot map to their hardware, and we observe a large performance
loss in games which use root CBVs. For this reason, fall back to push
descriptors here.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 15:49:31 +01:00
Hans-Kristian Arntzen 52ee2edc3d vkd3d: Separate root VA use for CBV and SRV/UAV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 15:49:31 +01:00
Philip Rebohle 5a288b7d0f tests: Adjust todos in some query tests.
Query init changes broke unissued timestamp queries, but
test_resolve_query_data_in_reordered_command_list passes.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 15:45:28 +01:00
Philip Rebohle 215989f6d5 vkd3d: Rework query pool initialization.
Ensures that queries are always available and initialized
in the correct order on the GPU timeline.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 15:45:28 +01:00
Philip Rebohle bb9d0f2741 vkd3d: Rework initial transitions to allow for different types.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 15:45:28 +01:00
Philip Rebohle 10e82fa7a0 tests: Add missing UAV barriers in test_cs_uav_store.
Fixes some random test failures.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 15:05:29 +01:00
Hans-Kristian Arntzen 27f91b99b0 vkd3d-shader: Add debug log callback to DXIL.
Allows us to capture dxil compiler messages in log.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 14:37:58 +01:00
Joshua Ashton a950191008 vkd3d: Implement singleton devices.
Matches D3D12 behaviour.

Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 12:39:14 +01:00
Philip Rebohle 1563b80852 include: Fix various issues with atomic CAS.
- fail/success memory orders exist for a reason, we can't
  e.g. do release on fail since it's a read-only operation
- silence some warnings about pointer->integer casts
- fix linker errors on mingw by marking functions as static

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 12:39:14 +01:00
Hans-Kristian Arntzen f54ac3b9c5 vkd3d: Add app detection for buggy game: ds.exe.
Game renders the map with wrong descriptor type, which means we must
implement everything as texel buffers to make this work.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 12:27:19 +01:00
Hans-Kristian Arntzen 6f8ae20015 vkd3d: Add VKD3D_CONFIG option to disable bindless SSBO.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 12:27:19 +01:00
Hans-Kristian Arntzen d947c17fc2 meta: Add missing VKD3D_DEBUG level to README.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 12:27:19 +01:00
Philip Rebohle bab9b0af92 vkd3d: Support offset buffers for raw/structured texel buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 12:27:19 +01:00
Hans-Kristian Arntzen 3e15a3f06a vkd3d: Remove manual tracking of host barriers.
Just emit host barrier on submit unconditionally.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-17 16:34:03 +01:00