Commit Graph

1331 Commits

Author SHA1 Message Date
Krzysztof Bogacki 61b13cc278 build: Use separate version string and build hash
Version string is used in logging for information purposes, but pipelines blobs and libraries use uint64_t–based commit hash. Using fixed–size integer silences warnings about string length and makes storing build info a little more efficient.

The hash is obtained separately from version string and is shifted to the left by 4 bits if the working tree is dirty.

Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2020-10-28 10:40:28 +01:00
Philip Rebohle 49d3fa30a7 vkd3d: Enable offset buffer as necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 127b498a5a vkd3d: Adjust SSBO descriptors based on alignment requirements.
And write data to the offset buffer.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 374adc8bb7 vkd3d: Account for buffer offset info in clear_uav.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle b57a5dd96d vkd3d: Add extra binding for SSBO offset buffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 811235858c vkd3d: Allocate descriptor heap buffer storage for bound SSBO ranges.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 7aaae61c64 vkd3d: Refactor descriptor heap buffer creation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 15b1fb7128 vkd3d: Restore d3d12_device_use_ssbo_root_descriptors.
We will not have offset information for root descriptors, so
we can still only use them with four-byte aligned SSBOs.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Krzysztof Bogacki f7cca758a6 vkd3d: Bit–shift last argument of MAKE_MAGIC
Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2020-10-27 19:52:57 +01:00
Philip Rebohle dd13d44bd5 vkd3d: Use UAV counter address binding from descriptor heap.
Instead of binding it via push descriptors at draw time.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-23 12:36:17 +02:00
Philip Rebohle a76e311c5e vkd3d: Add UAV counter address buffer to descriptor heap bindings.
Introduces 'extra' bindings to bindless sets which can be used to
bind additional storage buffers to the pipeline, which will occur
before the bindless descriptor array in the descriptor set.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-23 12:36:17 +02:00
Philip Rebohle 7e32f833ed vkd3d: Store binding index in descriptor.
Needed for when we add additional descriptors to the bindless
descriptor sets.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-23 12:36:17 +02:00
Hans-Kristian Arntzen 16f09a0ba0 vkd3d: Do not perform any alignment analysis for SSBOs.
We cannot rely on alignment analysis since games are buggy and screw up
RAW vs structured on occasion.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-22 13:07:05 +02:00
Joshua Ashton ae93fe0941 vkd3d: Remove VKD3D_RESOURCE_PUBLIC_FLAGS
There was no reason to mask this anyway when importing images.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-22 09:30:24 +02:00
Joshua Ashton 4fb3e277f1 vkd3d: Remove VKD3D_RESOURCE_PRESENT_STATE_TRANSITION
All this flag does is make resource creation fail.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-22 09:30:24 +02:00
Hans-Kristian Arntzen eed4f54a80 vkd3d: Enable SSBO path.
For now, don't enable it on NV due to a very likely driver bug.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-21 14:34:37 +02:00
Philip Rebohle f9c712ded0 vkd3d: Fix descriptor layout mismatch for ClearUAV.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 17:38:58 +02:00
Philip Rebohle 544a6184e9 vkd3d: Enable raw SSBOs for root descriptors on supported hardware.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 16:20:26 +02:00
Philip Rebohle 4841630876 vkd3d: Store descriptor type with root descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 16:20:26 +02:00
Hans-Kristian Arntzen 1c76072819 vkd3d: Use EXTENDED_USAGE_BIT on mutable format images.
If the image itself is sRGB or some other format that does not support
STORAGE, we need this flag.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 5b44ffa831 swapchain: Fix warnings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 69f54ae049 swapchain: Handle maxImageExtent of 0.
This can happen on Windows when windows are minimized.
Might not happen in winevulkan, but Vulkan spec outlines this Win32 case
explicitly and it happens on native Windows.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 65031753ae swapchain: Blit to screen with render pass.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 09b0675b53 swapchain: Handle VK_SUBOPTIMAL_KHR.
It is considered a "success", in that fences must be signalled, so make
sure we wait and reset it so we don't risk calling vkAcquireNextImageKHR
later with an already signalled fence.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 9b25141bb8 swapchain: Only support user images.
Only way to implement a D3D12 swapchain.
For now, disable compute paths, we'll introduce it properly after refactor.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 4f0bc383b7 swapchain: Make use of initial image transition.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen d7e9713c4c vkd3d: Add external API to perform initial transition.
Relevant for swapchain since a swapchain resource can be presented right
away without ever having been touched by an API call.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen a8ef7384b4 vkd3d: Remove support for obsolete PRESENT_STATE_TRANSITION.
It is broken by design and won't be needed by a swapchain
implementation which uses user buffers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Philip Rebohle 677e55c6f9 vkd3d: Store UAV counter address in d3d12_desc.
May improve performance since the UAV counter buffer is
stored in uncached memory.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 991d40006b vkd3d: Fix maximum workgroup count for clearing buffer UAVs.
Buffer views do not necessarily cover the entire resource, so we
should not spawn more workgroups than necessary to clear the view.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 6401cc353e vkd3d: Support raw buffer views in ClearUnorderedAccessView*.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 3e1445eacb vkd3d: Add meta pipeline to clear raw storage buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 290f44254a vkd3d: Implement descriptor updates for SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 993cdd254e vkd3d: Emit resource declarations for raw SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 3eac9f9c7d vkd3d: Introduce vkd3d_bindless_set_flag.
This will allow us to use the same bindless descriptor set for
different types of descriptor ranges.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle c097c00167 vkd3d: Explicitly set descriptor types for bindless sets.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle d3abc66399 vkd3d: Do not store UAV counter info in vkd3d_view.
We won't necessarily have a view once we support raw SSBOs.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 07e6687f6a vkd3d: Rework descriptor set lookup.
This is no longer performance-critical, so in order to simplify changing
the binding model, remove hard-coded descriptor set numbers and instead
look them up based on the requested descriptor properties.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle bffadd1f23 vkd3d: Rename vk_cbv_info -> buffer.
This will no longer be exclusive to constant buffer views.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle b82bbe265e vkd3d: Pass storage buffer alignment to shader compiler.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Hans-Kristian Arntzen 3a4e555e9c vkd3d: Track if we have a valid index buffer bound.
Ignore any indexed draw calls which uses a NULL index buffer.
This is not fully correct, but there is no easy way to emulate D3D12
behavior exactly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 12:27:20 +02:00
Hans-Kristian Arntzen f1818c267f vkd3d: Fix menu regression in RE2.
If rendering to A8 format, do not apply output swizzle in non-PS stages.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-14 10:46:46 +02:00
Hans-Kristian Arntzen f0f1ca161f vkd3d: Always pass down compiler args.
Needed for all stages since typed UAV read can happen in all stages.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 14:55:24 +02:00
Hans-Kristian Arntzen 202a3257d7 vkd3d: Make use of StorageImageReadWithoutFormat if supported.
Death Stranding makes use of typed load from RGB10A2.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 14:55:24 +02:00
Hans-Kristian Arntzen af5a4cf311 vkd3d: Use a unique cookie per resource/view.
We cannot compare resource pointers or view pointers,
since the pointers might have been recycled.
This leads to a scenario where we're not updating descriptors we're
supposed to, and the GPU reads a stale descriptor.

Fixes a GPU hang in Death Stranding (and possibly lots of other weird
crashes as well).

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 12:46:07 +02:00
Hans-Kristian Arntzen 4dff80661a vkd3d: Rewrite initial resource state tracking.
For correctness, we will need to defer any initial resource state
handling to the queue timeline. Here, we will build an UNDEFINED ->
common layout barrier if (and only if):

- The resource is marked to care about initial layout transition.
- We are the first queue thread to observe that initial_transition
  member is 1 (atomic exchange).
- The first use of the resource was not marked to be a discard.
  E.g., if the first use of the resource is an alias barrier, we must
  not emit an early barrier. The only we should do here is to clear the
  initial_transition member, and leave it like that.

A command list maintains a list of d3d12_resources which *might* need a
transition. For the first frame a resource is used (or so), it will not
have the flag cleared yet, so multiple command lists might add the
d3d12_resource to its own transition list. This is fine, as the queue
will resolve it.

If multiple queues see the same initial transition, there might be
shenanigans, but the application must ensure there is either a
submission boundary or fence boundary between the uses. Any initial
layout transition will only be submitted after a Wait() is observed, as
submission of the transition command buffer will be in-order with other
submissions.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-08 14:30:50 +02:00
Hans-Kristian Arntzen 6d2f540a40 vkd3d: Transition from UNDEFINED if a copy command writes everything.
An optimization and a requirement in D3D12. Clearing out an image
through a copy is considered enough to satisfy the requirement to acquire an
alias in the advanced usage model.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-08 14:30:50 +02:00
Hans-Kristian Arntzen 9c04f35757 vkd3d: Fix validation error when render pass is used without attachment.
Just drop the VkSubpassDependency in this case to satisfy the validator,
since stages == 0 is not allowed.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-07 17:43:53 +02:00
Hans-Kristian Arntzen 89235b7bc0 meta: Implement meta for swapchain pipelines.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen 97d8568f88 meta: Add vert/frag shaders for fullscreen swapchain pass.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00