Commit Graph

2352 Commits

Author SHA1 Message Date
Joshua Ashton e1f792e714 vkd3d: Low latency presentation and acquire semaphores
In cases where acquire image is blocking, we should call that after
presentation to avoid latency when the app calls present.

This avoids weird inverse frame cadences with Mesa WSI right now,
as acquiring an image is always a blocking call until it is complete.

In cases when we aren't blocking, this kicks off the acquisition so
it can be waited upon by the next present blit pass.

Use another set of semaphores to wait for the image acquisition on the
GPU.

In the non-blocking vkAcquireNextImageKHR case, this means that a
potential bubble of time between waiting on the fence and submitting
the blit + presentation is eliminated.

Runaway presentation in this setup is avoided by frame latency objects
and normal frame latency which is always 3 according to documentation.

Be careful about handling SUBOPTIMAL. Semaphores will be signaled, but
we might want to tear down the swapchain. In these cases, we need to
wait for the semaphore to be signaled first, which can only be done by
submitting a wait, since QueueWaitIdle or DeviceWaitIdle don't cover
WSI.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-02 14:40:16 +02:00
Joshua Ashton c33cfd048b vkd3d: Handle frame latency without WAITABLE_OBJECT
Documentation says that this should always be 3 without WAITABLE_OBJECT
unlike in D3D11 where it will use the DXGI device's frame latency.

This stops runaway presentations in the non-blocking acquire image case
with the new semaphore setup.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-06-02 14:36:40 +02:00
Hans-Kristian Arntzen a83c99ba77 vkd3d-shader: Don't apply offset buffers for non-bindless resources.
Fixes root descriptors when BDA support is disabled.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-27 23:30:51 +02:00
Hans-Kristian Arntzen fa471962dc vkd3d: Mask clear color in ClearUAVUint.
Fixes test TODOs. Apparently Vulkan drivers can saturate here, which
caused the TODO to appear, at least on AMD Windows.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-27 15:34:53 +02:00
Hans-Kristian Arntzen 3c7f188863 vkd3d: Nuke code paths for !nullDescriptor.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-27 10:39:22 +02:00
Hans-Kristian Arntzen 7bf93b844d vkd3d: Require VK_EXT_robustness2.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-27 10:39:22 +02:00
Hans-Kristian Arntzen a3fb2f1cd6 vkd3d-shader: Opt-in to early fragment tests with descriptor QA.
Since we introduce side effects, avoid full late-Z for everything, which
is slow, and not necessarily correct either.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-26 17:26:01 +02:00
Hans-Kristian Arntzen 077740f15c vkd3d-shader: Implement descriptor QA for DXBC as well.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-26 17:26:01 +02:00
Hans-Kristian Arntzen a256a9266e vkd3d: Rewrite descriptor QA.
Adds support for GPU-assisted validation of descriptor usage in the
CBV_SRV_UAV heap.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-26 17:26:01 +02:00
Hans-Kristian Arntzen 5e67d30883 vkd3d: Add config option for descriptor QA.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-26 17:26:01 +02:00
Hans-Kristian Arntzen 0d5f1d7784 vkd3d-shader: Add way to pass down descriptor QA buffers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-26 17:26:01 +02:00
Hans-Kristian Arntzen 96a84e2633 vkd3d: Fix build with DESCRIPTOR_QA.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-26 17:26:01 +02:00
Joshua Ashton 925a930d1e vkd3d: Fix missing trace arg in SetPipelineStackSize
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-05-20 11:36:21 +02:00
Hans-Kristian Arntzen 9d405f0366 vkd3d: Don't try to use fallback SRV aux heap.
DXR requires buffer_device_address, so it's meaningless to attempt a
fallback.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-13 08:25:10 +01:00
David McCloskey 1744896142 vkd3d: Fix for freeing memory created with aligned_malloc
Signed-off-by: David McCloskey <davmcclo@gmail.com>
2021-05-07 06:42:12 +01:00
David McCloskey 217ffc27d2 vkd3d: Type error fix for d3d12_device_get_query_pool.
Signed-off-by: David McCloskey <davmcclo@gmail.com>
2021-05-07 06:41:59 +01:00
Hans-Kristian Arntzen 43bf0ed8c1 vkd3d: Ensure SAMPLED | COLOR_ATTACHMENT for R8_TYPELESS.
Needed for stencil -> color copies potentially.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-05 00:11:10 +02:00
Hans-Kristian Arntzen 4f0872152a meta: Add fs_copy_uint path.
For stencil -> color copies.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-05 00:11:10 +02:00
Hans-Kristian Arntzen ef5ad082a0 vkd3d: More precise logging for fallback copy fixmes.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-05 00:11:10 +02:00
Hans-Kristian Arntzen 0e93af9700 vkd3d: Handle multiple planes in subresource conversion for copies.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-05-05 00:11:10 +02:00
Georg Lehmann a411256c7f vkd3d: Enable and require shaderDrawParameters.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-04-29 06:48:37 +01:00
Georg Lehmann b858f8a478 vkd3d: Don't error out if vkGetPhysicalDeviceFragmentShadingRatesKHR isn't found.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-04-24 18:23:46 +01:00
Hans-Kristian Arntzen 99a180f7a1 vkd3d-utils: Fix .def version.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-22 15:30:58 +01:00
Hans-Kristian Arntzen be1b941e06 vkd3d: Workaround buggy NV driver in sparse update.
test_update_tile_mappings fails if we don't do this.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-21 16:29:05 +02:00
Joshua Ashton 3d0913dc19 d3d12: Initialize optional extensions
This was missed and somehow magically worked fine when running the test suite for me.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-21 00:48:43 +02:00
Joshua Ashton 3118696706 vkd3d-utils: Bump SONAME version to 3.0.0
We made breaking ABI changes.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton 911a202bd1 vkd3d: Bump SONAME version to 3.0.0
We made breaking ABI changes.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton a3ad7cae90 vkd3d-shader: Remove type/next from interface structures
This was never really used for anything useful.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton 0c8349cb8e vkd3d-shader: Remove vkd3d_shader_domain_shader_compile_arguments
This is never used by anything, and all the info is in the shader anyway.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton 220e1146ee vkd3d-shader: Make vkd3d_shader_transform_feedback_info a member
Moves it into vkd3d_shader_interface_info, this doesn't need to be
a pNext.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton 3e4a8b1504 vkd3d: Remove type/next from vkd3d device/instance structures
There's really no reason to overcomplicate adding optional extensions this way.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton bd988f2b74 vkd3d: Remove vkd3d_optional_device_extensions_info
Roll this into vkd3d_device_create_info, no need for this to be a pNext thing.

Additionally, fix some memory leaks on device creation failure.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Joshua Ashton 59148c1932 vkd3d: Remove vkd3d_optional_instance_extensions_info
Roll this into vkd3d_instance_create_info, no need for this to be a pNext thing.

Additionally, fix some memory leaks on instance creation failure.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-20 18:25:41 +02:00
Philip Rebohle f06f94bfb4 vkd3d: Enable multi_queue by default.
And replace option with a single_queue flag to do the opposite.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-19 16:40:49 +02:00
Joshua Ashton 07e801192f vkd3d-shader: Resolve arguments to variable before passing to epilogue
Otherwise we pass in a pointer which is bad, or a local value which is also illegal for some reason.

It has to be a "memory object declaration".

Found via. spirv-val

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-19 13:19:44 +02:00
Joshua Ashton 4470ec63cc vkd3d-shader: Don't emit builtin clip/cull arrays for hull shaders
There are no output built-ins here, just per-vertex stuff passed directly to DS to deal with there.

Closes: #227

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-19 13:19:44 +02:00
Joshua Ashton 94a9719557 vkd3d-shader: Rename vkd3d_dxbc_compiler_emit_shader_signature_outputs to vkd3d_dxbc_compiler_emit_clip_cull_outputs
This only ever emits these.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-19 13:19:44 +02:00
Joshua Ashton 000407d74c vkd3d-shader: Enable Clip/Cull distance capabilities
Found via. spirv-val

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-19 13:19:44 +02:00
Hans-Kristian Arntzen c7eb6fdf61 vkd3d: Add some tracing to help narrow down compiler crashes.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-15 16:24:05 +02:00
Hans-Kristian Arntzen 6292078433 vkd3d-shader: Return INVALID_ARGUMENT instead of SHADER.
For invalid bindings, we expect E_INVALIDARG in D3D12.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-15 16:24:05 +02:00
Hans-Kristian Arntzen 744497274c vkd3d-shader: Verify that we compile expected shader stage.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-15 16:24:05 +02:00
Hans-Kristian Arntzen 8f17fdd1fa vkd3d: Don't leak pipeline cache if we fail compile.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-15 16:24:05 +02:00
Hans-Kristian Arntzen e7b6cf4089 vkd3d-shader: Report error if binding is not found in root signature.
Error out early.

Fixes some crashes when we keep going after having seen completely
broken bindings.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-04-15 16:24:05 +02:00
Philip Rebohle 62cbf3d78a vkd3d: Remove unused unsafe_impl_from_ID3D12CommandAllocator.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-14 16:24:55 +02:00
Philip Rebohle 4f9ca6c3df vkd3d: Create bundles and bundle allocators as necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-14 16:24:55 +02:00
Philip Rebohle 1bbbabcb94 vkd3d: Implement ExecuteBundle.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-14 16:24:55 +02:00
Philip Rebohle 728ce6c370 vkd3d: Validate command list type in ExecuteCommandLists.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-14 16:24:55 +02:00
Philip Rebohle 1990270bbb vkd3d: Implement CreateCommandList on top of CreateCommandList1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-14 16:24:55 +02:00
Philip Rebohle 2ca62ecd12 vkd3d: Add bundle allocator and command list implementation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-04-14 16:24:55 +02:00
Joshua Ashton 2860b0a548 vkd3d: Enable force_tgsm_barriers for F1 2020
Signed-off-by: Joshua Ashton <joshua@froggi.es>

Closes: #611
2021-04-12 16:29:57 +02:00