Commit Graph

89 Commits

Author SHA1 Message Date
Derek Lesho 849537614a vkd3d: HACK: Don't create host pointer heap for Halo Infinite.
Some usage pattern here is causing a failure inside amdgpu.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
2022-07-21 20:48:56 +02:00
Hans-Kristian Arntzen ee39209798 vkd3d: Add flag to force native FP16 paths.
Apparently RT shaders in RE Engine require min16float to
be implemented as native FP16. Fun ... ._.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-11 15:58:21 +02:00
Hans-Kristian Arntzen 7f5dbcfc40 vkd3d: Add workaround to allow identifiers to be queried from library.
CP77 relies on this to work somehow ...
The DXR spec seems to suggest this is allowed, but there is no direct
concept for this in Vulkan.

This seems to work on NVIDIA at least, but we're on very shaky ground
here ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-11 14:34:34 +02:00
Hans-Kristian Arntzen 707af8152e vkd3d: Add workaround for forced clearing of certain buffers.
If game uses NOT_ZEROED, it might still rely on buffers being properly
cleared to 0.
Enable this and FORCE_RAW_VA_CBV for Halo Infinite.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-24 15:11:19 +02:00
Hans-Kristian Arntzen 717026f903 vkd3d: Add VKD3D_CONFIG option to force raw VA CBV descriptors.
For certain ExecuteIndirect() uses, we're forced to use this path
since we have no way to update push descriptors indirectly yet.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-23 12:52:29 +02:00
Hans-Kristian Arntzen e8f1936ee2 vkd3d: Convert VKD3D_CONFIG flags to 64-bit constants.
We're soon running out of 32-bit space.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-06-01 15:31:48 +02:00
Hans-Kristian Arntzen 467db76f90 vkd3d: Remove obsolete COLOR -> COMPUTE workaround for Deathloop.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-05-31 15:59:35 +02:00
Hans-Kristian Arntzen 2dcb1e2efc cache: Implement an on-disk pipeline library.
With VKD3D_SHADER_CACHE_PATH, we can add automatic serialization of pipeline
blobs to disk, even for games which do not make any use of GetCachedBlob
of ID3D12PipelineLibrary interfaces. Most applications expect drivers to
have some kind of internal caching.

This is implemented as a system where a disk
thread will manage a private ID3D12PipelineLibrary, and new PSOs are
automatically committed to this library. PSO creation will also consult
this internal pipeline library if applications do not provide their own
blob.

The strategy for updating the cache is based on a read-only cache which
is mmaped from disk, with an exclusive write-only portion for new blobs,
which ensures some degree of safety if there are multiple
concurrent processes using the same cache.

The memory layout of the disk cache is optimized to be very efficient
for appending new blobs, just simple fwrites + fflush.
The format is also robust against sliced files, which solves the problem
where applications tear down without destroying the D3D12 device
properly.

This structure is very similar to Fossilize, and in fact the idea is to
move towards actually using the Fossilize format directly later.
This implementation prepares us for this scenario where e.g. Steam could
potentially manage the vkd3d-proton cache.

The main complication in this implementation is that we have to merge
the read-only and write caches.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-04-06 16:36:26 +02:00
Hans-Kristian Arntzen 365dd05557 vkd3d: Add breadcrumbs support.
AMD path for this commit.
Idea is that we can automatically instrument markers with command list
information we can make some sense of in vkd3d-proton.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-11 13:07:56 +01:00
Hans-Kristian Arntzen 277f485321 vkd3d: Add private extension header.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-03-04 13:34:18 +01:00
Hans-Kristian Arntzen 9817c52d24 vkd3d: Add workaround to ignore mismatch driver/device in PSO library.
Elden Ring does not detect the proper error code and create a new
pipeline library. Instead, create a fresh new library, which works
around the issue.

The game has a pattern of LoadPipeline -> if fail -> CreatePSO ->
StorePipeline. Sometimes, in the same process it will LoadLibrary from
its own cache (could explain some stutters),
so it's very useful to have this either way.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-25 14:50:57 +01:00
Hans-Kristian Arntzen c19eaac376 vkd3d: Add VKD3D_CONFIG option for command pool recycling.
Normal behaving apps should not benefit from any of this.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-25 13:59:08 +01:00
Hans-Kristian Arntzen 8a46c21254 vkd3d: Add VKD3D_CONFIG to skip memory allocator clears.
For cases where games spam committed allocations and don't use
NOT_ZEROED. We still rely on zerovram behavior for initial backing which
should be enough in most cases.

Strictly speaking however, we are forced to clear the allocations every
time if application does not use the flag correctly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-24 12:52:05 +01:00
Hans-Kristian Arntzen edbf49aad4 vkd3d: Support opt-in to single MUTABLE set.
Useful for Intel since Intel hardware cannot support more than 1M
descriptors in general, and opting in to correct behavior should improve
CPU overhead as well when copying descriptors.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-21 17:08:25 +01:00
Hans-Kristian Arntzen 47337d5e0b vkd3d: Add VKD3D_CONFIG flags for various pipeline library logging.
Additionally, add option to ignore cached SPIR-V.
Will be useful for debugging, and also required for VKD3D_SHADER_OVERRIDE.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen f03940ef4b vkd3d: Add global_pipeline_cache option.
Avoids saving out pipeline cache blobs which are likely going to be
cached by on-disk cache anyways.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-02-04 14:31:34 +01:00
Hans-Kristian Arntzen 6cba8b9945 vkd3d: Workaround broken barriers in DEATHLOOP.
In DEATHLOOP, there is a render pass which renders out a simple image,
which is then directly followed by a compute dispatch, reading that
image. The image is still in RENDER_TARGET state, and color buffers are
*not* flushed properly on at least RADV, manifesting as a very
distracting glitch pattern. This is a game bug, but for the time being,
we have to workaround it, *sigh*.

For a simple workaround, we can detect patterns where we see these
events in succession:

- Color RT is started
- StateBefore == RENDER_TARGET is not observed
- Dispatch()

In particular, when entering the options menu, highly distracting
glitches are observed in the background.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-01-12 12:20:03 +01:00
Hans-Kristian Arntzen 35d2f1e87f vkd3d: Correctly check for SM 6.6 required features.
Remove the experimental flag and unconditionally enable SM 6.6 if
available.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-11-01 14:20:38 +01:00
Hans-Kristian Arntzen 6548e4fd00 vkd3d: Add VKD3D_CONFIG for experimentally enabling SM 6.6.
To be used for bringup and removed when we complete the support.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-10-26 15:32:36 +02:00
Hans-Kristian Arntzen 740e23ea8a vkd3d: Add VKD3D_CONFIG to force non-invariant position.
It's common enough that new games break on RDNA2 because of this that we
should enable this by default. This matches DXVK behavior.

SOTTR gets a special weird exception, just like DXVK. The shaders are
broken enough that the proper fix is actually precise, not invariant.
This will be addressed at some later point.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-10-18 15:51:20 +02:00
Hans-Kristian Arntzen 6866b45637 vkd3d: Add CONFIG flag for enabling DXR 1.1.
We cannot support ExecuteIndirect with TraceRays() for time being.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-10-12 16:04:30 +02:00
Hans-Kristian Arntzen 0c2ddb89cd vkd3d: Add CONFIG for forced CACHED memory.
Very useful for capturing. Speeds up a ton.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-27 14:48:26 +02:00
Hans-Kristian Arntzen 173b8ecef0 vkd3d: Add workaround for DEATHLOOP.
Game attempts to create a host visible resource with
ALLOW_RENDER_TARGET flag. We cannot make this work on NVIDIA, but the
game never seems to actually create an RTV, so as a workaround, nop out
the flag, which does make it work after all :3

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-17 14:21:09 +02:00
Hans-Kristian Arntzen a8f623e60d vkd3d: Negate upload_hvv config.
Enable resizable BAR style allocations by default, and add option to
disable it.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen 12066a2b67 vkd3d: Add debug config to log resizable BAR allocations.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Joshua Ashton 1b957a1f74 vkd3d: Add config to use host-visible vram for UPLOAD heap
Adds the "upload_hvv" config flag, which will make D3D12_HEAP_TYPE_UPLOAD attempt to use host-visible VRAM for allocations.

This takes advantage of large or resizable BAR if available.

I see a perf delta of 83-84 -> 92-94 (~12%) when using this in Horizon Zero Dawn.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-08-23 13:24:43 +02:00
Hans-Kristian Arntzen 419790ac77 vkd3d: Add wave size workaround for GravityMark.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-07-02 15:15:42 +02:00
Hans-Kristian Arntzen c1860a1ead vkd3d: Add VKD3D_CONFIG flags for forcing EXCLUSIVE queue modes.
Helps in some cases, but we cannot do this by default :(

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-29 12:24:24 +02:00
Hans-Kristian Arntzen 1ea31701c5 vkd3d: Move F1 2020 workaround over to quirks system.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-06-17 16:42:14 +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
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 043fd304f8 vkd3d-shader: Add force_tgsm_barriers config flag
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-12 16:29:57 +02:00
Joshua Ashton 41df41305e include: Move vkd3d_config_flags to public header
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-04-12 16:29:57 +02:00
Joshua Ashton 2fa97aa0fb vkd3d: Move API versions to public header
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-03-22 14:29:45 +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 fccbd3b5e2 vkd3d: Eliminate wchar_size, use UTF-16 string literals
Achieves this with C standard stuff alone, and no compiler hacks.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-09 11:26:28 +01:00
Joshua Ashton 4fb3e277f1 vkd3d: Remove VKD3D_RESOURCE_PRESENT_STATE_TRANSITION
All this flag does is make resource creation fail.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-22 09:30:24 +02:00
Hans-Kristian Arntzen d7e9713c4c vkd3d: Add external API to perform initial transition.
Relevant for swapchain since a swapchain resource can be presented right
away without ever having been touched by an API call.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 4dff80661a vkd3d: Rewrite initial resource state tracking.
For correctness, we will need to defer any initial resource state
handling to the queue timeline. Here, we will build an UNDEFINED ->
common layout barrier if (and only if):

- The resource is marked to care about initial layout transition.
- We are the first queue thread to observe that initial_transition
  member is 1 (atomic exchange).
- The first use of the resource was not marked to be a discard.
  E.g., if the first use of the resource is an alias barrier, we must
  not emit an early barrier. The only we should do here is to clear the
  initial_transition member, and leave it like that.

A command list maintains a list of d3d12_resources which *might* need a
transition. For the first frame a resource is used (or so), it will not
have the flag cleared yet, so multiple command lists might add the
d3d12_resource to its own transition list. This is fine, as the queue
will resolve it.

If multiple queues see the same initial transition, there might be
shenanigans, but the application must ensure there is either a
submission boundary or fence boundary between the uses. Any initial
layout transition will only be submitted after a Wait() is observed, as
submission of the transition command buffer will be in-order with other
submissions.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-08 14:30:50 +02:00
Joshua Ashton a991fddeeb build: Use `-fvisibility=hidden` and define exports manually
When building natively on Windows we use dllexport/dllimport for vkd3d/vkd3d_utils public exports.

When building natively on Linux we simply make those visibility default.

Nothing changes for standalone here.

Closes #152

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:44:10 +02:00
Joshua Ashton e24914b11f include: Pull in Win32 Vulkan exts when building for Win32
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Józef Kucia 096dfde280 include: Document API versions.
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:40:45 +02:00
Józef Kucia 08e2e583b5 vkd3d: Introduce vkd3d_application_info.
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-05-13 12:47:44 +02:00
Józef Kucia 3b83ccc67e vkd3d: Add stubs for versioned root signatures.
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-04-10 18:56:55 +02:00
Józef Kucia 6ee8529390 vkd3d: Add support for optional device extensions.
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-03-29 00:21:00 +01:00
Józef Kucia be462a932f include: Use angle-bracket includes consistently.
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>
2018-11-08 19:07:36 +01:00
Józef Kucia f732501a14 include: Move vkd3d_result to common header.
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>
2018-11-08 19:07:34 +01:00