Commit Graph

14975 Commits

Author SHA1 Message Date
baldurk 407c74de01 Fixed an issue with indirect count and secondary command buffers
* Added logic to shift the beginEvent for any command nodes that occur after a
  draw indirect count action within a command tree.
2024-09-09 14:45:30 +01:00
baldurk 178b733001 Add helper for loading a shader module from disk in tests 2024-09-09 14:45:30 +01:00
baldurk 1ca4b70bf9 Display quad overdraw as disabled when MSAA is enabled on vulkan
* No API supports the quad overdraw with MSAA, but on other APIs it's feasible
  to downgrade and render the overlay at single sampled. On Vulkan with
  renderpasses this is not possible.
2024-09-09 14:45:30 +01:00
baldurk 3c6520d250 Add support for multiview with quad overdraw overlay. Closes #3424
* We multiply the internal array image up by the number of views and read from
  viewindex to write and resolve from different sets of slices
2024-09-09 14:43:17 +01:00
baldurk c7b0c240e2 Fix deferred handles to start properly from the upper bits
* INTPTR_MAX may overlap with valid pointers on android
2024-09-07 12:37:23 +01:00
baldurk 546490c1a6 Add a unit test for strip_nonbasic 2024-09-06 16:42:11 +01:00
baldurk bd62fb9a1d Release all internal pointers in wrapped device configuration 2024-09-06 16:42:11 +01:00
baldurk 5fe6b5c8e2 Print file & line for error-checked return codes 2024-09-06 16:42:10 +01:00
Cam Mannett f6327194bc Switch to a ref-counted solution 2024-09-06 16:38:43 +01:00
Cam Mannett b730e55b93 Vulkan AS rebuild-on-replay: On queue submission completion events
If an AS build command is called on an already built AS (i.e. an update build) then we need to safely destroy the previously copied input buffers and their memory.  However at the point this happens, we do not own the command buffer so we don't know if the original data has actually been copied yet.

Using the mechanism in this patch we associate function objects with the command buffer that will be executed when the queue the command buffer is submitted to, has finished executing on the GPU.

This works by carying the function objects in command buffer and once it is submitted, we poll on a VkEvent we inserted.  Once signalled, we call the function objects in the order they were inserted.
2024-09-06 16:38:43 +01:00
baldurk 677bc4701f 32-bit compile fix 2024-09-04 17:22:27 +01:00
baldurk 05ac8bed37 Update to latest DX headers and block workgraph functionality 2024-09-04 16:35:06 +01:00
baldurk bb6c6d84b2 Fix deferred pipeline compilation & naming on vulkan 2024-09-04 13:23:52 +01:00
baldurk 1402c5c417 Compile fix for use of sqrt 2024-09-03 17:00:49 +01:00
baldurk 076e07912d Add test of implicit embedded root signatures 2024-09-03 15:00:35 +01:00
baldurk 282e76a2f5 Defer state object compilation on D3D12 2024-09-03 14:22:01 +01:00
baldurk d7f3f194da Defer normal pipeline object compilation on D3D12 2024-09-03 14:22:01 +01:00
baldurk 54ee4217b9 Defer pipeline compilation on Vulkan to jobs 2024-09-03 14:22:01 +01:00
baldurk c4e9ef1d77 Add the ability to defer a wrapped handle during replay temporarily
* We create a fake handle to provide to the wrapping system which will be non-
  functional, and then later on update the mapping information once the real
  handle has been patched in.
* On vulkan we don't know what valid handles might be but we assume they will
  likely be pointer-like, so we start from -1 and move downward with the fake
  handles to avoid a clash (which would break).
2024-09-03 14:22:00 +01:00
baldurk 8826c96454 Initialise job system on Vulkan & D3D12
* We only expect to use jobs currently for the loading portion before the frame
  capture scope, so we synchronise on jobs and process any deferred failures
  immediately after applying initial contents and before doing the first frame
  capture replay.
2024-09-03 14:22:00 +01:00
baldurk a784c9a1a7 Add unit tests for the job system 2024-09-03 14:22:00 +01:00
baldurk 69a92bbc84 Add job system for deferring tasks in parallel 2024-09-03 14:22:00 +01:00
baldurk abdc3c2b4f Fix android compilation 2024-09-02 18:10:37 +01:00
baldurk 8592fc0cc3 Fix compilation on 32-bit 2024-09-02 18:08:04 +01:00
baldurk a886489c8c Don't rely on descriptor heap being present when processing descriptor
* This may not be true for RTV/DSV where the descriptor heap is purely an API
  design wart and may not actually exist when processing.
2024-09-02 17:30:25 +01:00
baldurk 08ec78aace Fix incorrect command buffer used to restore state after AS build 2024-09-02 17:30:25 +01:00
baldurk 7940e86ec3 Switch to use manual encoding/decoding of root signatures
* This removes the dependency on the serialisers/deserialisers provided by
  D3D12.dll or the D3D12Core.dlls
* It also allows us to easily decode root signatures that don't have DXBC
  containers, such as those in embedded subobjects.
2024-08-30 13:41:21 +01:00
baldurk 71043aa19c Add a unit test to comparison-test against the dll serialisers
* Since the serialised format is mostly memcpy'd we don't aim for complete
  coverage but just edge cases like empty lists, all different types of
  descriptors and flags, and all root signature versions.
2024-08-30 13:40:03 +01:00
baldurk d594538459 Add a custom decoder/encoder for D3D12 root signatures
* Handles v1.0 - v1.2 (v1.2 is undocumented/unspecified in DXC but assumed from
  changes & tested).
2024-08-30 13:35:39 +01:00
baldurk 2eb41f860d Add DXBC container helpers for manipulating single-chunk containers 2024-08-30 13:28:40 +01:00
baldurk 632cf5af46 Fix default descriptor flags for 1.0 root signatures 2024-08-30 11:55:24 +01:00
baldurk 68e18d2520 Fix incorrect chunk stringise 2024-08-30 11:54:09 +01:00
baldurk f8a067b709 Return settings by value with temporaries
* This is slightly less efficient but this isn't high-performance code, and it
  makes settings like shader debug SearchDirPaths safe to access on multiple
  threads.
2024-08-30 11:54:09 +01:00
baldurk f3c10de41c Fix object unwrapping on VkGraphicsPipelineCreateInfo 2024-08-29 16:09:34 +01:00
baldurk 841a487d36 Add OS-abstracted semaphore primitive
* Uses POSIX sem on linux/android, dispatch semaphores on apple, Win32
  Semaphores on windows.
2024-08-29 12:21:41 +01:00
baldurk 62c86f647e Add a config option to print chunk timings in release 2024-08-29 11:14:54 +01:00
Jake Turner 2cd162144d DXBC Debug changes to support DXIL Debugging
Moved DXBCDebug::GatherPSDataForIntialValues() to DXDebug namespace and altered the input parameters.
Moved DXBCDebug::PSInputElement to DXDebug namespace
Added DXBCDebug::GetInterpolationModeForInputParams()
Added DXILDebug::GetInterpolationModeForInputParams()
2024-08-27 12:56:40 +01:00
Jake Turner 1d4cf8fb7b Rename DXBCDXILDebug shader debugging helpers to DXDebug 2024-08-27 11:37:55 +01:00
Arnaud Carré 97ea37d64f typo fix 2024-08-26 11:03:29 +01:00
Jasmine Hansen 0883514a8f Create edited shader object during resource replacement 2024-08-23 12:19:41 +01:00
baldurk a9d58f10ab Disable pointless gcc 14 warning. Closes #3417 2024-08-23 12:13:20 +01:00
Jake Turner 0e2decbae5 Add FunctionFamily and LLVMDbgOp enums to DXIL::Function
Saves having to do repeated string comparisons for function calls to identify if the instruction is a DXOp call or an LLVM Dbg call.
The LLVM Dbg calls are unique and the specific llvm dbg operation is stored in the DXIL::Function
The DXOp calls are not unique and the zero'th argument of the CALL Instruction is used to determine the DXOp opcode.
2024-08-22 12:56:31 +01:00
baldurk c64866ba08 Handle DXIL-declared local root signatures
* We attempt to handle associations in DXIL subobjects but this needs
  significantly more testing to understand how it's meant to work.
2024-08-20 14:49:48 +01:00
baldurk 72ffdc01bd Replace manual patching of PSV with decode/encode
* The DXIL program editor will now automatically decode and encode the PSV and
  RDAT chunks (if found) as part of its roundtrip
2024-08-20 14:49:48 +01:00
baldurk 20f5725bbd Add reading and writing of pipeline validation chunk 2024-08-20 14:49:48 +01:00
baldurk 946df28742 Wrap up string buffer and index arrays to be reusable with a tweak
* For some reason in RDAT the strings are deduplicated, but in PSV they are not.
  Similarly in RDAT the index array packing prefixes each array with its length
  but in PSV the index array is entirely loose and deduplication can happen
  effectively anywhere.
2024-08-20 14:49:47 +01:00
baldurk b82ee6ac14 Stub out PSV structures for external access
* We move some commonly used enums to more general spots for ease of use in the
  encoded data.
2024-08-20 14:49:47 +01:00
baldurk 8cb615e217 Fix assert when disassembling unorm or snorm typed resources 2024-08-20 14:49:47 +01:00
baldurk a1dc494fb5 Add decoding and encoding for RDAT
* Only tested so far on round-trip behaviour, not with modifications. By default
  we don't make any changes yet but the DXIL program editor may in future
  automatically decode and encode the RDAT so it can stay in sync if resources
  are added.
2024-08-20 14:49:47 +01:00
baldurk 7adff9faff Add stubbed structures for RDAT decoding/encoding
* We have parallel structures that are mostly the same but are 'flattened' with
  indices for lookups for arrays or strings
2024-08-19 16:15:14 +01:00