If we don't get a swapchain on first frame for whatever reason, defer
creating the descriptors.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
If we fail to present after a swapchain recreation, force a SURFACE_LOST
scenario and try again later when things hopefully stabilize.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
It just called create_vulkan_swapchain anyways.
Also, add in extra parameter to support temporary user buffer fallbacks.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Refactor destroy_buffers to destroy_resources as it's more obvious what
it's doing that way.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Some dynamic state is at risk of being spammed with same arguments many
times. For the dynamic state that is trivial to check, do so.
Ghostwire: Tokyo has been observed to spam the same OMSetStencilRef
value causing some context rolls, also RSSetShadingRate has been set
redundantly.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes validation error on Intel where we are trying to create
CONCURRENT family with {0, -1}.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
When the disk cache is used, the cache we give back to applications is a
dummy. Therefore, try to use the disk cache blob if we detect a useless
application blob.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
With VKD3D_SHADER_CACHE_PATH, we can add automatic serialization of pipeline
blobs to disk, even for games which do not make any use of GetCachedBlob
of ID3D12PipelineLibrary interfaces. Most applications expect drivers to
have some kind of internal caching.
This is implemented as a system where a disk
thread will manage a private ID3D12PipelineLibrary, and new PSOs are
automatically committed to this library. PSO creation will also consult
this internal pipeline library if applications do not provide their own
blob.
The strategy for updating the cache is based on a read-only cache which
is mmaped from disk, with an exclusive write-only portion for new blobs,
which ensures some degree of safety if there are multiple
concurrent processes using the same cache.
The memory layout of the disk cache is optimized to be very efficient
for appending new blobs, just simple fwrites + fflush.
The format is also robust against sliced files, which solves the problem
where applications tear down without destroying the D3D12 device
properly.
This structure is very similar to Fossilize, and in fact the idea is to
move towards actually using the Fossilize format directly later.
This implementation prepares us for this scenario where e.g. Steam could
potentially manage the vkd3d-proton cache.
The main complication in this implementation is that we have to merge
the read-only and write caches.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
For internal pipeline libraries, we want a somewhat different strategy.
- PSOs are keyed by hash instead of user key.
- We want the option to conditionally store SPIR-V and PSO blobs.
For internal caches, there isn't much of a reason to store PSO blobs
since the disk cache is going to be primed anyways.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Makes sure that we drop private root signature device references when
public pipeline state refcount hits 0.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Supports more advanced file operations than we'd normally need.
Intended to be used by magic disk cache.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This was off by one, at some point, which could cause a stack buffer overrun which is naughty.
Replace this with just an ARRAY_SIZE on the dynamic_state_list for the array size.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Needed to support SM 6.0 CBufferLoad.
This path is mostly unused since it's opt-in in DXC and horribly broken
...
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Primitive restart is only used for strip primitive types, and must be
ignored for lists. Use and require extended_dynamic_state2 for this
purpose.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
There are strict limits on number of descriptors which can be used,
and we have to use MUTABLE + single set to make this work.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
{depth,stencil}AttachmentFormat and p{Depth,Stencil}Attachment are only
allowed if the format contains that aspect. Check this explicitly.
Fixes some validation errors.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
For EXTENDED_USAGE, we still need to restrict image usage when creating
concrete views.
Use VkImageViewUsageCreateInfo to restrict usage flags to the kind of
view we're creating.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>