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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
... 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>
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>
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>
These memory types might end up being used as fallback memory types,
which is problematic due to their tiny sizes, and unexpected performance
behavior. Generally, when we want to fallback, we should cleanly fall
back to system memory rather than a different device local type.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Manages unique static samplers for now, in order to reduce duplicates.
Can be extended to also manage descriptor pools for static samplers in
the future.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
RenderDoc does not support external_memory_host yet, and these heaps are
generally only used for debugging, so we should be able to get away with
this in practice.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
D3D12 allows much larger pools to be created for heaps that are not
shader-visible, which some games make use of. Fixes crashes on Nvidia.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Not just the shader visible ones, since we'll be using Vulkan
descriptor set copies to implement D3D12 descriptor copies.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Stores info about where exactly the descriptor is stored in the
Vulkan descriptor pool, and whether we have to worry about an
additional UAV counter descriptor.
This is meant to replace all the other non-static data stored
inside d3d12_desc.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
We're not using these anywhere because we need formats to be correct
for image views. Buffer views are used for root descriptors and null
UAV counters.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Fixes a crash on drivers that don't support null descriptors.
Image UAVs and other descriptor types cannot have counters.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
It's the argument to the opcode which consumes the final resource handle
or pointer which needs to marked as NonUniformEXT. Was missing this for
sampled images and bindless UAV counters.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
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>
There are two advantages of doing it like this:
- When profiling is not enabled, we get no overhead for device calls.
- Avoids cluttering up the main implementation.
Disadvantage is that rolling inherited vtables like this is quite
disgusting, but this is C, what you gonna do ...
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Works by mapping a memory block on disk, and then we simply increment
u64s. The caller code only needs to use VKD3D_REGION_{DECL,BEGIN,END}
macros.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Calling this from CopyDescriptorsSimple on its own is a bad idea given its __stdcall and GCC doesn't like optimizing that.
Also marked it as inline given it can easily be optimized greatly contextually for CopyDescriptorsSimple
Signed-off-by: Joshua Ashton <joshua@froggi.es>
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>
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>
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>
Fall back when there is a mismatch, which can happen if application does
not declare inputs to hull shader (unlikely).
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
When using EXT_extended_dynamic_state, we will be able to compile a
master pipeline. Only in special cases will we have to fallback.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This can happen in the worst case where we have all bindless sets, and:
- Static samplers
- Packed descriptors (UAV counters on drivers without support for this)
- Root descriptors
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Simplistic implementation. Also, make sure lines are written atomically
to not get garbled logs.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
On Windows, we don't get a flush naturally after every newline,
so flush manually every time to make sure we get everything in a timely
fashion.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
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>