Commit Graph

2717 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen 3a1e6de93d vkd3d: Use rwlock instead of spinlock in PSO fallback cache.
If we defer SPIR-V compilation we risk holding the lock for quite a long
time.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 14:35:41 +01:00
Hans-Kristian Arntzen 191214899d cache: Explicitly do not serialize SPIR-V code for cached PSOs.
With upcoming refactor, we might have to compile code on the fly.
To avoid any race conditions on fallback compile storing code[i] <-> StorePipeline reading code[i],
explicitly mark that code[] should be ignored.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 14:35:41 +01:00
Hans-Kristian Arntzen 221c47d0fd vkd3d: Separate compilation to SPIR-V and creation of VkShaderModule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 14:35:41 +01:00
Hans-Kristian Arntzen f322491964 vkd3d: Stub out DXBC code duplication for later.
When we have the ability to load PSO from identifiers only, we need to
retain DXBC blobs for later.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 12:46:57 +01:00
Hans-Kristian Arntzen 1f7f924662 vkd3d: Separate out the different stages of graphics PSO creation.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 12:46:57 +01:00
Hans-Kristian Arntzen 43b7cc8278 vkd3d: Refactor stages of obtaining SPIR-V modules.
- Try to load SPIR-V from cache
- Fallback compile to SPIR-V if necessary
- Parse PSO metadata obtained from either compilation or cache lookup

Also moves SPIR-V compilation to end of PSO init.
Prepares for refactor where we completely decouple PSO creation info
setup and SPIR-V compilation.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 12:46:57 +01:00
Hans-Kristian Arntzen 66ab0e52c7 vkd3d: Prepare for system where we can retain DXBC blobs in pipeline.
Simplifies the code somewhat. Only iterate over the shader_stages LUT
once.

Adds concept of duped DXBC blobs as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 11:56:31 +01:00
Hans-Kristian Arntzen adf03e7a4b vkd3d: Add FIXME for dubious use of dsv_plane_optimal_mask.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 11:31:51 +01:00
Hans-Kristian Arntzen fdf5ec705c vkd3d: Hoist out pipeline cache creation.
Not super useful to create a local pipeline cache if we're not going to
compile early, but it's super rare, and cleans up the code either way.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-21 11:29:22 +01:00
Hans-Kristian Arntzen d45b3a0dc7 vkd3d: Streamline vkd3d_create_compute_pipeline.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 17:20:10 +01:00
Hans-Kristian Arntzen 742ee58b50 vkd3d: Sink shader interface struct build to where we need it.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 17:05:43 +01:00
Hans-Kristian Arntzen 5798f5827b vkd3d: Refactor out how XFB info is stored.
For deferred compilation, we need to dupe the structs.
XFB is kinda rare, so it's okay to eat allocations here.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 16:54:42 +01:00
Hans-Kristian Arntzen f78b635d54 vkd3d: Ensure shader interface is set up per vkd3d_create_shader_stage.
Prepares for a situation where we can move this code into
vkd3d_create_shader_stage itself.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 16:33:20 +01:00
Hans-Kristian Arntzen 54a6605edf vkd3d: Refactor how we set compiler options.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 16:26:36 +01:00
Hans-Kristian Arntzen 818773d920 vkd3d: Refactor out shader interface struct plumbing.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 16:06:02 +01:00
Hans-Kristian Arntzen c1bc442742 vkd3d: Unify how we hold on to root signatures in PSO state.
Make use of private references to hold on to the root signature object.
This is important in situations where we end up compiling pipelines
late.

With private references like this, there is no longer a need to
distinguish a "private_root_signature", so just rename.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 15:50:00 +01:00
Hans-Kristian Arntzen 8deb9050c2 vkd3d: Make private_root_signatures actually private.
Makes sure that we drop private root signature device references when
public pipeline state refcount hits 0.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-18 15:33:06 +01:00
Hans-Kristian Arntzen 63530501a5 vkd3d: Require VK_EXT_extended_dynamic_state.
This is basically required for not horrible stutter and performance and
is widely supported.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-16 17:48:21 +01:00
Hans-Kristian Arntzen dd6534f3f8 vkd3d: Report enabled debug ring size as INFO instead of WARN.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:26:27 +01:00
Hans-Kristian Arntzen 09997b4dd8 vkd3d: Fish for message clues on device lost.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:26:27 +01:00
Hans-Kristian Arntzen 6d35f98e59 vkd3d: Emit deadca7 cookie for num_words in debug ring.
Makes it somewhat feasible to fish for message begin codes in the
stream.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:26:27 +01:00
Hans-Kristian Arntzen e61cc0234a vkd3d: Allow debug ring to know about device lost scenarios.
For this case, we want to block and teardown the debug ring thread.
It's okay to fish for dead messages in the ring, since we know there
won't be more GPU work submitted.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:26:27 +01:00
Hans-Kristian Arntzen c54895b4b7 vkd3d: Fix overflow of ring_size.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:26:27 +01:00
Hans-Kristian Arntzen a6700d3d85 vkd3d: Make debug ring aware of potential crash scenarios.
If we expect device losts (breadcrumb debug), we need to use DEVICE uncached/coherent,
since we might not be able to flush GPU caches properly.

We also need to remove the idea of being able to copy out the control
block back to host. This is too brittle and we should instead just place
the control block in PCI-e BAR instead. Rethink how we pass messages
from GPU to CPU to make it more robust.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:26:27 +01:00
Hans-Kristian Arntzen 33b9166fec vkd3d: Make device coherency extension optional for breadcrumbs.
Some implementation can support marker, but not explicit coherency.
Buffer markers are often uncached either way, so should be fine ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:07:56 +01:00
Hans-Kristian Arntzen 972ce74ac6 vkd3d: When using breadcrumbs, consider that WaitSemaphore can be buggy.
Spec says that in device lost, driver must return DEVICE_LOST in finite
time, but this does not happen on NV drivers. Use a long timeout instead
in this scenario.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:07:56 +01:00
Robin Kertels 5f97d1eb70 vkd3d: Implement NV_checkpoint path for breadcrumbs.
Signed-off-by: Robin Kertels <robin.kertels@gmail.com>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:07:56 +01:00
Robin Kertels a6ea442819 vkd3d: Enable VK_NV_device_diagnostic_checkpoints.
Signed-off-by: Robin Kertels <robin.kertels@gmail.com>
2022-03-11 13:07:56 +01:00
Hans-Kristian Arntzen 365dd05557 vkd3d: Add breadcrumbs support.
AMD path for this commit.
Idea is that we can automatically instrument markers with command list
information we can make some sense of in vkd3d-proton.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:07:56 +01:00
Hans-Kristian Arntzen 5017b3723c vkd3d: Enable VK_AMD_device_coherent_memory.
For breadcrumbs support, along with buffer marker.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:07:56 +01:00
Hans-Kristian Arntzen 6a4f2842cb cache: Move d3d12_pipeline_library to internal references.
Allow us to hold internal magic pipeline libraries without creating
cycles.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 12:29:32 +01:00
Hans-Kristian Arntzen 18a5315db4 cache: Refactor lock strategy of internal hashmaps.
Rather than having to take writer lock on serialize calls from the
outside, we should just take locks when accessing the internal hashmaps
instead.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 12:29:32 +01:00
Hans-Kristian Arntzen 7c228139c3 cache: Refactor out pipeline library serialization.
If outer code has taken a reader lock, we don't need to lock again.
Also allows a reader lock to go GetSerializedSize + Serialize with one
reader lock.

This will be relevant for magic cache implementation.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 12:29:32 +01:00
Hans-Kristian Arntzen 30b4abcea1 vkd3d: Do not discard images in Clear*View() unless we have to.
It's redundant to add an UNDEFINED transition here for committed
resources. We need it for sparse and placed resources to handle aliasing
rules, but that's it.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-10 15:14:55 +01:00
Hans-Kristian Arntzen 17b1ffb41a vkd3d: Add path to use GENERAL depth-stencil images.
On some implementations, it doesn't matter for performance what we use,
and we can avoid a lot of ugly barriers this way.

Opt-in to use this extensions on GPUs we know handles it well,
otherwise, keep using the tracking paths.

With VK_KHR_dynamic_rendering, this is now feasible to do since we no longer
have to deal with shenanigans related to VkRenderPass layouts and
complicated compatibility rules.

To make this work with the existing framework, just need to consider
that GENERAL can be a common layout alongside DEPTH_STENCIL_OPTIMAL,
which are both common layouts that do not need to be tracked at all.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-10 15:14:55 +01:00
Hans-Kristian Arntzen f9da3bf564 vkd3d: Add VK_KHR_driver_properties.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-10 15:14:55 +01:00
Hans-Kristian Arntzen c6149b47cd cache: Handle ref-count rules for multiple LoadPipeline/StorePipeline.
In pipeline libraries, the library holds on to private references of the
libraries so that they can be rapidly loaded on-demand.

This behavior is verifed by API tests.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-09 18:35:09 +01:00
Hans-Kristian Arntzen cc08339624 vkd3d: Use internal_refcounts for pipeline state.
When we store pipeline state in libraries we have to manage lifetime a
bit differently, which requires internal refcounts of some sort.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-09 18:35:09 +01:00
Hans-Kristian Arntzen 422f6804fb vkd3d: Enable VK_KHR_create_renderpass2.
Required extension by VK_KHR_fragment_shading_rate and
VK_KHR_separate_depth_stencil_layouts, but we don't care about enabling
any features or use it directly.

Needed to silence validation errors.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-09 16:35:05 +01:00
Georg Lehmann 14a06680d9 vkd3d: Remove unused renderpass remains.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2022-03-08 18:34:18 +01:00
Hans-Kristian Arntzen 409dc57645 vkd3d: Properly decay depth-stencil images.
When performing a decay of a DSV resource, make sure to transition all
subresources, not just the particular aspect being transitioned.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-08 18:11:50 +01:00
Hans-Kristian Arntzen b330900659 vkd3d: Do not transition all aspects for single subresource.
We require separate DS layouts.
Fixes validation errors where we transition from read-only, but our
neighbor aspect might have been optimal.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-08 18:11:50 +01:00
Philip Rebohle 9a408367dc vkd3d: Remove render pass cache.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle 51e6b2bbbe vkd3d: Remove render pass from command list state.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle 94f82d1085 vkd3d: Get rid of pipeline variant flags.
These only existed for VRS attachment, which is no longer
necessary with VK_KHR_dynamic_rendering.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle 1a68267962 vkd3d: Remove framebuffer list from d3d12_command_allocator.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle c4f88951fc vkd3d: Use dynamic rendering for regular draw calls.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle 9673ac173d vkd3d: Use dynamic rendering for pipeline creation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle 3783eaf4f7 vkd3d: Implement swap chain blits using dynamic rendering.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00
Philip Rebohle 024ef02f9b vkd3d: Implement meta image copies using dynamic rendering.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-08 17:44:47 +01:00