Henri Verbeet
dd00e209ac
vkd3d: Use debugstr_hresult() in d3d12_command_queue_submit_locked().
2024-01-22 22:19:03 +01:00
Henri Verbeet
ebb2a31e50
vkd3d: Use debugstr_hresult() in d3d12_command_list_copy_incompatible_texture_region().
2024-01-22 22:19:03 +01:00
Henri Verbeet
f6ef7c3f46
vkd3d: Use debugstr_hresult() in vkd3d_wait_for_gpu_fence().
2024-01-22 22:19:03 +01:00
Henri Verbeet
71decc927f
vkd3d-common: Introduce vkd3d_atomic_increment_u64().
2024-01-17 22:29:29 +01:00
Henri Verbeet
bf0fda7812
vkd3d: Trace GetLastError() results with %lu.
...
These are DWORDs, but this is all Windows code, so we can just use %lu.
2024-01-11 23:05:42 +01:00
Conor McCarthy
b0d1fb7d98
vkd3d: Use mutable descriptors if available.
...
The mutable descriptor type allows six descriptor sets to be replaced
with one set for CBV/SRV/UAV heaps.
2024-01-09 22:59:46 +01:00
Henri Verbeet
bb64bfff63
vkd3d: Attempt to translate border colours to static border colours in d3d12_desc_create_sampler().
2024-01-08 21:45:39 +01:00
Henri Verbeet
9060baacec
vkd3d: Implement support for static border colours.
2024-01-08 21:45:39 +01:00
Fabian Maurer
49d5aecaa7
vkd3d: Unlock mutex in error case in d3d12_command_queue_CopyTileMappings.
2024-01-08 21:45:06 +01:00
Giovanni Mascellani
5e7f9d4d0d
vkd3d: Specify the aspect when creating NULL UAVs.
...
This fixes a crash on MoltenVK.
2024-01-08 21:44:49 +01:00
Henri Verbeet
50cebc7278
vkd3d: Slightly simplify debug_vk_memory_property_flags().
...
VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD and
VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD were introduced by
Vulkan-Headers 1.1.121; we currently require version 1.2.148.
2024-01-04 22:24:10 +01:00
Henri Verbeet
0fb1ef1e63
vkd3d: Recognise VK_QUEUE_VIDEO_DECODE_BIT_KHR in debug_vk_queue_flags().
...
This was introduced by Vulkan-Headers 1.3.238, which is a bit newer than
we currently require.
2024-01-04 22:24:07 +01:00
Henri Verbeet
659c870edc
vkd3d: Recognise VK_QUEUE_PROTECTED_BIT in debug_vk_queue_flags().
2024-01-04 22:24:07 +01:00
Henri Verbeet
4ec7f360d9
vkd3d: Add D3D_FEATURE_LEVEL_1_0_CORE as a valid feature level.
2024-01-03 22:38:10 +01:00
Henri Verbeet
6abcc27c97
vkd3d: Add D3D_FEATURE_LEVEL_12_2 as a valid feature level.
2024-01-03 22:38:10 +01:00
Conor McCarthy
cc43ef3bca
vkd3d: Pass int64 capability info to vkd3d-shader.
2024-01-02 23:03:00 +01:00
Conor McCarthy
b8694fd879
vkd3d: Co-locate all descriptor-related members.
...
To optimise cache coherence, because decriptor updates use the most
performance-critical code paths.
2023-12-14 21:00:34 +01:00
Conor McCarthy
a2741babd9
vkd3d: Rename the device mutex to pipeline_cache_mutex.
...
It is used only for pipeline and render pass caching, and renaming it
helps prevent inappropriate or erroneous use.
2023-12-14 21:00:30 +01:00
Conor McCarthy
37e76618ca
vkd3d: Write Vulkan descriptors in a worker thread.
...
Raises framerate by 5-10% in games which write thousands of descriptors
per frame, e.g. Horizon Zero Dawn.
The worker thread is a generic device worker which can also be used for
other purposes if the need arises.
2023-12-14 21:00:28 +01:00
Conor McCarthy
70962ae7d8
vkd3d: Update the descriptor next
index before getting a reference for writing.
...
Fixes a race condition where the descriptor is modified between getting
its object and resetting the `next` index. The new object would never be
written. While it is invalid for the app to write descriptors used by a
command list which has been submitted to a queue, unused descriptors may
be written. This change also supports writing descriptors in a worker
thread.
2023-12-14 21:00:26 +01:00
Giovanni Mascellani
a6317e5f3b
vkd3d: Pad push constant ranges to 16 bytes.
...
Because that's the granularity of Constant Buffer accesses in SM4.
This commit requires using more push constants, but without it the
generated SPIR-V can be invalid.
2023-12-13 22:32:23 +01:00
Henri Verbeet
0c33f82f72
Release 1.10.
2023-12-06 15:31:21 +01:00
Jacek Caban
72bb5e8b02
vkd3d: Use VkPipelineStageFlags type for VkSubmitInfo.pWaitDstStageMask flags.
2023-11-28 00:09:28 +01:00
Alistair Leslie-Hughes
5c134d44d6
include: D3D12_RT_FORMAT_ARRAY remove typedef to make header compatible with windows.
...
windows d3d12.idl doesn't have this as a typedef.
2023-11-28 00:09:20 +01:00
Stefan Dösinger
2935ac5c7e
vkd3d: Forward MakeResident to EnqueueMakeResident.
2023-11-28 00:09:09 +01:00
Stefan Dösinger
bd35c91227
vkd3d: Improve the EnqueueMakeResident stub.
2023-11-28 00:09:06 +01:00
Conor McCarthy
76eb0adf03
vkd3d: Support depth bounds test.
2023-11-15 21:48:45 +01:00
Conor McCarthy
d8ba0d2a11
vkd3d: Implement ID3D12Device2::CreatePipelineState().
2023-11-15 21:48:44 +01:00
Conor McCarthy
6196199a89
vkd3d: Use struct d3d12_pipeline_state_desc for compute pipelines.
2023-11-15 21:48:44 +01:00
Conor McCarthy
39afbb8e32
vkd3d: Introduce struct d3d12_pipeline_state_desc for graphics pipelines.
...
A generic container for both compute and graphics pipeline descriptions
to facilitate reading the description from a stream.
2023-11-15 21:48:42 +01:00
Nikolay Sivov
e7422fdefb
vkd3d: Fix some spelling mistakes.
2023-11-13 23:19:15 +01:00
Henri Verbeet
2252f012ea
vkd3d: Add support for the ID3D12Resource1 interface.
2023-11-09 21:14:20 +01:00
Henri Verbeet
c5cc467394
vkd3d: Report D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE for UAV formats.
2023-11-08 22:49:43 +01:00
Henri Verbeet
000843b7c8
vkd3d: Report D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD for UAV formats when we have "uav_read_without_format".
2023-11-08 22:49:43 +01:00
Henri Verbeet
a03e78bf62
vkd3d: Compile the UAV clear shaders at runtime.
2023-11-06 23:09:49 +01:00
Nikolay Sivov
9c6c7cb78f
vkd3d: Add partial implementation for CreateCommittedResource1().
2023-10-10 22:11:46 +02:00
Nikolay Sivov
6ba75fd92f
vkd3d: Add partial implementation for CreateHeap1().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:07 +02:00
Andrey Gusev
8087cc01f7
vkd3d: Add ID3D12GraphicsCommandList5 interface stub.
2023-10-05 16:15:02 +02:00
Andrey Gusev
679203f717
vkd3d: Add ID3D12GraphicsCommandList4 interface stub.
2023-10-03 21:27:34 +02:00
Giovanni Mascellani
627cf50320
vkd3d: Use CONST_VTABLE.
2023-10-02 22:25:14 +02:00
Andrey Gusev
1006e8cbd4
vkd3d: Add ID3D12Device5 interface stub.
2023-09-28 23:13:29 +02:00
Andrey Gusev
acd3ed97dc
vkd3d: Add ID3D12Device4 interface stub.
2023-09-27 22:34:52 +02:00
Andrey Gusev
56cd609308
vkd3d: Add ID3D12Device3 interface stub.
2023-09-26 22:07:45 +02:00
Giovanni Mascellani
83ddfb9e8d
vkd3d: Expose the image view usage to Vulkan.
...
This prevents a failure with MoltenVK, which is not able to
create 2D-array view for any usage other than color attachment.
2023-09-26 22:07:41 +02:00
Giovanni Mascellani
b9fa8cfaa6
vkd3d: Set the image aspect when clearing UAVs.
...
This fixes a number of tests on Mesa on Intel.
2023-09-22 11:06:55 +02:00
Andrey Gusev
78ff0f3df4
vkd3d: Add ID3D12Device2 interface.
2023-09-22 11:05:59 +02:00
Henri Verbeet
90d4529f27
Release 1.9.
2023-09-21 19:16:32 +02:00
Conor McCarthy
5c09752194
vkd3d: Do not flush descriptor heaps stored in the command list when the array size is exceeded.
...
An earlier patch introduced a bug which overflows the descriptor heap
array. The array should not be emptied here in case the list is
resubmitted, so just flush the new heap.
2023-08-24 21:44:03 +02:00
Conor McCarthy
f3baf55d97
vkd3d: Implement ID3D12Device1 with stubs.
2023-08-23 22:44:58 +02:00
Giovanni Mascellani
8f8c89fb87
vkd3d: Update a warning so that it aligns with the check that triggers it.
2023-08-23 22:44:52 +02:00
Conor McCarthy
3ca2259807
vkd3d: Fix invalid atomic behaviour in the view cache linked list.
...
The list suffers from the ABA problem, where comparison with the head
succeeds but the head's `next` pointer has changed. Occurs in Cyberpunk
2077, on NVIDIA at least.
2023-08-23 22:44:45 +02:00
Conor McCarthy
c2e09e4c4f
vkd3d: Implement ID3D12Fence1.
2023-08-02 20:18:37 +09:00
Conor McCarthy
0d1bc77b2a
vkd3d: Implement ID3D12GraphicsCommandList3 with a stub.
2023-07-31 21:08:02 +09:00
Conor McCarthy
4433dacb4f
vkd3d: Implement ID3D12Device::GetResourceTiling() for textures.
2023-07-31 21:07:58 +09:00
Conor McCarthy
71a9feac8e
vkd3d: Implement ID3D12Device::GetResourceTiling() for buffers.
2023-07-31 21:07:57 +09:00
Conor McCarthy
3d49b59a68
vkd3d: Handle the case where a descriptor is null and is concurrently written non-null.
...
If view is null and the comparison (view == src->s.u.object) is false,
vkd3d_view_decref will be called on null.
2023-07-27 17:17:55 +09:00
Conor McCarthy
acc68aef94
vkd3d: Add a pending execution count to struct d3d12_command_signature.
...
Buffering of command list commands will depend upon command signatures
persisting until the buffer is flushed.
2023-07-24 22:41:07 +02:00
Conor McCarthy
95bad60281
vkd3d: Store the command buffer in the allocator upon creation.
...
For correct function it cannot be freed until the command allocator
is reset, and d3d12_command_allocator_free_command_buffer() normally
does not free it.
2023-07-24 22:40:53 +02:00
Conor McCarthy
9187a41733
vkd3d: Move descriptor heap tracking to d3d12_command_list_set_descriptor_table().
...
This is the simplest way to gather this information when command lists
are executed later.
2023-07-24 22:40:52 +02:00
Conor McCarthy
42d46d2513
vkd3d: Do not create Vulkan descriptor sets for non-shader-visible heaps.
2023-07-20 22:33:17 +02:00
Conor McCarthy
9014183100
vkd3d: Return a null handle from GetGPUDescriptorHandleForHeapStart() for non-shader-visible heaps.
2023-07-20 22:33:17 +02:00
Conor McCarthy
0a98d09145
vkd3d: Enable Vulkan-backed heaps for each heap instead of per device.
...
Provides a simple way to disable Vulkan writes for non-shader-visible
heaps. Also there is a chance of avoiding access to the d3d12_device
object which helps memory cache performance.
2023-07-20 22:33:05 +02:00
Evan Tang
574239e3e3
vkd3d: Make CopyResource use a temp buffer for depth <-> color copies.
...
depth <-> color copies aren't allowed in Vulkan
2023-07-06 20:09:50 +02:00
Giovanni Mascellani
68764b74a1
vkd3d: Release op data when destroying the queue.
2023-07-04 22:39:31 +02:00
Giovanni Mascellani
dcac2646e4
vkd3d: Always emit an error when failing to reserve for the op array.
2023-07-04 22:39:31 +02:00
Giovanni Mascellani
52d5cb749f
vkd3d: Release the op mutex on allocation failure.
2023-07-04 22:39:31 +02:00
Conor McCarthy
d3e6a3a78f
include: Introduce a function to detect the DXBC source type.
2023-06-28 21:40:36 +02:00
Conor McCarthy
3aa83e877d
vkd3d: Append CopyTileMappings() commands to the command queue op array.
2023-06-27 22:33:58 +02:00
Conor McCarthy
3935e8647f
vkd3d: Append UpdateTileMappings() commands to the command queue op array.
2023-06-27 22:33:58 +02:00
Conor McCarthy
e98e6c9b53
vkd3d: Add missing const attributes to ID3D12CommandQueue::UpdateTileMappings() parameters.
2023-06-27 22:33:58 +02:00
Conor McCarthy
5ccadd07f1
vkd3d: Validate plane count for tiled textures.
2023-06-27 22:33:58 +02:00
Conor McCarthy
0b67481496
vkd3d: Validate tiled resources tier for 3D textures.
2023-06-27 22:33:58 +02:00
Conor McCarthy
1a0d85b8d6
vkd3d: Validate tiled resources support during reserved resource creation.
...
Check directly for Vulkan support because the D3D12 tiled resources
tier may in future be modified by a config option.
2023-06-27 22:33:57 +02:00
Conor McCarthy
e93f2e7746
vkd3d: Always pass null heap properties to vkd3d_create_image() for sparse images.
2023-06-27 22:33:57 +02:00
Conor McCarthy
9532ac5f84
vkd3d: Check sparse image format is supported.
...
Based on code by Jan Sikorski.
2023-06-27 22:33:55 +02:00
Henri Verbeet
771e442af1
Release 1.8.
2023-06-22 22:00:20 +02:00
Henri Verbeet
133421a38c
vkd3d: Avoid redundantly initialising "descriptors" in d3d12_desc_flush_vk_heap_updates_locked().
...
As pointed out by Andrey Gusev.
2023-05-26 19:11:26 +02:00
Conor McCarthy
f039c86aac
vkd3d: Create smaller UAV-only descriptor pools in the allocator if Vulkan-backed heaps are enabled.
...
In this case d3d12_command_allocator_allocate_descriptor_set() is
only called for clearing UAVs. This helps on platforms with limited
descriptor maximum counts.
2023-05-08 20:22:02 +02:00
Conor McCarthy
e2dac061e2
vkd3d: Do not reset the descriptor heap count unless full or the command list is reset.
...
The same heaps must be flushed again if the command list is executed again
without a reset.
2023-05-02 20:46:23 +02:00
Conor McCarthy
5366ca7001
vkd3d: Synchronise concurrent descriptor heap binding by multiple command lists.
...
It is possible for multiple command lists to use the same heap, and
submit it simultaneously to multiple d3d12 queues.
2023-04-28 21:04:02 +02:00
Conor McCarthy
fa63da6030
vkd3d: Track all descriptor heaps bound during command list recording and flush their writes.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54895
2023-04-28 21:04:02 +02:00
Conor McCarthy
06cc2e1aee
vkd3d: Collect multiple descriptor writes in a buffer and update in one call.
...
Reduces the cost of calling vkUpdateDescriptorSets() via winevulkan
and its thunks. The performance gain can be as high as 20%.
2023-04-25 22:20:17 +02:00
Conor McCarthy
f50e53e7c9
vkd3d: Use atomic exchange for descriptor writes.
...
The descriptor component of struct d3d12_desc is replaced with a union
containing a pointer which can be swapped out using
InterlockedExchangePointer(). To make it safe to increment the refcount
of such an object it is necessary to cache freed objects. Elimination
of the descriptor mutexes on games which use multithreaded descriptor
writes nearly doubles framerate on recent hardware.
2023-04-25 22:20:15 +02:00
Conor McCarthy
e63201a7a3
vkd3d: Delay writing Vulkan descriptors until submitted to a queue.
...
Eliminates vk_sets_mutex. Performance on average may be lower until
the descriptor mutexes are replaced and Vulkan writes are buffered
to reduce thunk calls.
2023-04-25 22:20:09 +02:00
Conor McCarthy
505c8c5a2f
vkd3d: Ensure descriptors are pointer aligned.
...
The descriptor structure contains pointer and size types.
2023-04-25 22:20:06 +02:00
Conor McCarthy
a4a95aa950
vkd3d: Treat negative viewport widths as invalid.
...
Negative widths are not supported in Vulkan.
2023-04-20 22:53:48 +02:00
Conor McCarthy
5d724abc96
vkd3d: Do not skip all viewports if one is invalid.
...
Fixes blank screen in Assassin's Creed: Valhalla.
2023-04-20 22:53:46 +02:00
Conor McCarthy
333fdf7c74
vkd3d: Check for index buffer location zero.
...
VK_EXT_robustness2 does not support null index buffers so we only
warn and return immediately.
2023-04-19 20:46:53 +02:00
Conor McCarthy
0526f232cd
vkd3d: Support null address for SRV/UAV root descriptors.
2023-04-19 20:46:00 +02:00
Conor McCarthy
963e5e26dc
vkd3d: Support null address for CBV root descriptors.
2023-04-19 20:46:00 +02:00
Conor McCarthy
0ce55e8b8e
vkd3d: Support 1D SRV.
2023-04-18 22:00:17 +02:00
Conor McCarthy
6db9ed14dc
vkd3d: Support 1D UAV.
2023-04-18 22:00:17 +02:00
Philip Rebohle
c8a33431e3
vkd3d: Persistently map host-visible heaps on creation.
2023-04-10 21:00:17 +02:00
Conor McCarthy
e27ceddfb4
vkd3d: Leave the command queue op mutex locked after a partial flush.
...
All return paths in d3d12_command_queue_flush_ops_locked() must
leave the op mutex locked.
2023-04-05 21:38:39 +02:00
Conor McCarthy
88667098eb
vkd3d: Do not destroy a heap until its resource count is zero.
...
Fixes a crash on exit in Horizon Zero Dawn (which requres added SM 6.0 support).
Placed resources should hold a reference to their heap:
https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createheap
2023-04-03 17:59:41 +02:00
Henri Verbeet
57d92a15cf
Release 1.7.
2023-03-24 11:22:28 +01:00
Giovanni Mascellani
bb2fa97c33
vkd3d: Do not keep the CS queue locked while processing it.
...
d3d12_command_queue_flush_ops() can renter itself while processing signal
events. Since we don't use recursive mutexes, we currently have to check
some of the queue variables without holding the mutex, which is not safe.
This is solved by allowing the queue to release its mutex while it is
processing entries: when flushing, the queue is briefly locked, the
is_flushing flag is set, the queue content is copied away and the
queue is unlocked again. After having processed the entries, the
queue is locked again to check is something else was added in the
meantime. This is repeated until the queue is empty (or a wait operation
is blocking it).
This should also remove some latency when a thread pushes to the queue
while another one is processing it, but I didn't try to measure any
impact. While it is expected that with this patch the queue mutex
will be locked and unlocked more frequently, it should also remain
locked for less time, hopefully creating little contention.
2023-03-08 20:14:39 +01:00
Giovanni Mascellani
09d2c8d190
vkd3d: Always enqueue wait operations, even when they can be executed right away.
2023-03-08 20:14:39 +01:00
Giovanni Mascellani
9eba44396a
vkd3d: Always enqueue signal operations, even when they can be executed right away.
2023-03-08 20:14:39 +01:00
Giovanni Mascellani
0d329ba168
vkd3d: Always enqueue execute operations, even when they can be executed right away.
...
The goal is to simplify the CS queue handling: with this and the following
changes operations are always started by d3d12_command_queue_flush_ops(),
in order to make further refactoring easier.
Notice that while with this change executing an operation on an empty CS
queue is a bit less efficient, it doesn't require more locking. On the other
hand, this change paves the road for executing CS operations without holding
the queue lock.
2023-03-08 20:14:35 +01:00