Commit Graph

1990 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen 796c6843df vkd3d: Add test for reading packed tesslevel in DS.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-12 14:15:55 +01:00
Hans-Kristian Arntzen 185c037f98 vkd3d-shader: Compute XfbOffset per buffer.
Fixes Hairworks GPU crash on Metro Exodus.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-12 14:15:55 +01:00
Hans-Kristian Arntzen 66e92ded64 vkd3d: Make a basic repro case for vertex input in patch constant phase.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-12 14:15:55 +01:00
Philip Rebohle 4bdec95f37 vkd3d-shader: Clean up vkd3d_dxbc_compiler_emit_shader_phase_input.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-12 14:15:55 +01:00
Philip Rebohle 934646027a vkd3d-shader: Allow hull shader join phases to read patch constants.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-12 14:15:55 +01:00
Philip Rebohle 6e4fc511f9 vkd3d-shader: Add missing lookups to vkd3d_siv_from_sysval_indexed.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-12 14:15:55 +01:00
Philip Rebohle 7c092a0640 vkd3d-shader: Don't re-declare inputs in default control point phase.
Otherwise, we delcare certain input control points twice in shaders that
access them in a fork phase, which is not allowed as per Vulkan spec:

    "Any two inputs listed as operands on the same OpEntryPoint must not
     be assigned the same location, either explicitly or implicitly"

Fixes invalid SPIR-V and resulting RADV driver crashes in Metro Exodus.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-12 14:15:55 +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
Andrew Eikum c6dcf61443 Update to current vkd3d master (a59f198) 2019-12-09 07:13:39 -06:00
Andrew Eikum e935026b02 Revert "vkd3d: Allocate one large buffer for a heap and offset into it."
This reverts commit a4d13f12c5.
2019-12-09 07:13:04 -06:00
Andrew Eikum 79c2a8aa52 Revert "Revert "vkd3d: Bump RootSignature version to 1.1.""
This reverts commit 91b7be72c5.
2019-12-09 07:12:57 -06: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
Henri Verbeet d0586297c5 vkd3d-shader: Handle VKD3DSPR_GSINSTID in vkd3d_dxbc_compiler_get_register_name().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-06 20:11:22 +01:00
Henri Verbeet ebac7ee24c vkd3d-shader: Avoid declaring outputs multiple times with incompatible types.
This would cause CoreValidation-Shader-InterfaceTypeMismatch validation
errors from Wine's test_shader_interstage_interface() d3d11 test. This
reverts parts of commits 1eb7eca411 and
04ec461fb4.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-06 20:11:20 +01:00
Henri Verbeet 61799500e2 vkd3d-shader: Handle normalised types in vkd3d_component_type_from_data_type().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-06 20:11:18 +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 0d43c776c5 vkd3d/tests: Add tests for ID3D12GraphicsCommandList2::WriteBufferImmediate().
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:13 +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
Conor McCarthy a303482acc vkd3d/tests: Add and modify tests for GetResourceAllocationInfo().
Test large DepthOrArraySize for small resources, and test compressed
textures at the 64KB limit.

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:39 +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 23c4dc26e2 vkd3d/tests: Add tests for block-compressed texture dimensions.
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:35 +01:00
Conor McCarthy 5fe91bbf02 vkd3d: Validate dimension alignments for block-compressed textures.
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:33 +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
Conor McCarthy e783784cac vkd3d: Return valid node masks in external resource heap properties.
Hitman 2 calls GetHeapProperties() for each swapchain buffer and checks if
the creation node mask is 1. If not then it fails to store the resource
pointers for later rendering.

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-25 16:07:11 +01:00
Conor McCarthy 5366d405e9 vkd3d: Add tests for external resource heap properties.
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-25 16:07:09 +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 65ee0562f9 vkd3d: Set VK_IMAGE_MUTABLE_FORMAT_BIT for UAV images with non-UINT formats.
Needed to support ClearUnorderedAccessViewUint() for all formats.

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:01 +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
Hans-Kristian Arntzen 54d2a15aa6 vkd3d: Use size_t instead of SIZE_T for GPU VA sizes.
This also fixes a format specifier warning in an ERR for the 32-bit Linux
build.

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-11-25 16:06:56 +01:00
Philip Rebohle 736dd8203d tests: Add a test for image UAV clears.
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-19 22:04:46 +01:00
Philip Rebohle f7f6073436 tests: Test more view formats in the UAV clear test.
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-19 22:04:44 +01:00
Henri Verbeet da68980fdc vkd3d: Properly check for program_invocation_name.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-15 17:42:03 +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 1bfacf3727 vkd3d: Store view object type in vkd3d_view.
Currently, vkd3d_view_destroy_descriptor assumes image views
by default, but we need to be able to attach buffer views to
command allocators for UAV clears.

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:04 +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
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
Andrew Eikum 91b7be72c5 Revert "vkd3d: Bump RootSignature version to 1.1."
This reverts commit c002aee119.

This commit caused a bunch of problems which are still being worked out
upstream.
2019-11-04 08:04:36 -06:00
Hans-Kristian Arntzen a4d13f12c5 vkd3d: 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-11-04 08:04:36 -06: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 1b66138006 tests: Test ClearUnorderedAccessView() with placed resources.
Catches certain implementation issues which committed resources do not.

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-31 19:25:04 +01:00
Philip Rebohle 6c65f1b814 vkd3d-shader: Support vicp inputs for hull shader fork/join phases.
This case needs special care since both VKD3DSPR_INPUT in the
control point phase and VKD3DSPR_INCONTROLPOINT in fork/join
phases refer to the same set of input variables, and we should
not declare input variables with the same location twice.

Encountered in Shadow of the Tomb Raider.

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:33 +01:00
Philip Rebohle 1707042e62 tests: Test bindings after changing root signature.
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:24 +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
Conor McCarthy a38ee68f93 vkd3d/tests: Add tests for D3D12_HEAP_TYPE_CUSTOM.
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:20:52 +01:00
Conor McCarthy 87cc75b7e6 vkd3d: Add support for custom heap properties.
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:20:50 +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
Philip Rebohle 1eb7eca411 vkd3d-shader: Don't redundantly override shader output info.
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-27 19:18:23 +01:00
Philip Rebohle 0e00448229 vkd3d-shader: Handle tessellation factor built-ins in emit_output.
Uses the private patch constant array for tessellation factor built-ins.
Fixes two separate issues encountered in Shadow of the Tomb Raider:

- The output registers that have one component mapped to any of
  the TESS_FACTOR sysvals can have their other components mapped
  to a regular patch constant output, in which case we need to
  use a private io variable.

- The tessellation factor outputs are not necessarily dynamically
  indexed within shader code. Previously, this did not work correctly
  and lead to invalid store operations in the generated SPIR-V.

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-27 19:17:34 +01:00