Commit Graph

2860 Commits

Author SHA1 Message Date
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 6461ab8272 vkd3d-shader: Implement bufinfo instruction on SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 89dbd9254f vkd3d-shader: Implement atomic operations on SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle f12f15ff38 vkd3d-shader: Implement raw and structured stores to SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 2d2dc323d5 vkd3d-shader: Implement raw and structured loads from SSBOs. 2020-10-16 14:24:36 +02:00
Philip Rebohle 367cda017f vkd3d-shader: Implement resource declarations with raw SSBOs.
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 9a8d2a1ac5 tests: Add a test for rendering with NULL index buffer.
This is well-defined in D3D12 for some reason.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 12:27:20 +02:00
Hans-Kristian Arntzen de3f572c8b tests: Add test for bindless bufinfo/resinfo.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 11:43:35 +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 85dbb6c569 vkd3d-shader: Support StorageImageReadWithoutFormat.
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 3f1132ee8c vkd3d: Add support for InterlockedIncrement64.
To be used for cookies. Works on 32-bit as well, compiler emits 8b CAS loop
for us.

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
Hans-Kristian Arntzen d626a0bde9 meta: Add custom vertex shaders to vkd3d_meta_create_graphics_pipeline.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen c59a6abfbd meta: Introduce vkd3d_meta_create_sampler.
Will be used for immutable samplers for scalers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen 44977b63b2 vkd3d: Move vkd3d_view_key to private header.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen 70af36a6e2 swapchain: Actually use matching mode when going fullscreen.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-05 19:53:05 +02:00
Hans-Kristian Arntzen d02d95f606 swapchain: Workaround weird behavior with FindClosestMatchingMode.
Use a default format if there is no format specified.
Otherwise, the call fails on both Wine and DXVK DXGIs.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-05 19:53:05 +02:00
Hans-Kristian Arntzen 624e42f742 swapchain: Add thread safety.
IDXGISwapchain should be thread safe, doesn't cost much to add it.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-05 19:53:05 +02:00
Joshua Ashton f5b2f45f13 vkd3d: Use already existing format for sparse multi-planar test
This was wrong anyway as it assumed depth always.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:50:28 +02:00
Joshua Ashton eee64787c7 vkd3d: Keep track of vkd3d_format for resources
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:50:28 +02:00
Joshua Ashton a991fddeeb build: Use `-fvisibility=hidden` and define exports manually
When building natively on Windows we use dllexport/dllimport for vkd3d/vkd3d_utils public exports.

When building natively on Linux we simply make those visibility default.

Nothing changes for standalone here.

Closes #152

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:44:10 +02:00
Joshua Ashton be2c0c1f1e include: Remove DECLSPEC_HIDDEN from headers
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:44:10 +02:00
Joshua Ashton e09f129064 vkd3d: Use enum for VKD3D_META_COPY_MODE
Just some extra type-safety.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 13:00:32 +02:00
Joshua Ashton 2d3df0838a vkd3d: Use generated shaders
Now we don't have the autotools path, we can use what we make now.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 13:00:32 +02:00
Joshua Ashton fa60742114 build: Remove autotools build path
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 13:00:32 +02:00
Joshua Ashton 3c54cf8ad6 vkd3d: Use VK_NULL_HANDLE instead of NULL for VkPipelineCache
Fixes a warning in MSVC.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 01:44:50 +02:00
Philip Rebohle 759e21d821 vkd3d: Remove d3d12_descriptor_heap_set_index_from_magic.
Unused, should have been in previous commit. Whoops.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 15:15:49 +02:00
Hans-Kristian Arntzen 2572b370d5 README: Add docs for shader logging.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-29 15:00:36 +02:00
Hans-Kristian Arntzen 9d36ab59d6 vkd3d: Add support for a shader debug ring.
Will allow replaced shaders to emit debug messages to a buffer.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-29 15:00:36 +02:00
Philip Rebohle 29fe4da015 vkd3d: Remove unused fields from d3d12_desc.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 0450ae9f85 vkd3d: Introduce VKD3D_DESCRIPTOR_FLAG_VIEW.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle eb0ada76e8 vkd3d: Remove unused code for descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 3682e4d9f7 vkd3d: Rework UAV descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 3177d80814 vkd3d: Rework SRV descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00