Commit Graph

365 Commits

Author SHA1 Message Date
Philip Rebohle 74b1831960 vkd3d: Bind UAV counter address buffer if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Hans-Kristian Arntzen 7c479f6dae vkd3d: Disable index_buffer_strip_cut spam in normal runtime.
Demote this warning to TRACE only.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 12:54:44 +01:00
Hans-Kristian Arntzen f7ea9967d0 vkd3d: Use minimum width/height/layer framebuffer.
All attachments must be at least as large as the framebuffer, using a
max operator is not compliant with Vulkan.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 11:17:01 +01:00
Philip Rebohle b85852e733 vkd3d: Fix barriers for bindless CBV-as-SSBO.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-23 16:20:38 +01:00
Hans-Kristian Arntzen 71d8f63356 vkd3d: Split descriptor pool allocation based on usage.
Logically split up descriptor pool allocation in three types:
- STATIC: Root descriptors and internal allocation.
- VOLATILE: For packed descriptor set which comes from heaps.
- IMMUTABLE_SAMPLER: For immutable samplers. This should be removed once
  we start allocating sampler sets at sampler creation time.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 14:29:03 +01:00
Hans-Kristian Arntzen 291db5581c vkd3d: Fix push constant size check against D3D12_MAX_ROOT_COST.
MAX_ROOT_COST is in terms of number of u32s.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 14:29:03 +01:00
Philip Rebohle c7af09c68c vkd3d: Allocate descriptor pool space for inline uniform blocks.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 20:49:56 +01:00
Philip Rebohle ada3890211 vkd3d: Write inline uniform block if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 13:54:12 +01:00
Philip Rebohle e899b96c10 vkd3d: Introduce root signature flag to determine push descriptor usage.
For now this is enbaled based on device capabilities, but future changes
may require this to be disabled for certain root signatures.

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 708f26bf40 vkd3d: Only update packed descriptor set if necessary.
When changing tables that only have bindless descriptors,
only update the push constants instead.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-11 10:47:58 +01:00
Philip Rebohle 2e18afc7cb vkd3d: Introduce dirty flags for pipeline bindings.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-11 10:47:58 +01:00
Philip Rebohle 2b45574fc2 vkd3d: Invalidate descriptor heap bindings if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle be20e9a9c1 vkd3d: Set descriptor table offsets via push constants.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle af4c211f34 vkd3d: Bind descriptor sets for active descriptor heaps.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle 6e15ad20b4 vkd3d: Rework descriptor table binding.
Uses the new data structures to iterate over descriptor
tables and populate the packed descriptor set.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 14:07:51 +01:00
Philip Rebohle 28bf2eec3e vkd3d: Rework static samplers.
Static samplers are embedded in the root signature, so we can create
a separate descriptor set layout and descriptor set which we only
need to rebind when the root signature itself changes.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 13:11:10 +01:00
Philip Rebohle ae12e22187 vkd3d: Rework root descriptor updates.
Updates the root descriptor set or push descriptor at draw time.
This fixes a potential issue with shader-based clear/copy commands
invalidating previously bound root descriptors.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 12:19:07 +01:00
Philip Rebohle 82bf3e810b vkd3d: Rework root descriptors.
Streamlines descriptor set layout creation for root descriptors.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 12:19:07 +01:00
Philip Rebohle 189bcd39af vkd3d: Store index of root descriptor set in root signature.
This allows us to put root descriptors into a set other than 0.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 3f125ac919 vkd3d: Temporarily require VK_KHR_push_descriptor.
Allows us to more easily refactor root signature-related code
without having to worry about root descriptors for now.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 0d071c9c37 vkd3d: Rename root signature descriptor set layout members.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 7c276f5e82 vkd3d: Rework root constant updates.
Fixes an issue where push constants can be invalidated by
shader-based clear/copy commands.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 0eed8a1080 vkd3d: Rework root constants.
Uses one push constant range with VK_SHADER_STAGE_ALL. This
will allow us to easily add descriptor table offsets as push
constants.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle dfa208f909 vkd3d: Remove d3d12_command_list_invalidate_bindings.
The primary purpose of this function was to invalidate UAV
counters upon binding a pipeline. This is no longer an issue
and we don't have any other per-pipeline bindings, so this
function can be dropped.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-03 20:58:46 +01:00
Philip Rebohle f3d89a548a vkd3d: Reintroduce UAV counters.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-02 12:16:30 +01:00
Philip Rebohle 0dab14ed22 vkd3d: Temporarily drop UAV counter support.
This needs a major rework as the current implementation has bugs,
is hard to reason about, and very hard to maintain as we're about
to make major changes to the binding model as a whole.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-02 12:16:30 +01:00
Hans-Kristian Arntzen 93e4b6ff9b vkd3d: Deal correctly with SM 5.1 register spaces.
Resource index is found in idx[0] in SM 5.0, but idx[1] when using SM
5.1, and register space is encoded separately. An rb_tree keeps track of
the internal resource index idx[0] and can map that to space/binding as
required when emitting SPIR-V.

For this to work, we must also make UAV counters register space aware.
In earlier implementation, UAV counter mask was assumed to correlate 1:1
with register_index, which breaks on SM 5.1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-24 12:32:29 +01:00
Hans-Kristian Arntzen 40e4a74c04 Allocate one large buffer for a heap and offset into it.
Greatly reduce VA allocations we have to make and makes returned VA more
sensible, and better matches returned VAs we see on native drivers.

D3D12 usage flags for buffers seem generic enough that there is no
obvious benefit to place smaller VkBuffers on top of VkDeviceMemory.

Ideally, physical_buffer_address is used here, but this works as a good
fallback if that path is added later.

With this patch and previous VA optimization, I'm observing a 2.0-2.5%
FPS uplift on SOTTR when CPU bound.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2019-12-09 07:14:17 -06: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 9c64642468 vkd3d: Add SetViewInstanceMask() to the ID3D12GraphicsCommandList1 interface.
This method was missing in version 10.0.15063.0 of the SDK, but is
present in version 10.0.18362.0, without a UUID change. Presumably that
means this was simply an omission in the older header, rather than an
API change in the newer header.

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:10 +01:00
Philip Rebohle a204a681a1 vkd3d: Handle DXGI_FORMAT_R11G11B10_FLOAT in d3d12_command_list_ClearUnorderedAccessViewUint().
There is no bit-compatible UINT format, so we'll use DXGI_FORMAT_R32_UINT.

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:07:07 +01:00
Philip Rebohle 207ca12725 vkd3d: Re-implement d3d12_command_list_ClearUnorderedAccessViewUint().
Addresses the following limitations of the previous implementation:
    - Only R32_{UINT,TYPELESS} were supported for buffers.
    - Clearing an image UAV did not behave correctly for images with non-UINT formats.
    - Due to the use of transfer operations, extra memory barriers were needed.

If necessary, this will create a temporary view with a bit-compatible
UINT format for the resource in order to perform a bit-exact clear.

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:07:04 +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
Philip Rebohle 72246862af vkd3d: Factor out root parameter invalidation.
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-13 16:40:13 +01:00
Philip Rebohle 79da30adc7 vkd3d: Defer compute pipeline update to Dispatch time.
Needed to support compute-based clear and copy operations.

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-13 16:40:09 +01:00
Philip Rebohle 4a191a27dc vkd3d: Store view properties in vkd3d_view.
The additional data is needed to implement UAV clears.

Moving this out of d3d12_desc also helps make copying and
traversing descriptor arrays more CPU cache-friendly.

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-13 16:39:59 +01:00
Philip Rebohle 8cb42d6971 vkd3d: Keep active bindings after changing root signature.
Shadow of the Tomb Raider does not re-bind all descriptor tables after
setting a new root signature if tessellation is enabled, which causes
some descriptors to be left undefined.

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-10-31 19:24:20 +01:00
Rémi Bernon 832f47edd3 vkd3d: Clamp buffer image copy size to subresource dimensions.
This fixes a vulkan validation error.

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-27 19:20:27 +01:00
Conor McCarthy 2155748c41 vkd3d: Add support for multiplanar depth/stencil state transitions.
If separate transitions of the depth and stencil plane occur in the
same array of barriers, they will be consolidated into one Vulkan
layout transition. This can only be supported for combinations of
depth read and depth write states, or identical states.

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-10-27 19:14:38 +01:00
Henri Verbeet 769dd2b68c vkd3d: Introduce vkd3d_format_get_data_offset().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-18 18:06:10 +02:00
Hans-Kristian Arntzen a0ebcce398 vkd3d: Do not use RESET_COMMAND_BUFFERS_BIT.
By setting this flag, command pools cannot efficiently pool allocations.
This flag should be set to 0 so only the VkCommandPool may be reset.
This matches D3D12 API.

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-01 19:16:16 +02:00
Hans-Kristian Arntzen 3c86b2341c vkd3d: Do not release resources in vkResetCommandPool.
D3D12 command allocators are intended to recycle memory across resets,
so we should do the same thing in vkd3d.

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-01 19:16:12 +02:00
Józef Kucia 865fbea532 vkd3d: Remove unused d3d12_root_signature_init_descriptor_pool_size().
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:12 +02:00
Józef Kucia 0d851513dc vkd3d: Get rid of dxgi_format_is_typeless().
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:31:56 +02:00
Jactry Zeng 9d138ee135 vkd3d: Handle SINT and UINT formats in ClearRenderTargetView().
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
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:31:53 +02:00
Józef Kucia d9da1c904e vkd3d: Store vkd3d_format in {dsv,rtv}_desc.
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:31:50 +02:00
Józef Kucia dc2ae75461 vkd3d: Return more information from device memory allocation functions.
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-06-21 08:09:18 +02:00
Józef Kucia 110830aca0 vkd3d: Introduce d3d12_resource_is_cpu_accessible() helper.
The condition in d3d12_resource_is_cpu_accessible() is going to be
changed in the following commits.

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-06-21 08:09:16 +02:00
Józef Kucia ed8bd8cd59 vkd3d: Implement D3D12_RESOURCE_STATE_PREDICATION resource barriers.
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-06-18 16:41:11 +02:00