Commit Graph

3110 Commits

Author SHA1 Message Date
Philip Rebohle c057e881dc vkd3d: Do not interrupt render pass for occlusion queries.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-07 15:18:12 +01:00
Hans-Kristian Arntzen 7711b9ba1a README: Mention VK_VALVE_mutable_descriptor_type as a key extension.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-07 15:17:08 +01:00
Hans-Kristian Arntzen aa21d2d03d vkd3d: Add support for VK_VALVE_mutable_descriptor_type.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-07 15:17:08 +01:00
Hans-Kristian Arntzen 76a7eb7c57 vulkan-headers: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-07 15:17:08 +01:00
Hans-Kristian Arntzen 4fa24bb4ee tests: Remove old is_bug for conditional rendering.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-07 14:10:51 +01:00
Hans-Kristian Arntzen 8fb88855e5 vkd3d: Hash buffers and views based on format, not vk_format.
The creation infos use the format, which potentially contains other
information as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-05 15:09:39 +01:00
Hans-Kristian Arntzen 6b363e53d2 vkd3d: Actually compare against hashmap entry and not against itself.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-05 15:09:39 +01:00
Hans-Kristian Arntzen e6961afca6 vkd3d-shader: Emit typed format for UAVs which use atomics.
Mesa will assert if not, and the format must be known here.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-04 16:08:26 +01:00
Philip Rebohle c4fbe47106 vkd3d: Do not interrupt render pass for timestamp queries.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:54:35 +01:00
Philip Rebohle e13d69ad27 vkd3d: Batch query pool reset commands if possible.
By resetting query pools in advance, we can reduce the number of
stalls between draw calls in passes with occlusion queries, which
is currently causing serious performance issues in some games.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Philip Rebohle 648e41716b vkd3d: Add additional command buffer to batch intialization commands.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Philip Rebohle d0fc57413e vkd3d: Merge adjacent query ranges on insertion.
Since we'll be inserting lots of single queries, we want to
avoid having to resize the range array since that is an O(n)
operation at worst.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Philip Rebohle 81e6449f67 vkd3d: Add code to track query ranges used within a command list.
Useful to batch vkCmdResetQueryPool calls.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Hans-Kristian Arntzen ee4508ba97 vkd3d: Fix sign vs unsigned compare warning.
UINT16 promotes to int rather than UINT here.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-03 15:05:13 +01:00
Hans-Kristian Arntzen f67f55827e vkd3d: Parse patch version of PACKAGE_NAME as well.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-03 15:05:13 +01:00
Hans-Kristian Arntzen adf0be5bf1 vkd3d: Lower contention when spinlocking writers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen b85a345d48 vkd3d: Fix const-ness warning on MSVC.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen 5f8659f4bb vkd3d: Use reader-writer spinlock in view map.
The common case is that we find an entry, so taking a writer lock should
be the rare case. We need to optimize for the case where the application
hammers the view map with e.g. buffers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen b3024365d0 vkd3d: Add a reader-writer spinlock.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
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