Commit Graph

742 Commits

Author SHA1 Message Date
Philip Rebohle c9525cf5ca vkd3d: Allocate new virtual query for active queries as necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle b995780de1 vkd3d: Reimplement binary occlusion query resolve.
No longer requires BDA support since it's easier now to work
around buffer alignment issues.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle 32f7ba6630 vkd3d: Use virtual queries for inline query types.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle 4a558ce501 vkd3d: Compute query stride from heap type rather than query type.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle 39c7f8f32d vkd3d: Introduce pending query list.
This will store the list of queries to resolve.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle 6e3a7d37cc vkd3d: Store more information in active query list.
Allows us to map D3D12 queries to virtual queries and vice versa.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle 16f5cff061 vkd3d: Implement virtual query allocation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-19 14:11:46 +01:00
Philip Rebohle 6bddcb4352 vkd3d: Store both byte range and element range in offset buffer.
The first range will store the byte offset, the second one will
be the typed buffer range. Typed descriptors should write both.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Co-authored-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-01-14 15:34:20 +01:00
Philip Rebohle f25df5b453 vkd3d: Reset inline queries in BeginQuery.
We currently never reset occlusion queries. For some reason,
validation layers do not report this.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-01-14 13:38:21 +01:00
Philip Rebohle b8c96d9b30 vkd3d: Add workaround to disable occlusion query optimization.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-12 13:01:52 +01:00
Hans-Kristian Arntzen 051ba691be vkd3d: Clarify comment about not using MEMORY_READ/WRITE.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-07 20:45:02 +01:00
Philip Rebohle c057e881dc vkd3d: Do not interrupt render pass for occlusion queries.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-07 15:18:12 +01:00
Philip Rebohle c4fbe47106 vkd3d: Do not interrupt render pass for timestamp queries.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:54:35 +01:00
Philip Rebohle e13d69ad27 vkd3d: Batch query pool reset commands if possible.
By resetting query pools in advance, we can reduce the number of
stalls between draw calls in passes with occlusion queries, which
is currently causing serious performance issues in some games.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Philip Rebohle 648e41716b vkd3d: Add additional command buffer to batch intialization commands.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Philip Rebohle d0fc57413e vkd3d: Merge adjacent query ranges on insertion.
Since we'll be inserting lots of single queries, we want to
avoid having to resize the range array since that is an O(n)
operation at worst.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Philip Rebohle 81e6449f67 vkd3d: Add code to track query ranges used within a command list.
Useful to batch vkCmdResetQueryPool calls.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-12-03 16:21:43 +01:00
Hans-Kristian Arntzen b85a345d48 vkd3d: Fix const-ness warning on MSVC.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Philip Rebohle 2ec68af1d5 vkd3d: Add fallback path for predication using indirect draws.
Official AMD drivers do not support VK_EXT_conditional_rendering,
so we'll use indirect draws instead to emulate the feature.

This also handles 64-bit predicates in combination with the
Vulkan extension, which was not possible previously.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-27 12:43:39 +01:00
Philip Rebohle 2c9bacd760 vkd3d: Perform binary occlusion query fixup on scratch buffer.
Potentially avoids some unnecessary host memory access. Use BDA for
the compute shader so that we can ignore alignment restrictions on
some GPU architectures.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-24 16:45:55 +01:00
Philip Rebohle afb85c79cd vkd3d: Add code to create, destroy and recycle scratch buffers.
Command lists may need to allocate temporary device memory for
certain operations. In order to avoid frequent alloc/free calls,
we'll recycle these scratch buffers until a certain threshold.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-24 16:45:55 +01:00
Hans-Kristian Arntzen 19193bf932 vkd3d: Sanitize VBO strides and VBO offsets.
Realign VBO strides and offsets if we have to, for sake of
robustness. Violating these rules is against D3D12 spec, but it does not
cause crashes on native drivers. On RDNA we can hit hangs with unaligned
vertex attributes. It appears that native drivers apply some kind of
fixup here to avoid the crash, even if the result is not what we expect.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-24 15:07:29 +01:00
Hans-Kristian Arntzen 10b503c893 vkd3d: Fallback to NULL VA when binding non-existent VBO.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-24 15:07:29 +01:00
Philip Rebohle 8cbecfb9f6 vkd3d: Fix offset for predicate buffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-20 11:23:06 +01:00
Philip Rebohle fb6f078ba9 vkd3d: Fix up binary occlusion query results.
In D3D12, these return 1 rather than an actual sample count.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 22:08:42 +01:00
Philip Rebohle 6886bb7f11 vkd3d: Handle empty viewports.
Assassin's Creed Valhalla relies on this.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-19 14:31:39 +01:00
Hans-Kristian Arntzen d0328e8760 vkd3d: Fix uninitialized variable in initial WSI transition.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 16:40:17 +01:00
Hans-Kristian Arntzen 52ee2edc3d vkd3d: Separate root VA use for CBV and SRV/UAV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-18 15:49:31 +01:00
Philip Rebohle 215989f6d5 vkd3d: Rework query pool initialization.
Ensures that queries are always available and initialized
in the correct order on the GPU timeline.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 15:45:28 +01:00
Philip Rebohle bb9d0f2741 vkd3d: Rework initial transitions to allow for different types.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 15:45:28 +01:00
Hans-Kristian Arntzen 3e15a3f06a vkd3d: Remove manual tracking of host barriers.
Just emit host barrier on submit unconditionally.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-17 16:34:03 +01:00
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
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
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
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 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 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
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
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
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 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 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
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
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 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 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 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
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 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
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
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
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 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
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
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
Hans-Kristian Arntzen e3d2484a49 vkd3d: Rewrite timeline semaphore handling.
Need to handle large (> 4G) jumps in timeline value, which is not
supported by all implementations.

There is no good way to handle that, so rewrite and clean up timeline
semaphore handling by separating the timeline into a virtual timeline
(which can rewind and jump around arbitrarely) and a physical timeline
which increments by one each time.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-08-28 14:13:47 +02:00
Philip Rebohle 0d0917508b vkd3d: Remove VKD3D_DESCRIPTOR_POOL_TYPE_IMMUTABLE_SAMPLER.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-26 14:56:17 +02:00
Philip Rebohle 17cf1f69d7 vkd3d: Use global descriptor sets for static samplers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-26 14:56:17 +02:00
Philip Rebohle 684c658e22 vkd3d: Do not ref-count view in ClearUnorderedAccessView.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-19 12:54:56 +02:00
Philip Rebohle 7785c60a08 vkd3d: Add image parameter to vk_image_view_desc.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-19 12:54:56 +02:00
Philip Rebohle 3c9a54cb73 vkd3d: Introduce vkd3d_buffer_view_desc.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-19 12:54:56 +02:00
Philip Rebohle 3364758746 vkd3d: Remove volatile packed descriptor handling.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-30 11:56:24 +02:00
Philip Rebohle fd249acb64 vkd3d: Remove packed descriptor set update code.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-30 11:56:24 +02:00
Philip Rebohle 3766e7e994 vkd3d: Rename BINDLESS_UAV_COUNTERS -> RAW_VA_UAV_COUNTERS.
For clarity, since we'll be moving to full bindless anyway.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-29 15:23:25 +02:00
Philip Rebohle fa3085400d vkd3d: Handle pRegion == NULL in DiscardSubresource.
Fixes a crash in Shadow of the Tomb Raider.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-23 16:23:31 +02:00
Hans-Kristian Arntzen 4611c9a96f vkd3d: Fix warnings in calibrated timestamp implementation.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-22 10:52:03 +02:00
Hans-Kristian Arntzen 7df9a48528 vkd3d: Add some other interesting profiling regions.
Useful to measure submission times, as well as time spent acquiring the
Vulkan queues. This correlates 1:1 with swapchain as well, so it's
useful when we want to get some "X / frame" metrics.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-20 16:39:15 +02:00
Hans-Kristian Arntzen 6a60834379 vkd3d: Make profiled vtable for ID3D12GraphicsCommandList4.
Similar to ID3D12Device profiled vtable, disgusting, but it should do
the trick.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-20 16:39:15 +02:00
Philip Rebohle 2729c4ad41 vkd3d: Implement GetClockCalibration.
Manually uses QPC if the Vulkan implementation does not support
the QPC domain by itself.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-17 11:49:38 +02:00
Philip Rebohle c3d5a60e01 vkd3d: Implement DiscardResource.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle ef2eacefee vkd3d: Rework d3d12_command_list_find_attachment.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle 37e7fbd5c5 vkd3d: Rework d3d12_get_view_rect.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Philip Rebohle def7cf409a vkd3d: Introduce discard mask for deferred clear operations.
Allows us to skip clears while still initializing the image.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-16 16:53:17 +02:00
Hans-Kristian Arntzen 96402f1164 vkd3d: Fix straggling warnings for MSVC.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-16 13:00:09 +02:00
Hans-Kristian Arntzen dd6656fbe9 vkd3d: Avoid redundant pipeline binds.
When we're using extended dynamic state, we will often end up with dummy
pipeline binds, which we should try to avoid if we can.
Also avoids having to rebind dynamic state redundantly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 84d9e4b0db vkd3d: Emit vertex buffer sizes even when not using dynamic stride.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 0f91099dd4 vkd3d: Refactor dynamic state to be per-pipeline.
Cleans up dynamic state such that we do not have to keep dynamic state
create infos around.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 5ef3ebce61 vkd3d: Implement extended dynamic state.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 7bccab7427 debug: Re-introduce different debug channels.
vkd3d-shader is currently kinda buggy and crashes when you try to trace
DXBC. This used to never be run since it was guarded by
VKD3D_SHADER_DEBUG, but with the move to a static build we merged all
debug logging under VKD3D_DEBUG. Reintroduce different debug channels in
a way that is compatible with a statically linked vkd3d.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-10 14:18:15 +02:00
Hans-Kristian Arntzen 337f75b76a vkd3d: Workaround broken MEMORY_READ/WRITE on RADV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-09 14:50:50 +02:00
Hans-Kristian Arntzen 1341409b88 vkd3d: Implement aliasing barriers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-09 14:50:50 +02:00
Philip Rebohle fee4781f2b vkd3d: Fix suspended render pass state tracking.
Otherwise, if a render pass gets suspended twice in a row, we
never emit the barrier because render_pass_suspended will be
set to false the second time.

Fixes validation errors in Hitman 2.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-08 17:31:58 +02:00
Hans-Kristian Arntzen cb1da02af9 vkd3d: Fix some warnings.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-06 21:32:16 +02:00
Joshua Ashton 9c105a78a9 vkd3d: Implement swapchain and swapchain factory
Needed for standalone D3D12.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-06 19:29:30 +02:00
Joshua Ashton 08544fb938 vkd3d: Use CONST_VTBL instead of const for vtable decls
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-07-03 16:56:10 +02:00
Philip Rebohle e10b9a72e2 vkd3d: Handle views being null in non-bindless descriptor updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle fbbcb30590 vkd3d: Use NULL descriptors for vertex buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Philip Rebohle 87bf1e8937 vkd3d: Use NULL descriptors for undefined root descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-06-29 17:18:29 +02:00
Joshua Ashton 45d4296a54 vkd3d: Rename vkd3d_uint32_atomic to vkd3d_atomic_uint32
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 033f76e3ae vkd3d: Define our own memory orders
We shouldn't potentially override stuff in the std library and this allows us to map directly to __ATOMIC_* memory orders which is more correct.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Hans-Kristian Arntzen 349412f19f vkd3d: Support rewinding ID3D12Fence.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-16 11:00:08 +02:00
Hans-Kristian Arntzen 5ef7b99e0b vkd3d: Fix uninitialized return value in CPU fence signaling.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-16 11:00:08 +02:00
Joshua Ashton cd5d01d25c vkd3d: Refactor atomics
There is no stdatomic available on MSVC so let's clean things up.

This moves all the atomic helpers to vkd3d_atomic.h and implements all platform's spinlocks in entirely the same way.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-15 20:40:10 +02:00
Joshua Ashton b9909854fe vkd3d: Make nameless unions really nameless
This makes it consistent across tests and vkd3d.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-15 19:59:52 +02:00
Hans-Kristian Arntzen 9defd87f95 vkd3d: Implement BeginEvent/EndEvent.
Only support ANSI/UNICODE version for now. The PIX3BLOB format is
extremely weird, complicated and undocumented.
We can refer to RenderDoc if we need it later ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen 9534c1a345 vkd3d: Move to VK_EXT_debug_utils.
debug_marker/debug_report are both deprecated in favor of debug_utils and vkd3d was using marker in a
buggy way anways, as debug_marker requires debug_report to work, but it was
only conditionally enabled.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-11 13:02:50 +02:00
Hans-Kristian Arntzen d8ca2cef6d vkd3d: Serialize all queue submissions.
Gets rid of the full barrier on command buffer end.
Instead, do what D3D12 wants, which is to serialize all
ExecuteCommandLists. Simplify the existing timeline sempahore setup for
sparse queues and use it for all submissions.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-06-09 14:28:13 +02:00
Hans-Kristian Arntzen 9875d65d35 vkd3d: Apply heap offsets for ExecuteIndirect buffers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-05-29 13:03:32 +02:00
Philip Rebohle 1ade8c0cc5 vkd3d: Issue full barrier at the end of command lists.
D3D12 apparently does this implicitly. Fixes rendering issues in
the AMD COCOA demo on Polaris with RADV, which does not emit a
barrier between the AO compute passes and the tone mapping pass
in the next command buffer.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-27 14:59:21 +02:00
Philip Rebohle 50a9fae263 vkd3d: Silence SetMarker/BeginEvent/EndEvent log spam.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:27:02 +02:00
Philip Rebohle 6707f3fc30 vkd3d: Invalidate descriptor heaps on root signature change.
Apparently we need to do this if the push constant layout changes.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:27:02 +02:00
Philip Rebohle c75bbb9997 vkd3d: Handle null root descriptors.
We should hook this up to the robustness2 feature at some point,
but for now, just use the dummy descriptors. Fixes a crash in
the AMD CACAO demo.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-12 12:27:02 +02:00
Philip Rebohle 8588b46900 vkd3d: Implement d3d12_command_list_CopyTiles.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-08 16:30:54 +02:00
Philip Rebohle 2e0ce6a186 vkd3d: Serialize sparse binding calls.
In D3D12, Update/CopyTileMappings are implicitly synchronized with
respect to other commands executing on the same queue, which means:

- Signal and Execute have to wait for previously submitted
  sparse binding operations to complete
- Wait and Execute have to complete before subsequently
  submitted sparse binding operations can execute.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 73bcd3e79d vkd3d: Create semaphores for sparse binding operations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 902ab95ba6 vkd3d: Factor out vkd3d_create_timeline_semaphore.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle e1b75748a2 vkd3d: Implement d3d12_command_queue_CopyTileMappings.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle f56a860bc6 vkd3d: Implement d3d12_command_queue_UpdateTileMappings.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle e3eb3498c2 vkd3d: Implement sparse binding.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-07 15:24:35 +02:00
Philip Rebohle 0d74a13bc4 vkd3d: Improve error handling in d3d12_command_queue_init.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-06 14:48:59 +02:00
Philip Rebohle e59d6c4c32 vkd3d: Clean up queue creation and management.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-05-06 14:48:12 +02:00
Philip Rebohle 6f517a3788 vkd3d: Fix UpdateTileMappings signature.
Also, formatting.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-30 18:08:25 +02:00
Philip Rebohle 9367fd5ee8 vkd3d: Implement deferred clears.
This allows us to perform clears inside the render pass even if
the render pass hasn't been started at the time of the clear yet.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle 7bfe5d0bb3 vkd3d: Remove d3d12_command_list_clear.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle fe269109ef vkd3d: Reimplement ClearRenderTargetView.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle 1cffdb93f2 vkd3d: Reimplement ClearDepthStencilView.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle 0bd0352073 vkd3d: Introduce d3d12_command_list_clear_attachment helper.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-28 16:29:11 +02:00
Philip Rebohle e6bd3cb305 vkd3d: Don't emit barriers when temporarily suspending render passes.
Fixes performance regressions introduced with the barrier rework.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 16:13:19 +02:00
Philip Rebohle d355f03d66 vkd3d: Fix depth-stencil load/store ops.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 16:13:19 +02:00
Philip Rebohle 1b447bd2dd vkd3d: Fix image layouts for swap chain back buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 1eac9936f4 vkd3d: Transition DSV to correct layout.
Now uses the layout from the graphics pipeline.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 0ff0423538 vkd3d: Store DSV layout with graphics pipelines.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle f0570509c1 vkd3d: Fix image layouts for clear operations.
We'll need to revisit this as the current implementation is
not only inefficient but also wrong in quite a few ways.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle ae89f2d639 vkd3d: Fix image layouts for resolve operations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 82032e9e58 vkd3d: Fix image layouts for buffer<->image copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 151f18d9ef vkd3d: Fix image layouts in d3d12_command_list_copy_image.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 8d9d23a9f9 vkd3d: Rework d3d12_command_list_ResourceBarrier.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 5bb613ac07 vkd3d: Use common layout in initial state transitions.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle fc60b6400c vkd3d: Introduce vk_access_and_stage_flags_from_d3d12_resource_state.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 608ef6e605 vkd3d: Emit layout transitions when beginning and ending a render pass.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle edb793b069 vkd3d: Infer current DSV format from DSV descriptor.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle d3128592ca vkd3d: Store RTV and DSV descriptors with command list.
We need access to the resource in order to perform render pass
layout transitions, just the view handle isn't enough.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 8c09ef838a vkd3d: Use common image layout for descriptors.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle 76b2d2af89 vkd3d: Add layout property to texture views.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-27 15:40:39 +02:00
Philip Rebohle baa0a293e7 vkd3d: Apply heap offset to destination buffer in ResolveQueryData.
Fixes rendering issues in The Talos Principle.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-23 17:26:55 +02:00
Hans-Kristian Arntzen 805f92a38c vkd3d: Remove dead transfer buffer code.
Obsoleted after shader copy path.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-23 12:31:48 +02:00
Philip Rebohle 5a0ef00d45 vkd3d: Use d3d12_command_list_copy_image for CopyResource as well.
Monster Hunter World uses this to copy between D32 and R32 images.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 889ab3520f vkd3d: Implement shader-based depth <-> color copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle 30e1a49f68 vkd3d: Introduce d3d12_command_list_create_framebuffer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Philip Rebohle e74a48cdc6 vkd3d: Simplify meta operation API a bit.
Passing the main struct to the public functions allows us
to share common data between multiple types of operations.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-22 18:04:29 +02:00
Sveinar Søpler c2e79af6a1 vkd3d: Fix 32-bit compiler warnings
This fixes a couple of 32-bit compiler warnings.

Signed-off-by: Sveinar Søpler <cybermax@dexter.no>
2020-04-21 11:54:59 +02:00
Hans-Kristian Arntzen ca7c027cd1 vkd3d: Replace dummy atomic_fetch_add with atomic loads.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 15:46:09 +02:00
Hans-Kristian Arntzen 09af24e69b vkd3d: Avoid vkResetCommandPool if there are pending command buffers.
Works around an app-bug in SotTR, where the command pool is reset before
the command buffer completes.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 15:31:38 +02:00
Hans-Kristian Arntzen 334b1cab8d vkd3d: Implement threaded submission queue.
D3D12 supports out-of-order signal and wait. So does Vulkan timeline
semaphores. However, in Vulkan we don't have an infinite amount of
virtual queues. We must potentially map multiple D3D12 queues on top of
Vulkan, which might lead to a deadlock when app attempts to
wait-before-signal if the two queues are mapped to the same physical
Vulkan queue.

In order to solve this, we need to hold back submissions until we know
it is safe to do so. To make this work in practice as simply as possible, each
ID3D12CommandQueue has its own submission thread, which will block on an
ID3D12Fence's pending timeline value for a Wait command. The main reason to use a
submission thread is that resolving this directly in
ID3D12CommandQueue::Signal is extremely tricky and potentially
needs recursively locking queues and fences.

Note that we only block on the pending wait value, not the actual wait
value, so there is no real CPU <-> GPU synchronization here. In the
common case, no submission thread will block.

The added benefit is that submits are async now, so main thread CPU
overhead might slightly decrease.

To play nice with DXGI swapchain, the external entry point for acquiring
the Vulkan queue needs to drain the submission thread and lock it to ensure
submissions happen in order.

Fixes hangs in The Division 1, which makes use of this D3D12 feature.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-17 15:31:38 +02:00
Philip Rebohle 957aec4785 vkd3d: Restore old ClearUnorderedAccessView implementation.
The current code uses D3D12 abstractions to create pipelines but
issues raw Vulkan API calls to actually implement the functionality,
which means the code makes assumptions about the exact descriptor
set layout and push constant layout, which is generally a bad idea
now that we have multiple code paths for root constants etc.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 18:03:39 +02:00
Hans-Kristian Arntzen edc614ab2e vkd3d: Remove legacy fence/semaphore path.
Prepares for a rewrite of queue submission, the legacy path is never
run in practice and will likely break in subtle ways.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-04-16 15:31:04 +02:00
Philip Rebohle 5bf266a8ed vkd3d: Check whether root descriptors are defined.
Fixes a crash in Monster Hunter World.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:29:17 +02:00
Philip Rebohle 0701d87474 vkd3d: Update ID3D12CommandList to ID3D12GraphicsCommandList5.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 14:25:01 +02:00
Philip Rebohle 084f8ed949 vkd3d: Update ID3D12CommandList to ID3D12GraphicsCommandList4.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 10:35:59 +02:00
Philip Rebohle dbeffb0834 vkd3d: Update ID3D12Fence to ID3D12Fence1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-15 10:35:59 +02:00
Philip Rebohle 0c03bbe9b5 vkd3d: Implement ID3D12Device4::CreateCommandList1.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 108ce6409b vkd3d: Update ID3D12CommandList to ID3D12GraphicsCommandList3.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-14 16:27:08 +02:00
Philip Rebohle 4e3ea62e79 vkd3d: Implement depth bounds test.
Used by Resident Evil 2 and 3 if available.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 16:04:39 +02:00
Philip Rebohle 960e6f85fd vkd3d: Support multiple viewports.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 15:57:23 +02:00
Philip Rebohle ae789d9ba8 vkd3d: Pass dynamic state struct to get_or_create_pipeline.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 15:57:23 +02:00
Philip Rebohle 0cc33cb823 vkd3d: Move vertex strides and primitive topology to dynamic_state.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 15:57:23 +02:00
Philip Rebohle d48794408a vkd3d: Refactor dynamic state updates.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 15:39:33 +02:00
Philip Rebohle d8a6d71038 vkd3d: Introduce vkd3d_dynamic_state.
And add a function to (re-)apply dynamic state as necessary. This
will allow us to ignore dynamic state not needed by the pipeline,
and may become necessary if we implement shader-based copies etc.

Currently unused; the following commits will subsequently change
state setting methods over.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 15:39:33 +02:00
Philip Rebohle 6b113bb629 vkd3d: Introduce d3d12_command_list_iface type alias.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-01 10:35:40 +02:00
Hans-Kristian Arntzen fce6838870 vkd3d: Fix compilation warning on 32-bit.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-31 17:27:33 +02:00
Hans-Kristian Arntzen 09885f799c vkd3d: Implement stricter checking for timeline semaphores.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-31 12:51:05 +02:00
Hans-Kristian Arntzen 855c59eae5 vkd3d: Implement timeline semaphores.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-31 12:51:05 +02:00
Philip Rebohle 74b1831960 vkd3d: Bind UAV counter address buffer if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Hans-Kristian Arntzen 7c479f6dae vkd3d: Disable index_buffer_strip_cut spam in normal runtime.
Demote this warning to TRACE only.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 12:54:44 +01:00
Hans-Kristian Arntzen f7ea9967d0 vkd3d: Use minimum width/height/layer framebuffer.
All attachments must be at least as large as the framebuffer, using a
max operator is not compliant with Vulkan.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 11:17:01 +01:00
Philip Rebohle b85852e733 vkd3d: Fix barriers for bindless CBV-as-SSBO.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-23 16:20:38 +01:00
Hans-Kristian Arntzen 71d8f63356 vkd3d: Split descriptor pool allocation based on usage.
Logically split up descriptor pool allocation in three types:
- STATIC: Root descriptors and internal allocation.
- VOLATILE: For packed descriptor set which comes from heaps.
- IMMUTABLE_SAMPLER: For immutable samplers. This should be removed once
  we start allocating sampler sets at sampler creation time.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 14:29:03 +01:00
Hans-Kristian Arntzen 291db5581c vkd3d: Fix push constant size check against D3D12_MAX_ROOT_COST.
MAX_ROOT_COST is in terms of number of u32s.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 14:29:03 +01:00
Philip Rebohle c7af09c68c vkd3d: Allocate descriptor pool space for inline uniform blocks.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 20:49:56 +01:00
Philip Rebohle ada3890211 vkd3d: Write inline uniform block if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 13:54:12 +01:00
Philip Rebohle e899b96c10 vkd3d: Introduce root signature flag to determine push descriptor usage.
For now this is enbaled based on device capabilities, but future changes
may require this to be disabled for certain root signatures.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 13:54:12 +01:00
Hans-Kristian Arntzen fee9b2bb05 vkd3d: Implement RS 1.0 volatile for packed descriptor set.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-11 12:20:00 +01:00
Philip Rebohle 708f26bf40 vkd3d: Only update packed descriptor set if necessary.
When changing tables that only have bindless descriptors,
only update the push constants instead.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-11 10:47:58 +01:00
Philip Rebohle 2e18afc7cb vkd3d: Introduce dirty flags for pipeline bindings.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-11 10:47:58 +01:00
Philip Rebohle 2b45574fc2 vkd3d: Invalidate descriptor heap bindings if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle be20e9a9c1 vkd3d: Set descriptor table offsets via push constants.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle af4c211f34 vkd3d: Bind descriptor sets for active descriptor heaps.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 15:25:54 +01:00
Philip Rebohle 6e15ad20b4 vkd3d: Rework descriptor table binding.
Uses the new data structures to iterate over descriptor
tables and populate the packed descriptor set.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 14:07:51 +01:00
Philip Rebohle 28bf2eec3e vkd3d: Rework static samplers.
Static samplers are embedded in the root signature, so we can create
a separate descriptor set layout and descriptor set which we only
need to rebind when the root signature itself changes.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 13:11:10 +01:00
Philip Rebohle ae12e22187 vkd3d: Rework root descriptor updates.
Updates the root descriptor set or push descriptor at draw time.
This fixes a potential issue with shader-based clear/copy commands
invalidating previously bound root descriptors.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 12:19:07 +01:00
Philip Rebohle 82bf3e810b vkd3d: Rework root descriptors.
Streamlines descriptor set layout creation for root descriptors.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 12:19:07 +01:00
Philip Rebohle 189bcd39af vkd3d: Store index of root descriptor set in root signature.
This allows us to put root descriptors into a set other than 0.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 3f125ac919 vkd3d: Temporarily require VK_KHR_push_descriptor.
Allows us to more easily refactor root signature-related code
without having to worry about root descriptors for now.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 0d071c9c37 vkd3d: Rename root signature descriptor set layout members.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 7c276f5e82 vkd3d: Rework root constant updates.
Fixes an issue where push constants can be invalidated by
shader-based clear/copy commands.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle 0eed8a1080 vkd3d: Rework root constants.
Uses one push constant range with VK_SHADER_STAGE_ALL. This
will allow us to easily add descriptor table offsets as push
constants.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 11:44:45 +01:00
Philip Rebohle dfa208f909 vkd3d: Remove d3d12_command_list_invalidate_bindings.
The primary purpose of this function was to invalidate UAV
counters upon binding a pipeline. This is no longer an issue
and we don't have any other per-pipeline bindings, so this
function can be dropped.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-03 20:58:46 +01:00
Philip Rebohle f3d89a548a vkd3d: Reintroduce UAV counters.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-02 12:16:30 +01:00
Philip Rebohle 0dab14ed22 vkd3d: Temporarily drop UAV counter support.
This needs a major rework as the current implementation has bugs,
is hard to reason about, and very hard to maintain as we're about
to make major changes to the binding model as a whole.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-02 12:16:30 +01:00
Hans-Kristian Arntzen 93e4b6ff9b vkd3d: Deal correctly with SM 5.1 register spaces.
Resource index is found in idx[0] in SM 5.0, but idx[1] when using SM
5.1, and register space is encoded separately. An rb_tree keeps track of
the internal resource index idx[0] and can map that to space/binding as
required when emitting SPIR-V.

For this to work, we must also make UAV counters register space aware.
In earlier implementation, UAV counter mask was assumed to correlate 1:1
with register_index, which breaks on SM 5.1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-24 12:32:29 +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
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 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
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 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
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 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
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
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
Conor McCarthy 2155748c41 vkd3d: Add support for multiplanar depth/stencil state transitions.
If separate transitions of the depth and stencil plane occur in the
same array of barriers, they will be consolidated into one Vulkan
layout transition. This can only be supported for combinations of
depth read and depth write states, or identical states.

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:14:38 +01:00
Henri Verbeet 769dd2b68c vkd3d: Introduce vkd3d_format_get_data_offset().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-18 18:06:10 +02:00
Hans-Kristian Arntzen a0ebcce398 vkd3d: Do not use RESET_COMMAND_BUFFERS_BIT.
By setting this flag, command pools cannot efficiently pool allocations.
This flag should be set to 0 so only the VkCommandPool may be reset.
This matches D3D12 API.

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-01 19:16:16 +02:00
Hans-Kristian Arntzen 3c86b2341c vkd3d: Do not release resources in vkResetCommandPool.
D3D12 command allocators are intended to recycle memory across resets,
so we should do the same thing in vkd3d.

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-01 19:16:12 +02:00
Józef Kucia 865fbea532 vkd3d: Remove unused d3d12_root_signature_init_descriptor_pool_size().
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-08-06 17:05:12 +02:00
Józef Kucia 0d851513dc vkd3d: Get rid of dxgi_format_is_typeless().
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-07-31 08:31:56 +02:00
Jactry Zeng 9d138ee135 vkd3d: Handle SINT and UINT formats in ClearRenderTargetView().
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
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-07-31 08:31:53 +02:00
Józef Kucia d9da1c904e vkd3d: Store vkd3d_format in {dsv,rtv}_desc.
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-07-31 08:31:50 +02:00
Józef Kucia dc2ae75461 vkd3d: Return more information from device memory allocation functions.
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-21 08:09:18 +02:00
Józef Kucia 110830aca0 vkd3d: Introduce d3d12_resource_is_cpu_accessible() helper.
The condition in d3d12_resource_is_cpu_accessible() is going to be
changed in the following commits.

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-21 08:09:16 +02:00
Józef Kucia ed8bd8cd59 vkd3d: Implement D3D12_RESOURCE_STATE_PREDICATION resource barriers.
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:41:11 +02:00
Józef Kucia 16c62ded81 vkd3d: End conditional rendering before ending command buffer.
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:41:07 +02:00
Józef Kucia 9939712560 vkd3d: Begin and end conditional rendering outside render passes.
The Vulkan spec says:

  "Conditional rendering must also either begin and end inside the same
  subpass of a render pass instance, or must both begin and end outside
  of a render pass instance (i.e. contain entire render pass instances)."

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:41:04 +02:00
Józef Kucia 1a42564eb9 vkd3d: Use vkd3d_waiting_fence structure in more places.
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:43 +02:00
Józef Kucia e912a2c329 vkd3d: Validate resource pointer for transition barriers.
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:33 +02:00
Conor McCarthy 901fb7e798 vkd3d: Implement d3d12_command_list_SetPredication().
Predicate arguments which are only non-zero in bit 32 or higher are not
supported. Predicates will not be applied to clear and copy commands because
Vulkan does not support predication of these command classes.

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-06-17 20:53:39 +02:00
Józef Kucia 206fd23afe vkd3d: Avoid busy-waiting in fence worker thread.
This might delay updating a d3d12_fence when a fence enqueued later than
other fences is signaled before them. On the other hand, it
significantly reduces CPU usage. I haven't found a program negatively
impacted by this change so far.

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-13 20:56:38 +02:00
Józef Kucia 0baf0302d1 vkd3d: Avoid holding mutex while waiting for fences.
We maintain separate arrays for enqueued fences and fences owned by the
fence worker thread.

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-13 20:56:35 +02:00
Józef Kucia 285a19408f vkd3d: Introduce FIXME_ONCE().
The debug log level is demoted to WARN after the FIXME is printed once.

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-12 22:37:44 +02:00
Józef Kucia 895aaa461b vkd3d: Clarify DSV attachment mask handling.
It isn't immediately obvious what "1u << graphics->rt_count" means.
Use dsv_attachment_mask() helper instead.

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-12 22:37:37 +02:00
Józef Kucia 7ecd67aaa0 vkd3d: Factor out vkd3d_join_thread().
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-11 23:25:51 +02:00
Józef Kucia bc5e8a9cc2 vkd3d: Factor out vkd3d_create_thread().
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-11 23:25:49 +02:00
Józef Kucia 826190fc0e vkd3d: Prefer uint64_t to UINT64.
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-11 23:25:44 +02:00
Józef Kucia 28f99600a5 vkd3d: Avoid allocating memory in d3d12_command_list_update_uav_counter_descriptors().
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-11 23:25:42 +02:00
Józef Kucia 6862f34004 vkd3d: Avoid allocating memory in d3d12_command_list_RSSetScissorRects().
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-11 23:25:39 +02:00
Józef Kucia 812878fa87 vkd3d: Emit barriers in ClearUnorderedAccessViewUint().
We use transfer operations instead of unordered access.

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-11 23:25:30 +02:00
Józef Kucia 3abfb840fd vkd3d: Invalidate current pipeline when DSV format is changed.
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-11 23:25:26 +02:00
Józef Kucia bc8c07ffcc vkd3d: Fix unbinding depth-stencil views.
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-11 23:25:19 +02:00
Józef Kucia afe7259242 vkd3d: Introduce helper functions to call ID3D12Device methods.
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-10 12:24:40 +02:00
Józef Kucia 3e99853297 vkd3d: Always return render pass from d3d12_pipeline_state_get_or_create_pipeline().
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-21 16:25:09 +02:00
Philip Rebohle f1076bb153 vkd3d: Support count buffer for indirect draws.
Used by Resident Evil 2.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
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-20 20:33:34 +02:00
Józef Kucia e7e0f4180d vkd3d: Simplify checking for render pass compatibility.
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-17 20:41:15 +02:00
Józef Kucia 26e6957875 vkd3d: Refactor render pass attachments.
Use the last attachment for depth-stencil instead of the first.

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-17 20:41:02 +02:00
Józef Kucia 92d88e2903 vkd3d: Fix draw calls without depth-stencil view.
Fixes a regression introduced by
9eba55403d.

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-17 20:40:56 +02:00