Commit Graph

4098 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen 47337d5e0b vkd3d: Add VKD3D_CONFIG flags for various pipeline library logging.
Additionally, add option to ignore cached SPIR-V.
Will be useful for debugging, and also required for VKD3D_SHADER_OVERRIDE.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen f03940ef4b vkd3d: Add global_pipeline_cache option.
Avoids saving out pipeline cache blobs which are likely going to be
cached by on-disk cache anyways.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen e5e662ce22 vkd3d: Record root signature compatibility hashes.
For pipeline libraries and DXR to some extent later, we'll need an easy
way to compare root signature objects.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen bc3b25fb0e tests: Extend unbound RTV rendering test to cover invalidation of PSO.
Similar issue with this as with NULL DSV rendering test. We did not test
the scenario where RTV is bound, then it is not bound anymore with same
PSO.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 13:10:16 +01:00
Hans-Kristian Arntzen 05a5d366d5 tests: Test rendering to non-NULL DSV, then NULL DSV.
Uncovered CPU crash where we did not invalidate pipeline/render pass
properly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 13:10:16 +01:00
Hans-Kristian Arntzen 1d39c25a59 vkd3d: Properly invalidate pipeline when binding NULL DSV.
We did not test the scenario where we first render with depth enabled,
and then bind a NULL DSV with the same pipeline.
Also fix issues if we bind NULL RTVs with same pipeline bound.

Fixes crash in Guardians of the Galaxy.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 13:10:16 +01:00
Hans-Kristian Arntzen 5e526d506b vkd3d: Remove warning for setting NULL index buffer.
This is benign and easily gets spammed a TON.
We will warn if an indexed draw is actually made like this.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-03 18:16:36 +01:00
Hans-Kristian Arntzen 91ca2ed8ba tests: Mark COLOR -> STENCIL copy test as TODO.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-03 15:43:41 +01:00
Hans-Kristian Arntzen 2ca7ce62da tests: Add test for color <-> stencil copies.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-03 15:43:41 +01:00
Hans-Kristian Arntzen 907acce30c tests: Fix D3D12 validation error in copy_texture test.
Copy out of bounds now seems to trigger device lost.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-03 15:43:41 +01:00
Hans-Kristian Arntzen 8b92d8e0bc tests: Add test for copying single aspects between DS images.
Also fixes test bug where texture was sampled as float, despite having
uint aspect.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-03 15:43:41 +01:00
Hans-Kristian Arntzen 81a215d0bf vkd3d: Implement COLOR -> STENCIL copy if stencil export is supported.
Fallback is a bit more involved. Cleans up the FIXME to not report
benign issues.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-03 15:43:41 +01:00
Hans-Kristian Arntzen 29d956c6c4 vkd3d: Fix memory leak of D3D12 device singleton.
Fairly trivial, caught by ASAN.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-02 13:56:36 +01:00
Hans-Kristian Arntzen 49d0eb37e3 vkd3d: Properly align d3d12_command_list allocations.
UBSAN found a bug here since we store RTV descriptors inline, the
compiler can assume the pointer is 64 byte aligned.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-02 13:56:36 +01:00
Hans-Kristian Arntzen 1da9ad900c hashmap: Avoid redundant copy of entry data.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-02 13:56:36 +01:00
Philip Rebohle 8f81aaa710 vkd3d: Fix reporting of WriteBufferImmediateSupportFlags.
Oversight from when we added bundles.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-02-01 16:21:43 +01:00
Philip Rebohle 91976b2edd tests: Add mesh and amplification shader tests.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-01-28 17:06:30 +01:00
Philip Rebohle 6aa73b3d53 tests: Move pipeline stream structs to common header.
We'll need to use the CreatePipelineState API for more tests.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-01-28 17:06:30 +01:00
Krzysztof Bogacki ab47aaf36d build: Add workflow for MSVC builds
Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2022-01-25 16:19:11 +00:00
Hans-Kristian Arntzen 833f56154c cache: Store shader interface key in pipeline library as well.
If we're going to create different SPIR-V files from what the
VkPipelineCache represents, it's meaningless to load it.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen 86f8f41490 vkd3d: Compute a global shader interface key for a D3D12 device.
This key represents the variations of SPIR-V which would be generated
from otherwise identical inputs like DXBC blobs and root signatures.

Typically, changing VKD3D_CONFIG flags or enabled extensions will affect
this key. This ensures that we will not attempt to use a cached SPIR-V
file unless we can trust that the SPIR-V interface will match.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen a3f1a0e3cd vkd3d-shader: Add mechanism to get vkd3d-shader implementation revision.
Not immediately useful, might be nuked later in development.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen e90b573896 vkd3d-shader: Use flag for vkd3d_shader_meta bools.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen 8196b85408 vkd3d-shader: Make vkd3d_shader_hash public.
Prepare for meta struct to be serialized to a cache.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen a2c1527acd vkd3d-shader: Reuse hashmap.h hasher for shader hash.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen 3839144848 vkd3d: Add FNV-1a hash util.
To be used for pipeline library hashing.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen 6e697a54b6 vkd3d: Add d3d12_cached_pipeline_state.
Wraps the D3D12 struct with a pipeline library handle.
This is needed if the blob contains references to external data,
which then needs to be resolved.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen 41c977d616 cache: Move cache implementation over to read-writer locks.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Hans-Kristian Arntzen 7da708ea69 vkd3d: Add an RW lock wrapper.
For longer-lived locks where spinlock is bad form. To be used for
pipeline library.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-25 14:07:07 +01:00
Georg Lehmann 2c76840ff8 meta: Update COPYING year.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2022-01-25 11:11:51 +01:00
Georg Lehmann 182ebd7e00 meta: Update AUTHORS.
git log --pretty="%aN" | sort | uniq > AUTHORS

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2022-01-25 11:11:51 +01:00
Georg Lehmann c69b73ffcf meta: Create a .mailmap file.
Replaces some of the github account name authors with their real name from
the Signed-off-by.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2022-01-25 11:11:51 +01:00
Hans-Kristian Arntzen 1409ebab1f vkd3d: Consider sparse buffers to alias any other buffer.
Technically cannot alias committed buffers, but 🤷 ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-20 15:14:27 +01:00
Hans-Kristian Arntzen 7d0743345a vkd3d: Remove useless buffer barrier tracking.
This copy is to a scratch buffer, which needs no tracking.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-20 15:14:27 +01:00
Hans-Kristian Arntzen 2b0a161a0d tests: Sanitize test_hull_shader_vertex_input_patch_constant_phase.
Was using w = 0.0, causing weird issues.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-19 17:10:19 +01:00
Philip Rebohle 1af62abfe7 vkd3d: Enable quirk for further UE4 shaders.
Fixes artifacts in The Ascent.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-01-19 16:49:42 +01:00
Hans-Kristian Arntzen 338157eb04 tests: Add test for overlapped buffer copies.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-19 14:44:33 +01:00
Hans-Kristian Arntzen 5c492e9e6c vkd3d: Handle overlapped transfer writes.
D3D12 expects drivers to implicitly synchronize transfer operations,
since there is no TRANSFER barrier ala UAV barriers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-19 14:44:33 +01:00
Hans-Kristian Arntzen 68ce4b4116 vkd3d: MSVC build fix.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-19 14:21:09 +01:00
Hans-Kristian Arntzen 0f46a8a7d5 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-14 16:09:16 +01:00
Hans-Kristian Arntzen 6cba8b9945 vkd3d: Workaround broken barriers in DEATHLOOP.
In DEATHLOOP, there is a render pass which renders out a simple image,
which is then directly followed by a compute dispatch, reading that
image. The image is still in RENDER_TARGET state, and color buffers are
*not* flushed properly on at least RADV, manifesting as a very
distracting glitch pattern. This is a game bug, but for the time being,
we have to workaround it, *sigh*.

For a simple workaround, we can detect patterns where we see these
events in succession:

- Color RT is started
- StateBefore == RENDER_TARGET is not observed
- Dispatch()

In particular, when entering the options menu, highly distracting
glitches are observed in the background.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:20:03 +01:00
Hans-Kristian Arntzen e5efa8594e tests: Remove RADV bugs which have been fixed.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:18:56 +01:00
Hans-Kristian Arntzen 39c1f9d07a tests: Add test for invalid (?) alias barrier behavior.
Verifies that aliasing barriers on their own do not trigger image layout
transitions.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:16:52 +01:00
Robin Kertels 35be1329ed vkd3d: Don't do layout transition in aliasing barrier.
HZD issues an aliasing barrier for an alias of a resource that it
still needs.
Because D3D12 requires you to call DiscardResource or a full resource
clear/copy, we can just rely on those to do the actual image layout
transition and treat the aliasing barrier as a pure sync + flush.

This behavior is also observed in a test case where D3D12 drivers
do not seem to discard / fast-clear anything in an aliasing barrier.

Signed-off-by: Robin Kertels <robin.kertels@gmail.com>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:16:52 +01:00
Samuel Pitoiset f6a4e0fb71 vkd3d: Use VK_KHR_copy_commands2
Mesa RADV translates these legacy entrypoints to the 2 variants. Using
them directly will cost a bit less CPU cycles.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2022-01-12 12:06:06 +01:00
Samuel Pitoiset f6fe3e0183 vkd3d: Require VK_KHR_copy_commands2
This extension is trivial to implement for vendors and should be
widely supported.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2022-01-12 12:06:06 +01:00
Samuel Pitoiset 870dda927d vkd3d: Use VK_KHR_bind_memory2
Mesa RADV translates these legacy entrypoints to the 2 variants. Using
them directly will cost a bit less CPU cycles.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2022-01-12 12:06:06 +01:00
Samuel Pitoiset b42a7193fc vkd3d: Require VK_KHR_bind_memory2
This extension is trivial to implement for vendors and should be
widely supported.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2022-01-12 12:06:06 +01:00
Hans-Kristian Arntzen db943f2341 tests: Add DXIL test for FP32 -> FP16 conversions.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:04:49 +01:00
Hans-Kristian Arntzen 9162e82fb3 tests: Add DXBC test for f32tof16 behavior.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:04:49 +01:00