Commit Graph

1331 Commits

Author SHA1 Message Date
Philip Rebohle c3d5a60e01 vkd3d: Implement DiscardResource.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle ef2eacefee vkd3d: Rework d3d12_command_list_find_attachment.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle 37e7fbd5c5 vkd3d: Rework d3d12_get_view_rect.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle b212b3fb9c vkd3d: Introduce d3d12_resource_get_vk_subresource.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle def7cf409a vkd3d: Introduce discard mask for deferred clear operations.
Allows us to skip clears while still initializing the image.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Hans-Kristian Arntzen 96402f1164 vkd3d: Fix straggling warnings for MSVC.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-16 13:00:09 +02:00
Hans-Kristian Arntzen dd6656fbe9 vkd3d: Avoid redundant pipeline binds.
When we're using extended dynamic state, we will often end up with dummy
pipeline binds, which we should try to avoid if we can.
Also avoids having to rebind dynamic state redundantly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 84d9e4b0db vkd3d: Emit vertex buffer sizes even when not using dynamic stride.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 0f91099dd4 vkd3d: Refactor dynamic state to be per-pipeline.
Cleans up dynamic state such that we do not have to keep dynamic state
create infos around.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 69fdd87aa0 vkd3d: Add more debug logging when we fall back.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen d8ba75e160 vkd3d: Use strip type by default when using primitive restart.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 0e9a1555c1 vkd3d: Add dynamic state information to vkd3d_pipeline_key.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen e9dcdc1308 vkd3d: Move vkd3d_pipeline_key to private header.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 5968d28e75 vkd3d: Refactor out dynamic stride checks to its own function.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 10d6823e34 vkd3d: Do not attempt to create a pipeline with invalid DS format.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 2e57b3d27e vkd3d: Do not attempt to create pipelines with unknown topology type.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 6967576904 vkd3d: Statically deduce patch vertex count for HS.
Fall back when there is a mismatch, which can happen if application does
not declare inputs to hull shader (unlikely).

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 084a3e6928 vkd3d: Validate minimum vertex buffer stride when using dynamic stride.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 5ef3ebce61 vkd3d: Implement extended dynamic state.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 7139621c3f vkd3d: Add conversion for topology type to Vulkan.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 85f8a6ac7c vkd3d: Add helper to check if topology type can use primitive restart.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 551bc54546 vkd3d: Add topology type to pipeline state.
Needed to build dynamic pipeline.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen fc0a94ad04 vkd3d: Add a common pipeline for graphics pipeline state.
When using EXT_extended_dynamic_state, we will be able to compile a
master pipeline. Only in special cases will we have to fallback.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen b52a9c46bd vkd3d: Refactor graphics pipeline creation out to separate function.
Preparation for extended dynamic state refactor.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 926f2033a9 vkd3d: Enable VK_EXT_extended_dynamic_state.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 9425b4d438 vkd3d: Bump VKD3D_MAX_DESCRIPTORS_SETS to 9.
This can happen in the worst case where we have all bindless sets, and:

- Static samplers
- Packed descriptors (UAV counters on drivers without support for this)
- Root descriptors

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 10:08:38 +02:00
Philip Rebohle 15106808f9 vkd3d: Implement IDXGISwapChain4.
SetHDRMetaData implementation taken from DXVK.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-13 10:25:51 +02:00
Philip Rebohle 90d44eeac5 vkd3d: Make swap chain implementation more easily extensible.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-13 10:25:51 +02:00
Biswapriyo Nath 41b0f5a96c vkd3d: remove redeclaration of IWineDXGISwapChainFactory
IWineDXGISwapChainFactory will be in header from vkd3d_swapchain_factory.idl

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
2020-07-11 20:33:59 +02:00
Hans-Kristian Arntzen 7bccab7427 debug: Re-introduce different debug channels.
vkd3d-shader is currently kinda buggy and crashes when you try to trace
DXBC. This used to never be run since it was guarded by
VKD3D_SHADER_DEBUG, but with the move to a static build we merged all
debug logging under VKD3D_DEBUG. Reintroduce different debug channels in
a way that is compatible with a statically linked vkd3d.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-10 14:18:15 +02:00
Hans-Kristian Arntzen 854814d81c vkd3d: Fix various minor warnings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-10 14:18:15 +02:00
Hans-Kristian Arntzen 337f75b76a vkd3d: Workaround broken MEMORY_READ/WRITE on RADV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-09 14:50:50 +02:00
Hans-Kristian Arntzen 1341409b88 vkd3d: Implement aliasing barriers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-09 14:50:50 +02:00
Philip Rebohle fee4781f2b vkd3d: Fix suspended render pass state tracking.
Otherwise, if a render pass gets suspended twice in a row, we
never emit the barrier because render_pass_suspended will be
set to false the second time.

Fixes validation errors in Hitman 2.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-08 17:31:58 +02:00
Joshua Ashton 9625096577 vkd3d: Correctly handle output + fix NULL old targets for fullscreen
The output here is actually for secure presentation and restricting a swapchain to a certain output.

Correctly handle NULL (desktop) targets that we used to have.

Fixes crashes with titles that use fullscreen via an initial fullscreen desc.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-07 01:42:34 +02:00
Hans-Kristian Arntzen cb1da02af9 vkd3d: Fix some warnings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-06 21:32:16 +02:00
Joshua Ashton 7204c8d76f d3d12: Add standalone d3d12 library
When building for Windows, specify `-Denable_standalone_d3d12=True` in Meson to enable.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Joshua Ashton aa3b7c3b26 vkd3d: Use newer ID3D12Device funcs for COM
Fixes warnings under MSVC and MinGW.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Joshua Ashton 9c105a78a9 vkd3d: Implement swapchain and swapchain factory
Needed for standalone D3D12.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Joshua Ashton e24914b11f include: Pull in Win32 Vulkan exts when building for Win32
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Joshua Ashton dff27c9e9c vkd3d: Load INSTANCE_EXT procs into device table
We need these for the upcoming swapchain factory implementation
for standalone D3D12.

They're also probably good to have around in future for the
d3d12 device.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Joshua Ashton ba3dabe3bb vkd3d: Add debug_dxgi_format helper
DXGI_FORMAT -> string

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Hans-Kristian Arntzen d6b6da6206 Revert "vkd3d: Add support for serializing root signature version 1.1"
This reverts commit 0384362065.

It is not allowed to use RS 1.1 serialization for the non-versioned
entry point. RS 1.1 serialization must use the versioned entry point.

Reverting this fixes the relevant test case in d3d12.c:12522.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-06 17:41:03 +01:00
Joshua Ashton 08544fb938 vkd3d: Use CONST_VTBL instead of const for vtable decls
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 16:56:10 +02:00
Joshua Ashton 0384362065 vkd3d: Add support for serializing root signature version 1.1
Make this code more extensible too...

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-01 19:46:09 +02:00
Philip Rebohle ee949c0916 vkd3d: Avoid UAV counter address updates for non-UAV descriptors.
Saves a few CPU cycles. We expect things to explode anyway when
the app uses a non-UAV descriptor as a UAV in the shader.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle d524b770bc vkd3d: Do not create view for NULL UAV descriptors if possible.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle e50b707709 vkd3d: Do not create view for NULL SRV descriptors if possible.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle e10b9a72e2 vkd3d: Handle views being null in non-bindless descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle 3434c4ef6f vkd3d: Handle views being null in bindless descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle c8e97a581d vkd3d: Use NULL descriptors for constant buffer views.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle fbbcb30590 vkd3d: Use NULL descriptors for vertex buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle 87bf1e8937 vkd3d: Use NULL descriptors for undefined root descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle d43f70bb1b vkd3d: Enable VK_EXT_robustness2 if available.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Joshua Ashton d70223e57d vkd3d: Cast down tile extents in offsets explicitly
Fixes a signedness comparison warning -- shouldn't be a problem as we aren't going to get images with 2m+ tiles.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-27 15:23:09 +02:00
Joshua Ashton 5f4c383c1a vkd3d: Remove _spv suffix from prebuilt shaders
Matches what we build from glslang in Meson now.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-25 13:51:06 +02:00
Joshua Ashton f3f0887c43 vkd3d: Compile glsl shaders at compile time
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-25 13:51:06 +02:00
Joshua Ashton 61dcb5d0dd vkd3d: Move shader contents out of header
This way we can use a glsl generator on them in future in Meson.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-25 13:51:06 +02:00
Joshua Ashton a46fb17973 vkd3d: Make enqueued_fence_count a uint32_t
Fixes atomic usage with it.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 45d4296a54 vkd3d: Rename vkd3d_uint32_atomic to vkd3d_atomic_uint32
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 033f76e3ae vkd3d: Define our own memory orders
We shouldn't potentially override stuff in the std library and this allows us to map directly to __ATOMIC_* memory orders which is more correct.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 4521b253dd vkd3d: Toss VKD3D_DEBUG_ENV_NAME
Creates linking problems if we want to build vkd3d-shader statically given this links back to something in vkd3d-common.

We don't need this distinction anyways...

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 15:18:56 +02:00
Hans-Kristian Arntzen 24be81fdfb vkd3d/meta: Initialize flags variable.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-24 12:43:19 +02:00
Joshua Ashton 8c216e637c build: Add Meson build system
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-23 14:55:43 +02:00
Joshua Ashton 287ceb207d vkd3d: Refactor platform-specific code
This commit moves the module handling code which was previously dumped in device.c and the code to retrieve the current executable path to its own file.

This also eliminates HAVE_DECL_PROGRAM_INVOCATION_NAME from config.h

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-16 11:07:50 +02:00
Joshua Ashton f3ec53cb5d vkd3d: Implement vkd3d_get_program_name for Win32
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-16 11:07:50 +02:00
Hans-Kristian Arntzen 349412f19f vkd3d: Support rewinding ID3D12Fence.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-16 11:00:08 +02:00
Hans-Kristian Arntzen 5ef7b99e0b vkd3d: Fix uninitialized return value in CPU fence signaling.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-16 11:00:08 +02:00
Joshua Ashton f3c85328f1 vkd3d: Remove PACKAGE_NAME usage for engine version
This isn't going to change. Drivers use this to do special things,
so changing it would probably cause a bunch of random problems anyway.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-15 21:45:35 +02:00
Joshua Ashton cd5d01d25c vkd3d: Refactor atomics
There is no stdatomic available on MSVC so let's clean things up.

This moves all the atomic helpers to vkd3d_atomic.h and implements all platform's spinlocks in entirely the same way.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-15 20:40:10 +02:00
Joshua Ashton b9909854fe vkd3d: Make nameless unions really nameless
This makes it consistent across tests and vkd3d.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-15 19:59:52 +02:00
Hans-Kristian Arntzen cbdf6f88d2 vkd3d: Remove dependency on linking directly against libvulkan.
There is no reason to not load Vulkan dynamically, otherwise, we must
have loader dev packages installed, which is not ideal.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-15 15:47:18 +02:00
Hans-Kristian Arntzen 9defd87f95 vkd3d: Implement BeginEvent/EndEvent.
Only support ANSI/UNICODE version for now. The PIX3BLOB format is
extremely weird, complicated and undocumented.
We can refer to RenderDoc if we need it later ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen cae30f8602 utils: Add a max_elements parameter to wchar conversion.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen 9534c1a345 vkd3d: Move to VK_EXT_debug_utils.
debug_marker/debug_report are both deprecated in favor of debug_utils and vkd3d was using marker in a
buggy way anways, as debug_marker requires debug_report to work, but it was
only conditionally enabled.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen 6a038003e2 vkd3d: Always enable instance debug extension.
Prepare for moving to VK_EXT_debug_utils.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen 726356ebb1 vkd3d: Always use PDF2/PDP2 without KHR extensions.
It is core in Vulkan 1.1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen d8ca2cef6d vkd3d: Serialize all queue submissions.
Gets rid of the full barrier on command buffer end.
Instead, do what D3D12 wants, which is to serialize all
ExecuteCommandLists. Simplify the existing timeline sempahore setup for
sparse queues and use it for all submissions.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-09 14:28:13 +02:00
Philip Rebohle 1fa3686638 vkd3d: Use ALLOW_ONLY_BUFFERS for committed buffer resources.
Otherwise, we may end up failing to allocate memory on Tier 1
hardware, and also fail to use dedicated allocations in some
cases.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle d49f47dbc2 vkd3d: Validate heap flags for placed resources.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle eda59ea66c vkd3d: Remove vkd3d_select_memory_type.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle 2b88df93a2 vkd3d: Use new memory allocation code in d3d12_resource_bind_sparse_metadata.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle 5bf492c207 vkd3d: Rework vkd3d_allocate_device_memory.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle 95716029a8 vkd3d: Use new memory allocation code in vkd3d_allocate_image_memory.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle 615e933db6 vkd3d: Use new memory allocation code in vkd3d_allocate_buffer_memory.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle 43e2c3ffe6 vkd3d: Add new memory allocation helpers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle 8ced3b53b9 vkd3d: Expose D3D12_RESOURCE_HEAP_TIER_1 based on hardware capabilities.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle bbcaeee69d vkd3d: Determine compatible memory types for different resource types.
We'll need this to more accurately select the memory type for D3D12
heaps based on which resources are allowed to be placed in it.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-08 15:09:21 +02:00
Philip Rebohle e6857939e7 vkd3d: Do not enable VK_KHR_dedicated_allocation.
Core in 1.1.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-02 16:23:38 +02:00
Philip Rebohle 45109686be vkd3d: Do not enable VK_KHR_maintenance3.
Core in 1.1.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-02 16:23:38 +02:00
Philip Rebohle 317868ab2b vkd3d: Remove required extensions.
Both of these are core in 1.1.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-02 16:23:38 +02:00
Philip Rebohle 9852b1702d vkd3d: Require Vulkan 1.1 device.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-02 16:23:38 +02:00
Philip Rebohle 3880e61be2 vkd3d: Require Vulkan 1.1 instance.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-02 16:23:38 +02:00
Hans-Kristian Arntzen 9875d65d35 vkd3d: Apply heap offsets for ExecuteIndirect buffers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-05-29 13:03:32 +02:00
Philip Rebohle 1ade8c0cc5 vkd3d: Issue full barrier at the end of command lists.
D3D12 apparently does this implicitly. Fixes rendering issues in
the AMD COCOA demo on Polaris with RADV, which does not emit a
barrier between the AO compute passes and the tone mapping pass
in the next command buffer.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-27 14:59:21 +02:00
Hans-Kristian Arntzen 7e229213f5 vkd3d: Enable SM 6.2 features.
Need float16_int8 and subgroup with extended types to implement new SM
6.2 features. For now, skip over SM 6.1 features until someone makes use
of them.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-05-27 14:33:24 +02:00
Philip Rebohle 50a9fae263 vkd3d: Silence SetMarker/BeginEvent/EndEvent log spam.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:27:02 +02:00
Philip Rebohle 6707f3fc30 vkd3d: Invalidate descriptor heaps on root signature change.
Apparently we need to do this if the push constant layout changes.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:27:02 +02:00
Philip Rebohle c75bbb9997 vkd3d: Handle null root descriptors.
We should hook this up to the robustness2 feature at some point,
but for now, just use the dummy descriptors. Fixes a crash in
the AMD CACAO demo.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:27:02 +02:00
Philip Rebohle e99d92bef9 vkd3d: Expose Tiled Resources Tier 2.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:13:30 +02:00
Philip Rebohle 7e02541003 vkd3d: Implement sampler reduction modes.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:13:30 +02:00
Philip Rebohle 6cbf61ca92 vkd3d: Enable VK_EXT_sampler_filter_minmax if available.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:13:30 +02:00
Philip Rebohle 8588b46900 vkd3d: Implement d3d12_command_list_CopyTiles.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-08 16:30:54 +02:00
Philip Rebohle 347f0e8b92 vkd3d: Fix d3d12_resource_init_sparse_info for images without mip tail.
StartTileIndexInOverallResource can be 0 for images that have either
no mip tail or no standard mips, so we need to check the packed mip
count.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-08 16:30:54 +02:00
Philip Rebohle 00e956dfac vkd3d: Expose Tiled Resources Tier 1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 2e0ce6a186 vkd3d: Serialize sparse binding calls.
In D3D12, Update/CopyTileMappings are implicitly synchronized with
respect to other commands executing on the same queue, which means:

- Signal and Execute have to wait for previously submitted
  sparse binding operations to complete
- Wait and Execute have to complete before subsequently
  submitted sparse binding operations can execute.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 73bcd3e79d vkd3d: Create semaphores for sparse binding operations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 902ab95ba6 vkd3d: Factor out vkd3d_create_timeline_semaphore.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 8b999c7368 vkd3d: Bind sparse metadata on resource creation if necessary.
Some sparse resource may have a metadata aspect on some drivers,
which needs to be bound before the image can be used in any way.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle e1b75748a2 vkd3d: Implement d3d12_command_queue_CopyTileMappings.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle f56a860bc6 vkd3d: Implement d3d12_command_queue_UpdateTileMappings.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle e3eb3498c2 vkd3d: Implement sparse binding.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 7836c06204 vkd3d: Add dedicated queue for sparse binding if necessary.
This will serve as a fallback if at least one queue family
does not support sparse binding.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 98462ea1ed vkd3d: Implement d3d12_device_GetResourceTiling.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle b08477f325 vkd3d: Store tile mappings and metadata for tiled resources.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle ba712c739c vkd3d: Add d3d12_resource_get_tiling helper.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 1167611ead vkd3d: Ensure sparse resource is supported by the device.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 5eee203559 vkd3d: Add validation for sparse image type and format.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 6793bb7e08 vkd3d: Set sparse resource flags appropriately.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 20b1c4f7b3 vkd3d: Introduce flag for sparse resources.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle fe13c017ea vkd3d: Move is_power_of_two to common header.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 0d74a13bc4 vkd3d: Improve error handling in d3d12_command_queue_init.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-06 14:48:59 +02:00
Philip Rebohle e59d6c4c32 vkd3d: Clean up queue creation and management.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-06 14:48:12 +02:00
Philip Rebohle 8edfa29542 vkd3d: Move vkd3d_queue_family into header.
And get rid of the somewhat redundant VKD3D_QUEUE_MAX_FAMILY_COUNT.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-06 14:48:12 +02:00
Philip Rebohle d386a473c2 vkd3d: Clean up vkd3d_select_queues.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-06 14:48:12 +02:00
Philip Rebohle 90ab915ec0 vkd3d: Implement support for custom border colors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-05 11:39:25 +02:00
Philip Rebohle 42b6ce82f0 vkd3d: Enable VK_EXT_custom_border_color if available.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-05 11:39:25 +02:00
Philip Rebohle 8e7bf8a5c3 vkd3d: Do not use VK_PIPELINE_BIND_POINT_RANGE_SIZE.
These constants were removed in Vulkan 1.2.140 headers.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-05 11:39:25 +02:00
Philip Rebohle 6f517a3788 vkd3d: Fix UpdateTileMappings signature.
Also, formatting.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-30 18:08:25 +02:00
Philip Rebohle 9367fd5ee8 vkd3d: Implement deferred clears.
This allows us to perform clears inside the render pass even if
the render pass hasn't been started at the time of the clear yet.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle 7bfe5d0bb3 vkd3d: Remove d3d12_command_list_clear.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle fe269109ef vkd3d: Reimplement ClearRenderTargetView.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle 1cffdb93f2 vkd3d: Reimplement ClearDepthStencilView.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle 0bd0352073 vkd3d: Introduce d3d12_command_list_clear_attachment helper.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle e6bd3cb305 vkd3d: Don't emit barriers when temporarily suspending render passes.
Fixes performance regressions introduced with the barrier rework.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 16:13:19 +02:00
Philip Rebohle 0061c9e6d7 vkd3d: Define external render pass dependencies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 16:13:19 +02:00
Philip Rebohle d355f03d66 vkd3d: Fix depth-stencil load/store ops.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 16:13:19 +02:00
Philip Rebohle 1b447bd2dd vkd3d: Fix image layouts for swap chain back buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 1eac9936f4 vkd3d: Transition DSV to correct layout.
Now uses the layout from the graphics pipeline.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 0ff0423538 vkd3d: Store DSV layout with graphics pipelines.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle f0570509c1 vkd3d: Fix image layouts for clear operations.
We'll need to revisit this as the current implementation is
not only inefficient but also wrong in quite a few ways.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle ae89f2d639 vkd3d: Fix image layouts for resolve operations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 82032e9e58 vkd3d: Fix image layouts for buffer<->image copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 151f18d9ef vkd3d: Fix image layouts in d3d12_command_list_copy_image.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 8d9d23a9f9 vkd3d: Rework d3d12_command_list_ResourceBarrier.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 5bb613ac07 vkd3d: Use common layout in initial state transitions.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle fc60b6400c vkd3d: Introduce vk_access_and_stage_flags_from_d3d12_resource_state.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 608ef6e605 vkd3d: Emit layout transitions when beginning and ending a render pass.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle edb793b069 vkd3d: Infer current DSV format from DSV descriptor.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle d3128592ca vkd3d: Store RTV and DSV descriptors with command list.
We need access to the resource in order to perform render pass
layout transitions, just the view handle isn't enough.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 8c09ef838a vkd3d: Use common image layout for descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 76b2d2af89 vkd3d: Add layout property to texture views.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 45001e05d4 vkd3d: Introduce d3d12_resource_pick_layout.
Lets us enforce GENERAL layout for linear tiling.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 82d384531e vkd3d: Determine common image layout from bind flags.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle baa0a293e7 vkd3d: Apply heap offset to destination buffer in ResolveQueryData.
Fixes rendering issues in The Talos Principle.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-23 17:26:55 +02:00
Hans-Kristian Arntzen 404cd7270b vkd3d: Fix build on standalone.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-23 12:31:48 +02:00
Hans-Kristian Arntzen 805f92a38c vkd3d: Remove dead transfer buffer code.
Obsoleted after shader copy path.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-23 12:31:48 +02:00
Philip Rebohle bc7b016d79 vkd3d: Set required image usage flags for shader-based copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 5a0ef00d45 vkd3d: Use d3d12_command_list_copy_image for CopyResource as well.
Monster Hunter World uses this to copy between D32 and R32 images.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 889ab3520f vkd3d: Implement shader-based depth <-> color copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 30e1a49f68 vkd3d: Introduce d3d12_command_list_create_framebuffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle aa02ee02ca vkd3d: Create pipelines for shader-based image copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle da95bd6eaa vkd3d: Create common objects for fullscreen GS/VS.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 4923d5ac04 vkd3d: Rename some internal functions.
To avoid confusion with similar functions in state.c.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle e74a48cdc6 vkd3d: Simplify meta operation API a bit.
Passing the main struct to the public functions allows us
to share common data between multiple types of operations.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 082999fd71 vkd3d: Introduce vkd3d_make_shader_stage.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle ed1f146c91 vkd3d: Fix vkd3d_create_shader_module parameter order.
Otherwise, the SPIRV_CODE is useless when using the function directly.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 1cac03c643 vkd3d: Add shaders for shader-based depth <-> color copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle c3170731bf vkd3d: Support CastingFullyTypedFormatSupported.
Look up the typeless format for any given image format, then
look up the corresponding compatibility list. This also fixes
a potential issue with implicit SRGB <-> UNORM compatibility.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 15:18:09 +02:00
Philip Rebohle 65f2e03dd0 vkd3d: Introduce vkd3d_get_typeless_format helper.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 15:18:09 +02:00
Philip Rebohle 9d361c56d6 vkd3d: Rework d3d12_create_sampler.
This now takes a sampler desc like d3d12_create_static_sampler,
and supports border colors if the provided border color matches
any of the supported Vulkan ones.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-21 11:57:14 +02:00
Philip Rebohle 532cb49abb vkd3d: Introduce d3d12_create_static_sampler.
It makes sense to separate this from d3d12_create_sampler since static
samplers and regular samplers differ in border color support.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-21 11:57:14 +02:00
Philip Rebohle 73410939da vkd3d: Remove NULL sampler.
Not used anywhere.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-21 11:57:14 +02:00
Sveinar Søpler c2e79af6a1 vkd3d: Fix 32-bit compiler warnings
This fixes a couple of 32-bit compiler warnings.

Signed-off-by: Sveinar Søpler <cybermax@dexter.no>
2020-04-21 11:54:59 +02:00
Philip Rebohle fcc9346e8d vkd3d: Clean up unnecessary members from d3d12_heap and d3d12_resource.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-17 17:08:13 +02:00
Philip Rebohle 6643ab45b5 vkd3d: Persistently map heaps on host-visible memory.
And zero-initialize mapped memory allocations, which seems to
fix some font corruption occationaly seen in Resident Evil 2.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-17 17:08:13 +02:00
Philip Rebohle 4ed642f5e6 vkd3d: Clean up heap initialization and destruction.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-17 17:08:13 +02:00
Hans-Kristian Arntzen 98f78f039f vkd3d: Fix linking error in vkd3d-standalone.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 17:03:40 +02:00
Hans-Kristian Arntzen ca7c027cd1 vkd3d: Replace dummy atomic_fetch_add with atomic loads.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 15:46:09 +02:00
Philip Rebohle 64bd4f6404 vkd3d: Add VKD3D_FEATURE_LEVEL override.
Unblocks some games that request Feature Level 12.0, such as
Anno 1800, Monster Hunter World, The Talos Principle. May
cause issues if games use unsupported features.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-17 15:36:51 +02:00
Philip Rebohle ccb2cea919 vkd3d: Always use cached memory type for readback heap.
We no longer require coherent memory types, so we should
always prefer a HOST_CACHED memory type for the readback
heap as well as corresponding custom heaps.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-17 15:36:02 +02:00
Philip Rebohle 7ad4ea2f78 vkd3d: Explicitly flush/invalidate mapped memory if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-17 15:36:02 +02:00
Hans-Kristian Arntzen 09af24e69b vkd3d: Avoid vkResetCommandPool if there are pending command buffers.
Works around an app-bug in SotTR, where the command pool is reset before
the command buffer completes.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 15:31:38 +02:00
Hans-Kristian Arntzen 334b1cab8d vkd3d: Implement threaded submission queue.
D3D12 supports out-of-order signal and wait. So does Vulkan timeline
semaphores. However, in Vulkan we don't have an infinite amount of
virtual queues. We must potentially map multiple D3D12 queues on top of
Vulkan, which might lead to a deadlock when app attempts to
wait-before-signal if the two queues are mapped to the same physical
Vulkan queue.

In order to solve this, we need to hold back submissions until we know
it is safe to do so. To make this work in practice as simply as possible, each
ID3D12CommandQueue has its own submission thread, which will block on an
ID3D12Fence's pending timeline value for a Wait command. The main reason to use a
submission thread is that resolving this directly in
ID3D12CommandQueue::Signal is extremely tricky and potentially
needs recursively locking queues and fences.

Note that we only block on the pending wait value, not the actual wait
value, so there is no real CPU <-> GPU synchronization here. In the
common case, no submission thread will block.

The added benefit is that submits are async now, so main thread CPU
overhead might slightly decrease.

To play nice with DXGI swapchain, the external entry point for acquiring
the Vulkan queue needs to drain the submission thread and lock it to ensure
submissions happen in order.

Fixes hangs in The Division 1, which makes use of this D3D12 feature.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 15:31:38 +02:00
Philip Rebohle f9a2a68948 vkd3d: Improve d3d12_device_SetResidencyPriority stub.
Monster Hunter World requires this function to succeed.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 18:38:31 +02:00
Philip Rebohle 957aec4785 vkd3d: Restore old ClearUnorderedAccessView implementation.
The current code uses D3D12 abstractions to create pipelines but
issues raw Vulkan API calls to actually implement the functionality,
which means the code makes assumptions about the exact descriptor
set layout and push constant layout, which is generally a bad idea
now that we have multiple code paths for root constants etc.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 18:03:39 +02:00
Hans-Kristian Arntzen edc614ab2e vkd3d: Remove legacy fence/semaphore path.
Prepares for a rewrite of queue submission, the legacy path is never
run in practice and will likely break in subtle ways.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-16 15:31:04 +02:00
Philip Rebohle 55be09fb0d vkd3d: Support 1D texture views.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:30:51 +02:00
Philip Rebohle 5bf266a8ed vkd3d: Check whether root descriptors are defined.
Fixes a crash in Monster Hunter World.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:29:17 +02:00
Philip Rebohle d6204bb993 vkd3d: Implement D3D12_FEATURE_QUERY_META_COMMAND feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 14:25:01 +02:00
Philip Rebohle 25f0af58f6 vkd3d: Implement D3D12_FEATURE_D3D12_OPTIONS6 feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 14:25:01 +02:00
Philip Rebohle 0701d87474 vkd3d: Update ID3D12CommandList to ID3D12GraphicsCommandList5.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 14:25:01 +02:00
Philip Rebohle 61530857d6 vkd3d: Update ID3D12Device to ID3D12Device6.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 14:25:01 +02:00
Hans-Kristian Arntzen 6c9683e23c vkd3d: Do not always attempt dedicated buffer allocation for heap.
On NVIDIA we sometimes fail to place images on a heap because the memory
region was dedicated. Only bother trying this if heap flags only allow
buffers.

Fixes a GPU crash in The Division.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-15 13:33:44 +02:00
Philip Rebohle 78b6d291cd vkd3d: Implement D3D12_FEATURE_D3D12_OPTIONS5 feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 10:35:59 +02:00
Philip Rebohle 638dcb1afb vkd3d: Update ID3D12Device to ID3D12Device5.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 10:35:59 +02:00
Philip Rebohle 084f8ed949 vkd3d: Update ID3D12CommandList to ID3D12GraphicsCommandList4.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 10:35:59 +02:00
Philip Rebohle dbeffb0834 vkd3d: Update ID3D12Fence to ID3D12Fence1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 10:35:59 +02:00
Philip Rebohle 0871f02b7e vkd3d: Implement D3D12_FEATURE_CROSS_NODE feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 03b15571d8 vkd3d: Implement D3D12_FEATURE_SERIALIZATION feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00