Commit Graph

2185 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen 0f25b827e0 vkd3d: Use pipeline barrier command buffers for queue serialization.
We have observed a lot of large GPU bubbles when using back-to-back
timeline semaphores to synchronize GPU submissions. Use prebaked
pipeline barrier command buffers instead.

To resolve queue sparse serialization, use two binary semaphore pairs to
resolve this. There is no need to use timeline semaphores in this case.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-17 16:34:03 +01:00
Philip Rebohle 8fe83f5e9c vkd3d-shader: Correctly handle bit shifts greater than 31 bits.
This is undefined behaviour in SPIR-V, but well-defined in
DXBC, so we should explicitly 'and' the shift amount with 31.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-17 15:26:36 +01:00
Hans-Kristian Arntzen 0749f46d8e vkd3d: Re-enable wave ops.
dxil-spirv update fixed the issue for me.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-17 10:49:40 +01:00
Hans-Kristian Arntzen de4293f990 vkd3d: Use SHADER_READ for CBV visibility when using ROOT_VA CBV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-16 17:01:58 +01:00
Joshua Ashton 71328b9be7 vkd3d: Handle reserved resources in host barrier code
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-16 09:25:50 +01:00
Joshua Ashton 08135f7746 vkd3d: Fix validation spam for null descriptor buffers
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-16 09:25:17 +01:00
Hans-Kristian Arntzen 412ec7ac2f vkd3d: Enable root descriptor BDA support.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-13 17:10:48 +01:00
Hans-Kristian Arntzen a1d851e717 vkd3d-shader: Do not require Int64 to use root descriptors.
Can just use uvec2. Also improves performance on ACO since ACO cannot
promote uint64_t to SGPR yet, u32x2 however, works fine and can be
bitcast to pointer as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-13 17:10:48 +01:00
Hans-Kristian Arntzen 009b3a69e0 vkd3d-shader: Update dxil-spirv with BDA root descriptor support.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-13 17:10:48 +01:00
Hans-Kristian Arntzen 74a654e273 vkd3d: Disable waveops for time being.
The fix which enabled waveops detection broke HZD, since we never tested
with that feature enabled.

Keep it disabled until we can figure out what is going on.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-13 12:58:22 +01:00
Philip Rebohle 3da44beb5d vkd3d: Change USE_PUSH_DESCRIPTORS to USE_ROOT_DESCRIPTOR_SET for clarity.
USE_PUSH_DESCRIPTORS may be misleading since it would be set even when
we're not using push descriptors at all due to root descriptors being
passed in via VAs. Instead, make the flag represent whether or not we
use a regular descriptor set for root parameters.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle baf265c666 vkd3d: Update root descriptor VAs as necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 8999093c54 vkd3d: Add new field to store root descriptor VA.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 677422993e vkd3d: Add root descriptor VAs to push constant range.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle cd01371756 vkd3d: Always enable BUFFER_DEVICE_ADDRESS usage for buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle c11b58418a vkd3d-shader: Support physical storage buffer root SRVs/UAVs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 4313eaa59c vkd3d-shader: Support physical storage buffer root CBVs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 5d2b0e6632 vkd3d-shader: Add loadv/storev helpers for aligned memory access.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 6c9d0cea69 vkd3d-shader: Rename descriptor_table_var_id -> root_parameter_var_id.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 4b3cec53fc vkd3d-shader: Declare push constants for root descriptor VAs.
We'll always place them at the beginning of the push constant
buffer in order to avoid potential alignment issues.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle 2689c9e0a3 vkd3d-shader: Enable Int64 capability as necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle f69564c6c1 vkd3d-shader: Implement buffer reference type declarations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-12 15:21:56 +01:00
Philip Rebohle b536723f5a vkd3d: Fix shader model-related feature detection.
We need to know the supported shader model to detect support
for certain features like wave ops correctly.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-11 10:41:11 +01:00
Joshua Ashton d4d14dfca0 vkd3d: Ignore DXGI_PRESENT_ALLOW_TEARING
Fixes warning spam in Horizon Zero Dawn.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-09 15:34:08 +01:00
Joshua Ashton 536ed0427a vkd3d: Create user buffers for degenerate surfaces
Previously this would make the user buffer count == 0, which obviously makes apps and assertions not happy.

Fixes a crash in Horizon Zero Dawn when minimized (therefore having a degenerate surface region)

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-09 15:34:08 +01:00
Joshua Ashton c77428ba44 vkd3d: Implement DXGI_PRESENT_TEST
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-09 15:34:08 +01:00
Alexander Gabello da4a96a25b vkd3d: Free string after PIX decoding
Signed-off-by: Alexander Gabello <alexandergabello@mail.weber.edu>
2020-11-09 10:55:05 +01:00
Philip Rebohle 432ba00e3c vkd3d: Only care about DSV mismatch if pipeline actually uses it.
Avoids some unnecessary late compiles in Monster Hunter World.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-06 16:36:27 +01:00
Philip Rebohle 58548a3db2 vkd3d: Fix image memory barrier after fragment shader-based copy.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-06 16:07:47 +01:00
Philip Rebohle 408fed0910 vkd3d: Fix root descriptor indexing.
The packed descriptor index is no longer needed, and causes issues in
case a game sets a root signature, then binds a root descriptor, and
then sets a different root signature which maps the given root parameter
index to a different descriptor since we may now read undefined data
when updating push descriptors.

Fixes #366.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-06 16:07:47 +01:00
Joshua Ashton 8dea487861 meta: Add missing newlines to end of files
Remove trailing whitespace also

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-05 17:16:57 +01:00
Hans-Kristian Arntzen 490d803581 vkd3d-shader: Add OpSource support to DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-05 15:57:16 +01:00
Hans-Kristian Arntzen 7e14f80e2a vkd3d-shader: Emit OpSource with DXBC hash.
Makes it possible to backtrace which shader we're working with
when we get raw SPIR-V from unrelated sources (Fossilize or RADV crash
dumps for example).

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-05 15:57:16 +01:00
Philip Rebohle a8f9cc15b3 vkd3d: Create root signature from shader blobs as necessary.
MSDN states that root signatures across multiple stages in a graphics
pipeline must be identical, but the D3D12 runtime does not validate
this and mixing different root signatures results in undefined
behaviour, so just taking this from the VS should be safe.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-05 15:21:16 +01:00
Philip Rebohle 1d823f8659 vkd3d: Do not store root signature in graphics pipeline state.
We only need to know the pipeline layout for pipeline variant
creation. We are not holding a strong reference to the root
signature anyway, which may be problematic, but this should
not introduce a regression.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-05 15:21:16 +01:00
Georg Lehmann 98f005116b build: Replace enable_standalone_d3d12 with tristate enable_d3d12.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2020-11-04 23:38:02 +00:00
Hans-Kristian Arntzen e4600edb03 vkd3d: Always enable typed offset buffer.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen f1991d4458 vkd3d: Init descriptor heap offset buffer if we're only using typed.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 670fba6c6f vkd3d: Enable typed offset buffer in root signature.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 320b643c77 vkd3d-shader: Add typed offset to DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen bcd03de770 vkd3d-shader: Implement typed buffer offset.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 1c14fc9334 vkd3d: Write typed buffer offsets to buffer.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen d23c7200a2 vkd3d: Always copy offset buffer descriptor info.
Offset buffer state might be the only relevant difference between two
descriptors. We won't need to copy descriptors, but the offsets must be.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 5832d2fbdd vkd3d: Refactor out typed buffer view creation.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 749ac13f5e vkd3d: Rename vkd3d_buffer_view_get_bound_range.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen f0754c4460 vkd3d: Apply offset to typed UAV as well in ClearUAV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen b30d8788bf vkd3d: Rename SSBO_OFFSET descriptor flag to BUFFER_OFFSET.
It is used for typed as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 5d88e4d435 vkd3d: Add a definition for typed offset buffer as well.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen fdd16168be vkd3d: Rename SSBO_OFFSET_BUFFER to a more generic offset buffer.
We will use it for typed buffers as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen 5674ced973 vkd3d: Report if view maps have intense pressure.
This will lead to a crash if it goes too far.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Hans-Kristian Arntzen e31eae075b vkd3d: Fix deadlock after failing to create view map entry.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Joshua Ashton 5c1b40b856 vkd3d: Init hashmap in vkd3d_create_image_resource
Closes: #353
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-03 09:39:35 +01:00
Joshua Ashton f50c897868 build: Merge vkd3d_headers into vkd3d_common
Fixes MSVC build.
Closes: #343

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-03 09:37:24 +01:00
Philip Rebohle 601abe7408 vkd3d: Reset RTV/DSV descriptors when creating NULL descriptor.
Otherwise, we may run into issues with an app accessing stale resource
or pointers. NULL descriptors are handled in OMSetRenderTargets.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 17:02:17 +01:00
Philip Rebohle f29b397a9f vkd3d: Implement RTV/DSV descriptor copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 17:02:17 +01:00
Philip Rebohle f3c35b2992 vkd3d: Remove unused descriptor magic from RTV/DSV descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 17:02:17 +01:00
Philip Rebohle 211704be3f vkd3d: Use per-resource view maps to create render target views.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 17:02:17 +01:00
Philip Rebohle 109c881ccb vkd3d: Unify RTV and DSV descriptor types.
The struct definitions were identical anyway, and unifying
these will prevent unnecessary code duplication.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 17:02:17 +01:00
Philip Rebohle bd1de243d3 vkd3d: Don't skip indirect dispatches with count buffer.
The only currently known use case for this requires us to actually
perform the dispatch operation. Executing more than one indirect
dispatch command is not meaningful, however there might be
differences in behaviour in case the indirect count is zero.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 16:56:18 +01:00
Philip Rebohle c50e529be0 vkd3d: Fix descriptor table mask when populating inline uniform block data.
This logic has to be the same as in d3d12_command_list_update_descriptor_table_offsets,
since not all active descriptor tables are necessarily used by the root signature.

Fixes an assert in the StarsX IrradianceMap demo (Github issue #347).

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-30 16:56:18 +01:00
Philip Rebohle 1abae6eb06 vkd3d-shader: Remove unused sampler comparison mask.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-29 15:39:40 +01:00
Philip Rebohle a2d85f6040 vkd3d-shader: Use new register map to store UAV flags.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-29 15:39:40 +01:00
Philip Rebohle 0d82bf67aa vkd3d-shader: Add hash map for register flags to scan info.
This way we won't have arbitrary register count limitations.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-29 15:39:40 +01:00
Philip Rebohle 9832d1639d vkd3d-shader: Remove pNext chain from vkd3d_shader_scan_info.
Unused.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-29 15:39:40 +01:00
Joshua Ashton c72fb12353 build: Only generate headers once
This makes headers a dependency rather than a generator target.
This also means we get proper dependency tracking of them between projects.

Supercedes: #225
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-29 10:02:48 +01:00
Joshua Ashton a1a6840fb5 vkd3d-utils: Move to .def exports
Otherwise this won't work in MSVC because it'd technically be re-defining the D3D12 function prototypes with the decltypes.

There is no other nice way around this.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-28 17:05:13 +01:00
Joshua Ashton 37e6647ab0 vkd3d-utils: Add D3D12EnableExperimentalFeatures interface
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-28 17:05:13 +01:00
Hans-Kristian Arntzen bb1d57b769 vkd3d: Use INFO rather than TRACE for some relevant messages.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 17:03:54 +01:00
Hans-Kristian Arntzen d8bd309ab2 vkd3d: Log vkd3d applicationVersion and build hash.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 17:03:54 +01:00
Hans-Kristian Arntzen cd9c1fb9f3 vkd3d: Add an INFO debug level.
Useful for cases where we want to communicate important information to
the log by default, but not consider it an error.

Requested information which would only be logged when explicitly asked
for should also be considered INFO.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 17:03:54 +01:00
Hans-Kristian Arntzen 8cd30ee1c7 build: Rename exposed APIs to reflect vkd3d-proton and update to 2.0.
Rename so objects we build so we don't conflict with vkd3d and don't
accidentially attempt to be built against Wine natively (it won't work).

Not quite ready for a 2.0 release yet, but bump the version to reflect
the intent. This creates a new timeline, completely separate from vkd3d.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 14:39:09 +01:00
Hans-Kristian Arntzen 7359720448 Update so-version to 2.0.
We've broken ABI compatibility with 1.1 with swapchain rework.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 14:39:09 +01:00
Hans-Kristian Arntzen 4d961f96ea vkd3d: Fix some nits with declaration-after-statement.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 11:04:06 +01:00
Krzysztof Bogacki 61b13cc278 build: Use separate version string and build hash
Version string is used in logging for information purposes, but pipelines blobs and libraries use uint64_t–based commit hash. Using fixed–size integer silences warnings about string length and makes storing build info a little more efficient.

The hash is obtained separately from version string and is shifted to the left by 4 bits if the working tree is dirty.

Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2020-10-28 10:40:28 +01:00
Philip Rebohle 49d3fa30a7 vkd3d: Enable offset buffer as necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Hans-Kristian Arntzen a4f68931bb vkd3d-shader: Add offset buffer path to DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 10:30:12 +01:00
Philip Rebohle 127b498a5a vkd3d: Adjust SSBO descriptors based on alignment requirements.
And write data to the offset buffer.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 374adc8bb7 vkd3d: Account for buffer offset info in clear_uav.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle b57a5dd96d vkd3d: Add extra binding for SSBO offset buffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 811235858c vkd3d: Allocate descriptor heap buffer storage for bound SSBO ranges.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 7aaae61c64 vkd3d: Refactor descriptor heap buffer creation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle 15b1fb7128 vkd3d: Restore d3d12_device_use_ssbo_root_descriptors.
We will not have offset information for root descriptors, so
we can still only use them with four-byte aligned SSBOs.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle d59317e11b vkd3d-shader: Use offset buffer for bufinfo instruction.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle fc9efddbd4 vkd3d-shader: Use offset buffer when indexing into raw SSBO.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Philip Rebohle bea196e449 vkd3d-shader: Declare offset buffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Krzysztof Bogacki f7cca758a6 vkd3d: Bit–shift last argument of MAKE_MAGIC
Signed-off-by: Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
2020-10-27 19:52:57 +01:00
Joshua Ashton 7609c5e59e vkd3d-shader: Implement 64-bit immediate constants
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton 73a2ad19ea vkd3d-shader: Implement DRCP
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton e3a61ebad1 vkd3d-shader: Implement DTOF, FTOD, DTOI, DTOU, ITOD and UTOD
Implement double -> other type conversions

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton aff1391026 vkd3d-shader: Implement DEQ, DGE, DLT and DNE
Implement double comparisons

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton cdedfd596e vkd3d-shader: Implement DMOVC
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton f8646bff5a vkd3d-shader: Implement DADD, DMUL, DDIV, DMAX, DMIN, DFMA and DMOV
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton a581f296ea vkd3d-shader: Handle double-related global flags
Decode and handle DOUBLE_PRECISION_FLOAT_OPS and 11_1_DOUBLE_EXTENSIONS

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton ac2456b01f vkd3d-shader: Implement double data type
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Joshua Ashton 8e896cd25a vkd3d-shader: Support 64-bit constants
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-23 12:40:38 +02:00
Philip Rebohle dd13d44bd5 vkd3d: Use UAV counter address binding from descriptor heap.
Instead of binding it via push descriptors at draw time.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-23 12:36:17 +02:00
Philip Rebohle a76e311c5e vkd3d: Add UAV counter address buffer to descriptor heap bindings.
Introduces 'extra' bindings to bindless sets which can be used to
bind additional storage buffers to the pipeline, which will occur
before the bindless descriptor array in the descriptor set.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-23 12:36:17 +02:00
Philip Rebohle 7e32f833ed vkd3d: Store binding index in descriptor.
Needed for when we add additional descriptors to the bindless
descriptor sets.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-23 12:36:17 +02:00
Hans-Kristian Arntzen 16f09a0ba0 vkd3d: Do not perform any alignment analysis for SSBOs.
We cannot rely on alignment analysis since games are buggy and screw up
RAW vs structured on occasion.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-22 13:07:05 +02:00
Joshua Ashton ae93fe0941 vkd3d: Remove VKD3D_RESOURCE_PUBLIC_FLAGS
There was no reason to mask this anyway when importing images.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-22 09:30:24 +02: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 eed4f54a80 vkd3d: Enable SSBO path.
For now, don't enable it on NV due to a very likely driver bug.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-21 14:34:37 +02:00
Hans-Kristian Arntzen 0801b0d55f vkd3d-shader: Hook up typed uav read without format on DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-21 14:34:37 +02:00
Hans-Kristian Arntzen 216f04d8f1 vkd3d-shader: Hook up new SSBO path for DXIL.
Update dxil-spirv submodule.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-21 14:34:37 +02:00
Hans-Kristian Arntzen 50ffdb1850 vkd3d-shader: Don't warn about not finding a RAW_SSBO binding.
This is expected if host implementation does not support RAW_SSBO
alignment.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-21 14:34:37 +02:00
Joshua Ashton aadf3e15f9 vkd3d-shader: Hook up EMIT_THEN_CUT_STREAM
Still needs work to handle emitting a specific stream.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-21 11:49:31 +02:00
Joshua Ashton b70182420a vkd3d-shader: Implement EMIT_THEN_CUT
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-21 11:49:31 +02:00
Joshua Ashton 31901597d9 vkd3d-shader: Implement EVAL_SNAPPED
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-21 11:49:31 +02:00
Joshua Ashton 1673d14841 vkd3d-shader: Implement UMUL
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-21 11:49:31 +02:00
Joshua Ashton 7c693fe26f vkd3d-shader: Implement UMAD
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-21 11:49:31 +02:00
Philip Rebohle a64a34eb9d vkd3d-shader: Implement coherent qualifier for UAVs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-20 14:44:55 +02:00
Joshua Ashton 36f6715b38 vkd3d-shader: Rename TEXKILL to DISCARD
TEXKILL is the old D3D9 style naming that comes with funky .w implications.
Calling DXBC's discard texkill is misleading.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-19 19:12:48 +02:00
Joshua Ashton 69bfad91a8 vkd3d-shader: Remove d3d9 clutter
All of this is entirely unused and just cluttering up.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-19 19:12:48 +02:00
Joshua Ashton b65f6ad02c vkd3d-shader: Add missing opcodes
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-19 17:27:07 +02:00
Philip Rebohle f9c712ded0 vkd3d: Fix descriptor layout mismatch for ClearUAV.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 17:38:58 +02:00
Philip Rebohle 544a6184e9 vkd3d: Enable raw SSBOs for root descriptors on supported hardware.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 16:20:26 +02:00
Philip Rebohle 4841630876 vkd3d: Store descriptor type with root descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 16:20:26 +02:00
Hans-Kristian Arntzen 1c76072819 vkd3d: Use EXTENDED_USAGE_BIT on mutable format images.
If the image itself is sRGB or some other format that does not support
STORAGE, we need this flag.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 5b44ffa831 swapchain: Fix warnings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 69f54ae049 swapchain: Handle maxImageExtent of 0.
This can happen on Windows when windows are minimized.
Might not happen in winevulkan, but Vulkan spec outlines this Win32 case
explicitly and it happens on native Windows.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 65031753ae swapchain: Blit to screen with render pass.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 09b0675b53 swapchain: Handle VK_SUBOPTIMAL_KHR.
It is considered a "success", in that fences must be signalled, so make
sure we wait and reset it so we don't risk calling vkAcquireNextImageKHR
later with an already signalled fence.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 9b25141bb8 swapchain: Only support user images.
Only way to implement a D3D12 swapchain.
For now, disable compute paths, we'll introduce it properly after refactor.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Hans-Kristian Arntzen 4f0bc383b7 swapchain: Make use of initial image transition.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01: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 a8ef7384b4 vkd3d: Remove support for obsolete PRESENT_STATE_TRANSITION.
It is broken by design and won't be needed by a swapchain
implementation which uses user buffers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 13:25:59 +01:00
Philip Rebohle 677e55c6f9 vkd3d: Store UAV counter address in d3d12_desc.
May improve performance since the UAV counter buffer is
stored in uncached memory.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 991d40006b vkd3d: Fix maximum workgroup count for clearing buffer UAVs.
Buffer views do not necessarily cover the entire resource, so we
should not spawn more workgroups than necessary to clear the view.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 6401cc353e vkd3d: Support raw buffer views in ClearUnorderedAccessView*.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 3e1445eacb vkd3d: Add meta pipeline to clear raw storage buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 290f44254a vkd3d: Implement descriptor updates for SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 993cdd254e vkd3d: Emit resource declarations for raw SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 3eac9f9c7d vkd3d: Introduce vkd3d_bindless_set_flag.
This will allow us to use the same bindless descriptor set for
different types of descriptor ranges.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle c097c00167 vkd3d: Explicitly set descriptor types for bindless sets.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle d3abc66399 vkd3d: Do not store UAV counter info in vkd3d_view.
We won't necessarily have a view once we support raw SSBOs.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 07e6687f6a vkd3d: Rework descriptor set lookup.
This is no longer performance-critical, so in order to simplify changing
the binding model, remove hard-coded descriptor set numbers and instead
look them up based on the requested descriptor properties.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle bffadd1f23 vkd3d: Rename vk_cbv_info -> buffer.
This will no longer be exclusive to constant buffer views.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 6461ab8272 vkd3d-shader: Implement bufinfo instruction on SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 89dbd9254f vkd3d-shader: Implement atomic operations on SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle f12f15ff38 vkd3d-shader: Implement raw and structured stores to SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle 2d2dc323d5 vkd3d-shader: Implement raw and structured loads from SSBOs. 2020-10-16 14:24:36 +02:00
Philip Rebohle 367cda017f vkd3d-shader: Implement resource declarations with raw SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Philip Rebohle b82bbe265e vkd3d: Pass storage buffer alignment to shader compiler.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Hans-Kristian Arntzen 3a4e555e9c vkd3d: Track if we have a valid index buffer bound.
Ignore any indexed draw calls which uses a NULL index buffer.
This is not fully correct, but there is no easy way to emulate D3D12
behavior exactly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-16 12:27:20 +02:00
Hans-Kristian Arntzen f1818c267f vkd3d: Fix menu regression in RE2.
If rendering to A8 format, do not apply output swizzle in non-PS stages.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-14 10:46:46 +02:00
Hans-Kristian Arntzen f0f1ca161f vkd3d: Always pass down compiler args.
Needed for all stages since typed UAV read can happen in all stages.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 14:55:24 +02:00
Hans-Kristian Arntzen 202a3257d7 vkd3d: Make use of StorageImageReadWithoutFormat if supported.
Death Stranding makes use of typed load from RGB10A2.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 14:55:24 +02:00
Hans-Kristian Arntzen 85dbb6c569 vkd3d-shader: Support StorageImageReadWithoutFormat.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 14:55:24 +02:00
Hans-Kristian Arntzen af5a4cf311 vkd3d: Use a unique cookie per resource/view.
We cannot compare resource pointers or view pointers,
since the pointers might have been recycled.
This leads to a scenario where we're not updating descriptors we're
supposed to, and the GPU reads a stale descriptor.

Fixes a GPU hang in Death Stranding (and possibly lots of other weird
crashes as well).

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 12:46:07 +02: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
Hans-Kristian Arntzen 6d2f540a40 vkd3d: Transition from UNDEFINED if a copy command writes everything.
An optimization and a requirement in D3D12. Clearing out an image
through a copy is considered enough to satisfy the requirement to acquire an
alias in the advanced usage model.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-08 14:30:50 +02:00
Hans-Kristian Arntzen 9c04f35757 vkd3d: Fix validation error when render pass is used without attachment.
Just drop the VkSubpassDependency in this case to satisfy the validator,
since stages == 0 is not allowed.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-07 17:43:53 +02:00
Hans-Kristian Arntzen 89235b7bc0 meta: Implement meta for swapchain pipelines.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen 97d8568f88 meta: Add vert/frag shaders for fullscreen swapchain pass.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen d626a0bde9 meta: Add custom vertex shaders to vkd3d_meta_create_graphics_pipeline.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen c59a6abfbd meta: Introduce vkd3d_meta_create_sampler.
Will be used for immutable samplers for scalers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen 44977b63b2 vkd3d: Move vkd3d_view_key to private header.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-06 13:15:31 +02:00
Hans-Kristian Arntzen 70af36a6e2 swapchain: Actually use matching mode when going fullscreen.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-05 19:53:05 +02:00
Hans-Kristian Arntzen d02d95f606 swapchain: Workaround weird behavior with FindClosestMatchingMode.
Use a default format if there is no format specified.
Otherwise, the call fails on both Wine and DXVK DXGIs.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-05 19:53:05 +02:00
Hans-Kristian Arntzen 624e42f742 swapchain: Add thread safety.
IDXGISwapchain should be thread safe, doesn't cost much to add it.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-05 19:53:05 +02:00
Joshua Ashton f5b2f45f13 vkd3d: Use already existing format for sparse multi-planar test
This was wrong anyway as it assumed depth always.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:50:28 +02:00
Joshua Ashton eee64787c7 vkd3d: Keep track of vkd3d_format for resources
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:50:28 +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 be2c0c1f1e include: Remove DECLSPEC_HIDDEN from headers
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:44:10 +02:00
Joshua Ashton e09f129064 vkd3d: Use enum for VKD3D_META_COPY_MODE
Just some extra type-safety.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 13:00:32 +02:00
Joshua Ashton 2d3df0838a vkd3d: Use generated shaders
Now we don't have the autotools path, we can use what we make now.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 13:00:32 +02:00
Joshua Ashton fa60742114 build: Remove autotools build path
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 13:00:32 +02:00
Joshua Ashton 3c54cf8ad6 vkd3d: Use VK_NULL_HANDLE instead of NULL for VkPipelineCache
Fixes a warning in MSVC.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-09-30 01:44:50 +02:00
Philip Rebohle 759e21d821 vkd3d: Remove d3d12_descriptor_heap_set_index_from_magic.
Unused, should have been in previous commit. Whoops.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 15:15:49 +02:00
Hans-Kristian Arntzen 9d36ab59d6 vkd3d: Add support for a shader debug ring.
Will allow replaced shaders to emit debug messages to a buffer.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-29 15:00:36 +02:00
Philip Rebohle 29fe4da015 vkd3d: Remove unused fields from d3d12_desc.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 0450ae9f85 vkd3d: Introduce VKD3D_DESCRIPTOR_FLAG_VIEW.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle eb0ada76e8 vkd3d: Remove unused code for descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 3682e4d9f7 vkd3d: Rework UAV descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 3177d80814 vkd3d: Rework SRV descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle c2439d67b8 vkd3d: Rework sampler descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Philip Rebohle 5c066940a0 vkd3d: Rework CBV descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-29 14:48:26 +02:00
Hans-Kristian Arntzen 250357c998 debug: Integrate automatic RenderDoc capturing.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-22 12:44:18 +02:00
Hans-Kristian Arntzen 1ce14c2ef3 vkd3d: Remove bindless CBV workaround.
Not relevant anymore, and should see good uplift on NV depending on
content.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-11 16:54:00 +02:00
Hans-Kristian Arntzen e823715ac8 vkd3d: Clean up warnings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-11 15:20:52 +02:00
Philip Rebohle cea17b2440 vkd3d: Don't call vkGetPipelineCacheData on a null handle.
On systems without extended dynamic state, or for certain pipelines,
it is possible for vk_pso_cache to be VK_NULL_HANDLE, so we need to
check for this during serialization.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 18:11:41 +02:00
Hans-Kristian Arntzen 52ecd35dee vkd3d: Set shader module name to the hash.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Hans-Kristian Arntzen adde8947c6 vkd3d: Trace which pipelines are being bound and if they are replaced.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Hans-Kristian Arntzen 586f002536 vkd3d-shader: Add shader replacement.
For debugging purposes, it can be extremely useful to be able to
pinpoint and replace specific shaders for testing hypotheses.

To make this practical, change the shader dumping to use hashes rather
than monotonically incrementing indices.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Hans-Kristian Arntzen f473370678 vkd3d-shader: Add hash function for shader blobs.
Simple FNV-1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Hans-Kristian Arntzen b93963b6ce debug: Log thread ID as well.
For multi-threaded apps, this is vital to make any sense of the log.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Philip Rebohle 3a39f38fc5 vkd3d: Advertize support for relevant shader cache features.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Philip Rebohle dcb03257f9 vkd3d: Implement pipeline library functionality based on VkPipelineCache.
This is used extensively by Horizon Zero Dawn, and allows us
to skip the compile screen after the initial first run.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Philip Rebohle 92b6e71ce4 vkd3d: Factor out pipeline state struct conversion.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Philip Rebohle d4f4e34656 vkd3d: Remove pipeline cache from d3d12_device.
Unused now, instead we should implement D3D12 caching primitives
correctly and rely on the Vulkan driver otherwise.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Philip Rebohle 15ed944e40 vkd3d: Implement ID3D12PipelineState::GetCachedBlob.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Philip Rebohle 0396ee544c vkd3d: Implement support for cached PSO pipeline state.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Philip Rebohle 2b885c4981 vkd3d: Move ID3D12PipelineLibrary imlpementation to separate file.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Hans-Kristian Arntzen eb4ce56139 vkd3d: memset instance and device structs.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 09:34:26 +02:00
Robin Kertels 51d2a3bad2 vkd3d: Set VKD3D_DYNAMIC_STATE_VERTEX_BUFFER when binding a new pipeline
... if we have dirty vbo slots left.

Fixes textures when inspecting items in the inventory in RE2 and RE3.

Signed-off-by: Robin Kertels <robin.kertels@gmail.com>
2020-09-06 10:08:33 +02:00
Hans-Kristian Arntzen ec441808c8 vkd3d: Emit host memory barrier as needed.
There is no resource state associated with this, so emit the barrier at
the end of a command buffer based on trivial tracking.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-02 14:46:12 +02:00
Hans-Kristian Arntzen 92b4f13f76 vkd3d: Zero out descriptor heaps on allocation.
Only bother if nullDescriptors are supported.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-08-31 17:22:17 +02:00
Philip Rebohle 2fd2cb1be2 vkd3d: Implement generic fallback for WriteBufferImmediate.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-28 17:27:05 +02:00
Philip Rebohle c71e70335a vkd3d: Implement WriteBufferImmediate with AMD_buffer_marker.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-28 17:27:05 +02:00
Philip Rebohle 6940716417 vkd3d: Enable VK_AMD_buffer_marker if available.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-28 17:27:05 +02:00