Commit Graph

3314 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen f2c5a6561c tests: Test RTAS clone and compact.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-04 16:30:29 +01:00
Hans-Kristian Arntzen b34af6a7fa vkd3d: Convert RT vertex format correctly.
Context sensitive formats, oh boy!

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-04 16:30:29 +01:00
Hans-Kristian Arntzen 686a3efc08 vkd3d: Verify VBO RTAS support when checking RT tier.
Format conventions for RT are ... special.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-04 16:30:29 +01:00
Hans-Kristian Arntzen b5d433baaa vkd3d: Implement RTAS clone and compact copy operations.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-04 16:30:29 +01:00
Philip Rebohle 39513d6503 vkd3d: Silence log spam around Min LOD Clamp.
This seriously hurts performance in AC:Valhalla.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-04 13:37:05 +01:00
Philip Rebohle 5e94183975 vkd3d-shader: Do not insert branch to loop header if outside of block.
Fixes invalid SPIR-V in case there is an unconditional break right
before the loop ends.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-04 13:36:31 +01:00
Philip Rebohle ba8e306452 vkd3d-shader: Ignore break instructions if there is no active block.
This can happen if a continue statement is immediately followed
by a break instruction in a switch case.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-03-04 13:36:31 +01:00
Joshua Ashton 96888b0663 build: Use --file-alignment=4096 with MinGW
Avoids a copy in the Wine loader as well as enables debug symbols to work in perf.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-03 19:22:44 +01:00
Joshua Ashton 47606f4339 build: Rename vkd3d_msvc and vkd3d_clang
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-03 19:22:44 +01:00
Hans-Kristian Arntzen 031ad9e139 vkd3d: Track dynamic pipeline stack size
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen 600a296ca7 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen 9588ec082e vkd3d: Fix warnings when AS is used without support.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen fcd00f0559 vkd3d: Implement DispatchRays.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen b162e5ec72 vkd3d: Refactor descriptor updates.
We might have to emit to different bind point than our binding entry
suggests due to DXR, so pass down information explicitly to leaf
functions.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen eeaca4a500 vkd3d: Pass down raygen pipeline layout to command list.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen 0b161f5693 vkd3d: Implement SetPipelineState1.
Refactor push constant invalidation to SetPipelineState,
it is technically more correct to only invalidate when actually pushing
constants, but we need to do full state invalidation when transitioning
between RT pipelines and non-RT pipelines due to bind point aliasing
shenanigans in D3D12, so it makes more sense to invalidate state based
on active bind point there.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen 77089065cd vkd3d: Compute default pipeline stack size.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen 9ffa3bf351 vkd3d: Support CreateSRV with RTAS.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Hans-Kristian Arntzen 9ff7b82235 vkd3d: Rename VKD3D_DESCRIPTOR_FLAG_UAV_COUNTER to RAW_VA_BUFFER.
We're going to place acceleration structures here.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-03-03 19:19:47 +01:00
Joshua Ashton 3224688295 vkd3d: Enable VK_EXT_debug_utils conditionally
Enabling VK_EXT_debug_utils comes at some overhead in Wine due to the object tracking required. There is also likely a non-zero overhead in some native implementations also.

By enabling this conditionally, we can also avoid additional overhead from apps that set debug labels on both the Vulkan and front-end side.

The default condition is to enable it when building with Renderdoc integration or in debug builds.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Joshua Ashton 91fc472601 vkd3d: Add mechanism for conditional extensions
Add a way to enable an extension via config flags.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Joshua Ashton 4c6f5375a6 vkd3d: Refactor config_flags to be global rather than instance state
Makes it so we can access it in code where we have no concept of a device/instance.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Joshua Ashton 64a6bae1a0 vkd3d: Remove vkd3d_application_info structure
This thing has no right to exist.

We don't get this information in D3D12 and it's getting in the way of me refactoring config flags.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Joshua Ashton 78b5b347b8 build: Disable TRACE calls in release builds
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Joshua Ashton 4da76cb51b vkd3d: Simplify properties/features tracing
Simplifies this to make it easier to add new properties/features
so we don't have a bunch of pointers to things that are just a child
of the device info structure.

Fixes warnings when compiling without traces too.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Joshua Ashton 615b2d714f build: Minor meson formatting change
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-02 11:09:29 +01:00
Georg Lehmann 7d518ea78f meta: Remove .gitlab-ci.
Github Actions replaced the frogs.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-02-27 13:57:53 +00:00
Hans-Kristian Arntzen 91fad86e4d tests: Test that root parameters are correctly invalidated.
When emitting push constants for graphics, these should invalidate push
constants for compute and vice versa. In Vulkan, vkCmdPushConstants is
not tied to a bind point.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-26 17:06:18 +01:00
Hans-Kristian Arntzen 89fbe334df vkd3d: Redirect push constants to their bind point stages.
Gives a massive boost on NVIDIA for some reason.
RADV defers push constant update, so ALL_STAGES doesn't have
that much of a perf hit.

~20% uplift in RE2, ~5% uplift in CP77 from some quick and dirty testing.
Seems to be heavily content dependent either way.

Also a bug fix, since we would clobber graphics push constants from
compute and vice versa if both graphics and compute used the same root
signature.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-26 17:06:18 +01:00
Hans-Kristian Arntzen 3839f5e17c vkd3d: Ignore known useless validation warnings.
These only clutter up validation in testing.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-26 15:04:11 +01:00
Joshua Ashton 29b410928b tests: Add a suite of tests for SetName
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-25 21:51:43 +01:00
Joshua Ashton 8c9527cdf7 vkd3d: Refactor SetName implementation
As per MSDN, SetName is just a wrapper around SetPrivateData and a specific GUID.

Some apps and tools will use this to retrieve their name back.

So instead, just forward the name to Vulkan in the SetPrivateData call.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-25 21:51:43 +01:00
Joshua Ashton 04b86b80b6 include: Define WKPID_D3DDebugObjectName and friends
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-25 21:51:43 +01:00
Joshua Ashton a76daad03f vkd3d-common: Add vkd3d_strdup_n
There is no strndup on Windows.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-25 21:51:43 +01:00
Philip Rebohle 26f5745ea1 vkd3d: Don't use SHADER_STAGE_ALL for push constants.
Instead, infer the required stages from the D3D12 shader visibility
field from all root parameters that we map to push constants.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-02-25 20:28:07 +01:00
Philip Rebohle c37e705761 vkd3d: Use push constant stage mask from root signature.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-02-25 20:28:07 +01:00
Hans-Kristian Arntzen 96b44fddbc tests: Remove some todo/is_bug()s for RADV.
Some tests are now passing.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 18:28:06 +01:00
Hans-Kristian Arntzen 4fe5b9388d vkd3d: Do not disable robustness, ever.
There are pragmatic reasons for not following spec 100% here.
The only known case where UpdateAfterBind robustness is not exposed
seems to be somewhat bogus, and we cannot run D3D12 correctly without
robustness either way.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 17:53:48 +01:00
Hans-Kristian Arntzen be9c376fde vkd3d: Implement postbuild info queries.
Can only support a subset in Vulkan without extra heroics. The DXR API
lets you query things that you technically should know apriori in the
application. We might need to allocate some side-channel buffers on
demand, but let's defer that until actually needed ... :\

DXR is also very awkward in that we have a query which is resolved in
UNORDERED_ACCESS state instead of COPY_DEST state, so we'll have to
ping-pong through some barriers redundantly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 4365f9962f vkd3d: Allocate query pools based on type index instead of D3D12 type.
Postbuild info is a query in Vulkan, but not so in D3D12.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen d88ce7cdea tests: Test post-build info output.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen a5aac500bc vkd3d: Basic implementation of GraphicsCommandList::BuildRTAS().
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 3353ed14de vkd3d: Implement RTAS object creation.
When building acceleration structures, we need to have an
VkAccelerationStructureKHR object, but the D3D12 API just uses a plain
VA = ID3D12Resource::GetGPUVA() + offset.

For this to work, we need to resolve the VA back to VkBuffer + offset.
The only VkBuffer we can lookup is the original backing memory
allocation in the VA map, and that allocation itself must own a view
map, since we cannot tie the VA to any specific ID3D12Resource.

Since creating an RTAS is not the common path, we allocate the view map
on-demand with CAS.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 0fc80d9067 vkd3d: Emit RT barriers as required.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 221a658884 vkd3d: Mark resources as being RTAS depending on initial resource state.
RTAS must stay in this resource state forever. The only way to
synchronize them is UAV barriers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 86f7fdfe7a vkd3d: Add RTAS buffer usage flags.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 83861cceed vkd3d: Allow RTAS initial resource state.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen 2afe25c0c8 vkd3d: Implement GetRaytracingAccelerationStructurePrebuildInfo.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen d773e67fff vkd3d: Add helper query to check if RT should be used.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-25 16:14:16 +01:00
Hans-Kristian Arntzen a90ed938b4 vkd3d-shader: Pass down SBT descriptor size to dxil-spirv.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-23 12:28:19 +01:00