Commit Graph

2379 Commits

Author SHA1 Message Date
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
Hans-Kristian Arntzen e5267713ef tests: Add basic DXR bringup test.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-22 18:03:05 +02:00
Hans-Kristian Arntzen 6a6aa69abb include: Add missing DXR constants to IDL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-22 16:28:19 +02:00
Hans-Kristian Arntzen 02fb0d2974 vkd3d: Functions take void as argument type in C.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-22 16:26:59 +02:00
Hans-Kristian Arntzen 4595cacc79 vkd3d: Enforce that WCHAR is actually a WCHAR.
We will need to receive 2-byte WCHARs from apps.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-22 16:26:49 +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 4d602d1958 vkd3d: Fix compilation warnings in d3d12-test.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 17:03:40 +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 bbfbf94c5e vkd3d-shader: Always use private vars for arrayed builtins.
Fixes invalid shader code being generated in Monster Hunter World.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:30:51 +02:00