Commit Graph

2245 Commits

Author SHA1 Message Date
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
Philip Rebohle 0c2057ff68 vkd3d-shader: Support texel offset for sample_c instruction.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:30:51 +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
Philip Rebohle bfcb41706c include: Update D3D12 IDL.
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 d65cd725d9 include: Fix typos.
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
Philip Rebohle 26538f4377 vkd3d: Implement D3D12_FEATURE_D3D12_OPTIONS4 feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle d94b48a851 vkd3d: Update ID3D12Resource to ID3D12Resource1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle e2881e199d vkd3d: Update ID3D12Heap to ID3D12Heap1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle cc4762935f tests: Test GetResourceAllocationInfo1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 9c119b907c vkd3d: Implement ID3D12Device4::GetResourceAllocationInfo1.
Also, support querying more than one resource at a time.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 0c03bbe9b5 vkd3d: Implement ID3D12Device4::CreateCommandList1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 23e2b62950 vkd3d: Implement ID3D12Device4::CreateReservedResource1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle a66e9a2ce4 vkd3d: Implement ID3D12Device4::CreateCommittedResource1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 5fbca43bc8 vkd3d: Implement ID3D12Device4::CreateHeap1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle aa2c21b2bd vkd3d: Update ID3D12Device to ID3D12Device4.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 108ce6409b vkd3d: Update ID3D12CommandList to ID3D12GraphicsCommandList3.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 561675410b include: Fix typo.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 407c740927 vkd3d: Rework vkd3d_dxbc_compiler_get_resource_binding.
Instead of taking the resource type, take the binding flag.
This allows us to also use this function for UAV counters.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-10 14:32:33 +02:00
Philip Rebohle c44b168da2 include: Fix ID3D12Device2 GUID.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-08 14:23:28 +02:00
Philip Rebohle da07275b16 vkd3d: Implement d3d12_device_CreatePipelineLibrary.
Needed by Claybook.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-08 14:23:28 +02:00
Philip Rebohle 9647109559 vkd3d: Add stubs for ID3D12PipelineLibrary1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-08 14:23:28 +02:00
Philip Rebohle 50b5959e64 vkd3d: Implement better stub for GetCachedBlob.
We currently can't implement this in a meaningful way, but we
should return an empty blob in order to not crash applications.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-08 14:23:28 +02:00
Philip Rebohle 20aa3c3c26 vkd3d: Make ID3DBlob implementation more accessible.
We're going to need this to implement other parts of the
API, so it should be in common code.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-08 14:23:28 +02:00