Commit Graph

3810 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen 68d2c60256 vkd3d: Improve log_memory_budgets logging.
Log current budgets for all types when requested.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-17 12:00:41 +01:00
Hans-Kristian Arntzen 1cc8afcc8e vkd3d: Fix potential crashes when VK_KHR_dynamic_rendering is added.
Checking for pNext here is too brittle and causes crashes when dynamic
rendering path is added.
Also need to chain in existing pNexts.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-17 11:27:25 +01:00
Hans-Kristian Arntzen 1112106db0 tests: Verify that runtime validates invalid PSO description for blob.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-17 11:00:03 +01:00
Hans-Kristian Arntzen 624bf53f8b tests: Verify that runtime must validate DXBC blob and RS.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-17 11:00:03 +01:00
Hans-Kristian Arntzen b363d8d2e4 tests: Remove TODO from PSO library test.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-17 11:00:03 +01:00
Hans-Kristian Arntzen 5d345f47cc vkd3d: Rewrite the pipeline library implementation.
This became basically a rewrite in the end, and it got too awkward to
split these commits in any meaningful way.

The goals here were primarily to:

- Support serializing SPIR-V and load SPIR-V.
  To do this robustly requires a lot more validation and checks to make
  sure end up compiling the same SPIR-V that we load from cache.
  This is critical for performance when games have primed their pipeline
  libraries and expect that loading a PSO should be fast. Without this,
  we will hit vkd3d-shader for every PSO, causing very long load times.
- Implement the required validation for mismatched PSO descriptions.
- Rewrite the binary layout of the pipeline library for flexibility
  concerns and performance.
  If the pipeline library is mmap-ed from disk - which appears to be
  the intended use - we only need to scan through the TOC to fully parse
  the library contents.
  From a flexibility concern, a blob needs to support inlined data,
  but a library can use referential links. We introduce separate
  hashmaps which store deduplicated SPIR-V and pipeline cache blobs,
  which significantly drop memory and storage requirements.
  For future improvements, it should be fairly easy to add information
  which lets us avoid SPIR-V or pipeline cache data altogether if
  relevant changes to Vulkan/drivers are made.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-17 11:00:03 +01:00
Georg Lehmann a078197e16 build: Avoid meson warning.
WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2022-02-11 16:21:52 +01:00
Krzysztof Bogacki 9029d1ae23 build: Merge Prepare and Build steps on Windows CI.
Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2022-02-07 11:12:15 +01:00
Krzysztof Bogacki ae7081eb62 build: Use MSBuild backend on Windows CI.
Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2022-02-07 11:12:15 +01:00
Hans-Kristian Arntzen 33f17cc74d vkd3d: Add VK_EXT_pipeline_creation_feedback.
Useful when used together with pipeline library logging. Confirms that
we can load pipeline caches as expected.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen 3b8265dccc common: Add a timedwait condvar API.
To be used for upcoming disk driver cache implementation which needs to
live on a thread.

Need a separate wrapper since pthread and SRWLock interface is quite
different. Similar rationale as rwlock_t.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen a2eddc181b common: Add f32/string hashing utils as well.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
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