Commit Graph

738 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen c0856f3702 idl: Fix const correctness of UpdateTileMappings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-14 12:20:06 +02:00
Hans-Kristian Arntzen c3036fa85c vkd3d: Demote patching logs to TRACE.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-14 11:48:33 +02:00
Hans-Kristian Arntzen 24de683375 vkd3d: Use index type LUT.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-10 15:36:18 +02:00
Hans-Kristian Arntzen d23f5f4343 vkd3d: Attempt to reuse application indirect command buffer.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-10 14:51:37 +02:00
Hans-Kristian Arntzen 538c3c1f19 vkd3d: Attempt to pack indirect command buffer tighter if we can.
If implementation reports 4 alignment on offset, it must be able to
handle 4 byte offset on VAs.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-10 14:51:37 +02:00
Hans-Kristian Arntzen e497e56aa1 vkd3d: Don't synchronize against PREPROCESS stages.
They are implied when using isPreprocessed = VK_FALSE.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-09 15:28:16 +02:00
Hans-Kristian Arntzen 6ac298929d vkd3d: Take memory requirement for preprocess buffer into account.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-08 12:34:01 +02:00
Hans-Kristian Arntzen d7567cbb97 vkd3d: Do patch barrier after ending render pass.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen eb1e3ae656 debug: Add concept of implicit instance index to debug ring.
For internal debug shaders, it is helpful to ensure in-order logs when
sorted for later inspection.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 8140b26c93 vkd3d: Encode in detail which commands we're emitting in template.
Feed this back to debug ring for less cryptic logs.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 4aeca16468 vkd3d: Refactor out patch command token enum.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen caa9b0ae24 vkd3d: Add workaround for forced clearing of certain buffers.
If game uses NOT_ZEROED, it might still rely on buffers being properly
cleared to 0.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 458391e794 vkd3d: Trace breadcrumbs for execute indirect templates.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 186b45a61f vkd3d: Pass down required memory types to scratch allocators.
Separate scratch pools by their intended usage. Allows e.g. preprocess buffers to be
allocated differently from normal buffers. Potentially can also allow
for separate pools for host visible scratch memory etc down the line.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 124768c1d6 vkd3d: Optimize ExecuteIndirect() if no INDIRECT transitions happened.
The D3D12 docs outline this as an implementation detail explicitly, so
we should do the same thing.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 4a507c3a2b vkd3d: Ignore unsupported execute indirect calls.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 59b75b5b1d vkd3d: Implement some advanced use cases of ExecuteIndirect.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 1f1b6c0093 vkd3d: Add helper to invalidate all state.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen f46d175935 vkd3d: Refactor index buffer state to be flushed late.
With ExecuteIndirect state we'll need to modify or refresh index buffer
state.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 102e2dac3a vkd3d: Add more stringent validation for CreateCommandSignature.
The runtime is specified to validate certain things.
Also, be more robust against unsupported command signatures, since we
might need to draw/dispatch at an offset. Avoids hard GPU crashes.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:53:25 +02:00
Hans-Kristian Arntzen 467db76f90 vkd3d: Remove obsolete COLOR -> COMPUTE workaround for Deathloop.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-05-31 15:59:35 +02:00
Robin Kertels cdabda7805 vkd3d: Implement indirect ray tracing.
Signed-off-by: Robin Kertels <robin.kertels@gmail.com>
2022-05-11 19:11:01 +02:00
Hans-Kristian Arntzen 71940797d1 vkd3d: Check for redundant dynamic state in some cases.
Some dynamic state is at risk of being spammed with same arguments many
times. For the dynamic state that is trivial to check, do so.

Ghostwire: Tokyo has been observed to spam the same OMSetStencilRef
value causing some context rolls, also RSSetShadingRate has been set
redundantly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-05-03 16:30:42 +02:00
Philip Rebohle beaedbd857 vkd3d: Use UAV clear fallback based on format compatibility.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-04-21 13:51:58 +02:00
Philip Rebohle 81927c5895 vkd3d: Fix handling of non-zero base layer in ClearUAV fallback path.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-04-21 13:51:58 +02:00
Philip Rebohle e7a6af4971 vkd3d: Use texel buffer views for UAV clears with buffer to image copy.
Allows this to more easily work with more formats.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-04-21 13:51:58 +02:00
Philip Rebohle e4184830c5 vkd3d: Add ClearUAV path that uses buffer-to-image copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-04-05 11:52:23 +02:00
Philip Rebohle d1425ee4d1 vkd3d: Use VK_ACCESS_MEMORY_{READ,WRITE}_BIT where appropriate
Buggy RADV versions no longer work due to missing extension support.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-04-05 11:52:23 +02:00
Hans-Kristian Arntzen 6f43f450c8 vkd3d: Disable primitive restart when using non-compatible topologies.
Primitive restart is only used for strip primitive types, and must be
ignored for lists. Use and require extended_dynamic_state2 for this
purpose.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-30 16:12:16 +02:00
Hans-Kristian Arntzen da63f0beac vkd3d: Compute range_end after sparse checks in copy tracking.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-30 12:13:25 +02:00
Philip Rebohle 6378f1b880 vkd3d: Optimize WriteBufferImmediate for consecutive writes.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-30 11:51:10 +02:00
Hans-Kristian Arntzen 2e8fb27182 vkd3d: Correctly handle dynamic depth/stencil attachment infos.
{depth,stencil}AttachmentFormat and p{Depth,Stencil}Attachment are only
allowed if the format contains that aspect. Check this explicitly.

Fixes some validation errors.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-24 17:55:32 +01:00
Hans-Kristian Arntzen 1b5f7e8fc3 vkd3d: Use VkImageViewCreateInfo correctly.
For EXTENDED_USAGE, we still need to restrict image usage when creating
concrete views.
Use VkImageViewUsageCreateInfo to restrict usage flags to the kind of
view we're creating.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-24 17:55:32 +01:00
Hans-Kristian Arntzen cf65a78570 vkd3d: Rename DSV UNKNOWN workaround query.
Make it more obvious what it's really trying to check.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-23 22:36:00 +01:00
Philip Rebohle 1d3957fe6d vkd3d: Do not create pipeline variants for NULL DSV.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-23 22:22:09 +01:00
Hans-Kristian Arntzen 6e915dd2c0 vkd3d: Use rt_count as basis for binding RTVs.
Found some validation errors where rt_count != rtv_active_mask,
and blending used rt_count instead of rtv_active_mask. If shader renders
to a NULL attachment, we must make sure that it's part of the PSO
interface.

Also, use rt_count rather than active mask when beginning render pass.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-23 14:29:51 +01:00
Philip Rebohle 34f5fc6a31 vkd3d: Do not create pipeline variants for NULL RTVs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2022-03-22 13:06:00 +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 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 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 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
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 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 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