Commit Graph

266 Commits

Author SHA1 Message Date
Philip Rebohle 90a22df2a4 vkd3d: Implement D3D12_FEATURE_D3D12_OPTIONS1 feature query.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle 7c7db3c77c vkd3d: Optionally enable VK_EXT_subgroup_size_control.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle 0273292224 vkd3d: Optionally enable VK_NV_shader_sm_builtins.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle ebcc18583c vkd3d: Optionally enable VK_AMD_shader_core_properties{_2}.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle 70ac2f147e vkd3d: Upgrade ID3D12Device to ID3D12Device3.
Stubs for now, will implement new functionality as needed.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle 6b113bb629 vkd3d: Introduce d3d12_command_list_iface type alias.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle b6d5a407ce vkd3d: Define d3d12_device_iface type alias.
This way we don't have to change all function parameter types
every time we upgrade the interface version.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Philip Rebohle c41275478c vkd3d: Refactor pipeline state creation.
We need a more extensible struct to contain the pipeline
descriptions in order to be able to support new rendering
features.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-31 18:28:18 +02:00
Hans-Kristian Arntzen afdbf6edcd vkd3d: Enable VK_KHR_timeline_semaphore extension.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-31 12:51:05 +02:00
Philip Rebohle 8344e8224e vkd3d: Only add feature structs to pNext chain if extension is supported.
RenderDoc will sometimes report extensions as unsupported, but still
fill out and accept the respective feature structs. Since we assume
extensions to be supported if the feature is enabled, we sometimes
try to use functionality that RenderDoc disables and crash.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-30 11:07:53 +02:00
Philip Rebohle 00d88454ee vkd3d: Factor out extension enumeration.
Besides cleaning up the code, this also allows us to
use information about the available extensions earlier.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-30 11:07:53 +02:00
Philip Rebohle 34f9cae1c6 vkd3d: Disable unused BufferDeviceAddress features.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-30 11:07:53 +02:00
Philip Rebohle 643ace438e vkd3d: Store push descriptor properties in device info struct.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-30 10:47:47 +02:00
Philip Rebohle 920d029100 vkd3d: Don't require bindless UAV counters for RESOURCE_BINDING_TIER_3.
Nvidia does not support VK_KHR_buffer_device_address at the moment.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-28 10:39:14 +01:00
Philip Rebohle 8843739797 vkd3d: Require bindless UAV and UAV counters for BINDING_TIER_3.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:37:59 +01:00
Philip Rebohle 577efe9040 vkd3d: Optionally enable VK_KHR_buffer_device_address.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle facae7690c vkd3d: Replace descriptor mutex with per-descriptor spinlocks.
Greatly improves performance in various games that update or
copy a large number of descriptors per frame due to the high
overhead of pthread_mutex_{un}lock.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 13:33:03 +01:00
Philip Rebohle e7360fbd46 vkd3d: Fix build.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 14:39:58 +01:00
Philip Rebohle d4d299d765 vkd3d: Initialize feature options in d3d12_device_caps_init.
Also reworks the check for resource binding tiers.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle 1e78cd3397 vkd3d: Determine maximium feature level in d3d12_device_caps_init.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle bf8863568c vkd3d: Introduce d3d12_device_caps_init.
This method is meant to process d3d12 device caps after the
device itself has been fully initialized. This helps avoid
code duplication in certain instances and guarantees that we
know about all enabled Vulkan features.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle f3e8c156c2 vkd3d: Move minimum feature level check to d3d12_device_create.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle 19b971de0a vkd3d: Introduce d3d12_caps.
Meant to bundle all d3d12 feature caps and options, of which
we're going to have to add more over time.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle ef80658ffb vkd3d: Do not disable storage buffer indexing features.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Hans-Kristian Arntzen ceee2096a5 vkd3d: Query subgroup properties and expose SM 6.0 if present.
Does not cover every case for SM 6.0, but it's a useful start.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 10:58:17 +01:00
Philip Rebohle c658eda3df vkd3d: Enable VK_EXT_inline_uniform_block if available.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 13:54:12 +01:00
Hans-Kristian Arntzen fee9b2bb05 vkd3d: Implement RS 1.0 volatile for packed descriptor set.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-11 12:20:00 +01:00
Philip Rebohle 76f42069f4 vkd3d: Add comment about WoW requiring BINDING_TIER_3 support.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle 8847a78f33 vkd3d: Store vkd3d_physical_device_info with d3d12_device.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle 01cbbaea81 vkd3d: Create bindless descriptor set layouts.
Don't enable any bindless features for now so that we don't
introduce regressions as features get added.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 14:07:51 +01:00
Hans-Kristian Arntzen 92724ce15c vkd3d: Attempt to create a Vulkan 1.1 instance and device.
Need this to support subgroup operations for SM 6.0.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-05 11:03:01 +01:00
Hans-Kristian Arntzen 00eec801de vkd3d: Load Vulkan dynamically in d3d12 test app.
On Windows, it is not ideal to rely on Vulkan being available as a
linkable library as a full install of the Vulkan SDK must be present and
set up, be friendly and load Vulkan dynamically instead.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-24 11:53:29 +01:00
Hans-Kristian Arntzen 484ac51267 vkd3d: Add simple pthread wrapper for MSVC.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-24 11:53:29 +01:00
Hans-Kristian Arntzen 89c516e5da vkd3d: Disable async compute queues for the time being.
Cannot disable VK_EXT_descriptor_indexing as we relied on internal
behavior in RADV related to global_bo_list. Implementing bindless
properly in vkd3d will solve this correctly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-19 15:39:51 +01:00
Conor McCarthy a59f1982ad vkd3d: Remove redundant GetCopyableFootprints() resource size alignment checks.
The alignments are now checked in d3d12_resource_validate_desc().

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-06 20:25:50 +01:00
Conor McCarthy 91555883ac vkd3d: Add stub for ID3D12GraphicsCommandList2::WriteBufferImmediate().
ID3D12GraphicsCommandList2 and WriteBufferImmediate() are used by
Hitman 2, but implementing the function on top of an AMD extension has
no effect on game behaviour. It's commonly used to write debug info.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-06 20:11:15 +01:00
Conor McCarthy 7b88754ff2 vkd3d: Remove alignment validation from GetResourceAllocationInfo().
The right place for alignment validation is d3d12_resource_validate_desc().
The mod alignment test, which returns a size of ~0 on failure, is incorrect
on systems where Vulkan requires alignments of 0x20000 or more, and breaks
Hitman 2, which uses the returned value unchecked and allocates heaps of
0xffffffff bytes.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-27 22:08:37 +01:00
Conor McCarthy af60bc03ba vkd3d: Validate texture resource alignments.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-27 22:08:31 +01:00
Philip Rebohle 126a789019 vkd3d: Implement d3d12_command_list_ClearUnorderedAccessViewFloat().
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-25 16:06:59 +01:00
Derek Lesho 1d955506a3 vkd3d: Implement d3d12_device_GetCustomHeapProperties().
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-07 21:07:18 +01:00
Rémi Bernon 4576236199 vkd3d: Do not report a root signature version higher than requested.
This fixes Shadow of the Tomb Raider crashing because of NULL root
signatures being passed since c002aee119.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-31 19:25:07 +01:00
Hans-Kristian Arntzen fd4488c3ab vkd3d: Optimise the GPU VA allocator.
The GPU VA allocator was allocating memory in a way where dereferencing
GPU VA required a lock + bsearch() to find the right VA range.

Rather than going this route, we turn the common case into O(1) and
lock-free by creating a slab allocator which allows us to lookup a
pointer directly from a GPU VA with (VA - Base) / PageSize.

The number of allocations in the fast path must be limited since we
cannot trivially grow the allocator while remaining lock-free for
dereferences.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-27 19:15:34 +01:00
Hans-Kristian Arntzen c7916314dc vkd3d: Align allocated GPU address ranges to the requested resource alignment.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-27 19:15:31 +01:00
Hans-Kristian Arntzen c002aee119 vkd3d: Bump RootSignature version to 1.1.
There appears to be a complete implementation of RS 1.1 already,
so enable this feature.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 16:38:59 +02:00
Conor McCarthy 8e6f5ddd24 vkd3d: Make all descriptor reads and writes atomic.
Shadow of the Tomb Raider overwrites descriptors while they are being
copied in another thread. This patch makes reads and writes atomic for
CBV, SRV, UAV, and sampler descriptors, but not RTV and DSV, for which
copying is not implemented.

Benchmark total frames vs mutex count (the single mutex was locked
only once for copying):

1 mutex:    6480 6489 6503
8 mutexes:  6691 6693 6661
16 mutexes: 6665 6682 6703

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-24 17:48:42 +02:00
Józef Kucia 9e997c6db6 vkd3d: Remove old entries in GPU VA allocator.
The "allocations" array is filled with unused entries when D3D12 buffers
are destroyed. The majority of entries might be unused after running for
a while. Remove the entry when VA is freed in order to prevent
accumulation of unused entries. This makes destroying D3D12 buffers more
expensive.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-06 17:05:10 +02:00
Józef Kucia 8df3bfc5c2 vkd3d: Prepend pNext chain structures.
Order of structures doesn't matter so we can simply prepend instead of
apending.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-06 17:05:07 +02:00
Józef Kucia 0184917520 vkd3d: Add support for VK_KHR_image_format_list.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-06 17:04:54 +02:00
Józef Kucia 56d260b40e vkd3d: Use vk_append_struct() in more places.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-31 08:24:42 +02:00
Józef Kucia 8ba2b2baec vkd3d: Use macros to define optional extensions tables.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-31 08:24:40 +02:00