12620 Commits

Author SHA1 Message Date
baldurk 5486bf09b3 Fix D3D11 overlays not displaying due to overwritten renderstate v1.16 2021-09-29 13:54:32 +01:00
baldurk 25b17c8093 Add R/W locking around access to crash handler. Closes #2376
* The crash handler gets destroyed and recreated when we need to change creation
  parameters, and this races against anything else trying to use it to register
  or unregister memory regions.
* In partcular when initialising the replay we recreated the crash handler right
  after kicking off the GPU enumeration.
* We add a read/write lock so there's no significant added contention on most
  paths (even though it's not really high traffic in any case) to prevent this
  kind of problem in future.
2021-09-29 10:54:29 +01:00
baldurk d386df55b9 Clarify requirement of a capture for device lost errors 2021-09-27 13:01:09 +01:00
baldurk 62d6ffaec2 Enable DXIL bindless feedback test 2021-09-27 12:26:22 +01:00
baldurk 2a53db8eae Fix DXIL feedback to account for handle indices being register relative
* If a texture array is bound to register 17, the dynamic index passed into
  createHandle will be [17+x] :(
2021-09-27 12:23:58 +01:00
baldurk b20e337fd2 Remove unused root elements after filling D3D12 pipeline state 2021-09-27 12:23:15 +01:00
baldurk c8e7037ed1 Make some custom changes to Catch2 for a better experience
* Add CATCH_CONFIG_FORCE_FALLBACK_STRINGIFIER to force use of ToStr in
  all cases. We can handle ints, etc, we don't need ostringstream, and
  this allows us to handle enums that would otherwise just be printed as
  their integer value.
* Add CATCH_CONFIG_INLINE_DEBUG_BREAK which restores the Catch 1.0
  behaviour of debugbreaks happening in macros and so in-line at the
  actual site failure. So the debugger stops on the CHECK() or REQUIRE()
  call instead of inside AssertionHandler::complete()

  Cherry pick from https://github.com/baldurk/renderdoc/commit/4232736fc21fc6a13a4de6997a5ae106598b225f
2021-09-27 10:03:39 +01:00
baldurk d3c6818f4a Update Catch to version 2.13.7 2021-09-27 10:03:39 +01:00
baldurk 552621a87f Fix a compile warning that appears on redhat 2021-09-27 10:03:39 +01:00
Jake Turner 8c5792f412 Add api/replay/pipestate.inl to sources list
xcode project generation is driven by the sources list
before this commit "pipestate.inl" was not present in the xcode project
after this commit it is present
2021-09-27 09:46:33 +01:00
baldurk e1880f62ab Clamp value index by number of values
* This can be out of bounds when purely considering the instruction index if
  there's an instruction near the end, beyond the point where there are (many)
  further values.
2021-09-24 15:11:22 +01:00
baldurk ff92cc2ba3 Don't flush coherent maps on vulkan when there are no command buffers
* Normally this is handled by checking referenced IDs, but we now
  unconditionally flush memory with BDA buffers bound to it.
2021-09-24 14:04:29 +01:00
baldurk 7700c2a80d Don't trust presence/absence of raw buffer flag on D3D12 descriptors 2021-09-24 13:23:32 +01:00
baldurk a77c9e7ac3 Demote DXIL validation step to warning as it's not reliable 2021-09-24 12:04:50 +01:00
baldurk 22dda946fc Strip root signature to avoid false validation errors 2021-09-24 10:59:39 +01:00
baldurk 5c87ee069f Ignore static used binds when allocating feedback slots 2021-09-24 10:59:06 +01:00
baldurk 77785cfe1f 32-bit compile fix 2021-09-23 19:45:51 +01:00
baldurk 8901880d15 Ensure reference data for map comparisons is taken from serialised data
* If we serialise from the map, and then separately memcpy from it to populate
  the reference data then we risk another thread's writes happening in between
  and not being detected on subsequence checks. Instead we need to copy from the
  serialised data, that way regardless of what we snapshot there we always
  compare against it to detect any further writes.
2021-09-23 17:48:45 +01:00
baldurk b4e4fed40f Remove path to trust application flushes on coherent maps. Closes #2372
* We used to allow applications to call vkFlushMappedMemoryRanges on coherent
  memory to manually annotate regions of memory that are changed in persistent
  maps, thus avoiding the overhead of RenderDoc needing to check for changes on
  each submit.
* Unfortunately this means that if the application calls flush wrongly then
  changes will no longer appear, even though the application was completely
  correct, if misleading, since by the spec behaviour vkFlushMappedMemoryRanges
  is a no-op on coherent memory so incorrect calls to it make no difference.
* Since applications making use of this are rare or non-existant we just remove
  the optimisation.
2021-09-23 17:37:26 +01:00
baldurk 42fcc3820d Try to load DXC before doing DXIL patching, to validate in debug builds 2021-09-23 17:01:31 +01:00
baldurk e092607896 Patch feature flags chunk when adding UAVs on geometry stages 2021-09-23 16:59:34 +01:00
baldurk b4cf86c48c Fix compilation on mac 2021-09-21 18:48:43 +01:00
baldurk dc6bc12da7 Annotate handle creation with writes to track bindless use on D3D12 2021-09-21 18:04:58 +01:00
baldurk 8401ba26a0 Fix DXBC container offsets/length properly when stripping debug DXIL 2021-09-21 18:04:58 +01:00
baldurk 6ee985a067 Patch PSV chunk to fix dxil validation warning 2021-09-21 18:04:58 +01:00
baldurk 9efe0f5a83 Begin implementing DXIL shader patching for bindless feedback
* We don't annotate any bindless uses yet, this only declares the UAV and
  attempts to write into the first slot.
2021-09-21 18:04:58 +01:00
baldurk 0c0d6af93d Allow simple one-pass editing with DXIL
* DXIL's shape and necessity of pointers and relative addressing poses a
  challenge for editing. Currently we pre-reserve all arrays and take pointers
  to match DXIL's format and to allow edits to not require lots of index fixups.
  However this is a challenge when editing as the arrays may resize as things
  are inserted.
* The solution we take here is to copy all the arrays that will mutate to new
  storage and reserving enough for the edits, *while keeping the old array
  storage around*. We then assign all elements IDs, and after editing we do a
  fixup pass to find any pointers that are pointing into the old arrays and find
  them in the new arrays by ID.
* This means that pointers to the old storage remain valid and point to the
  right object even after we've resized for editing, and we only fix them up
  right at the end after all the edits so we can look up indices from pointers
  again.
* This approach may not work indefinitely sadly, and it does require
  conservative reservation. In future we might have to completely clone DXC's
  data storage as well (arena allocated and new everything, with no arrays for
  storage).
2021-09-21 18:04:58 +01:00
baldurk ed4a28049d Remove unused instruction pointer from Metadata 2021-09-21 18:04:58 +01:00
baldurk e1efc83fe3 Add shader entry tag to common header
* We also allow GetPointerType to silently return NULL when no pointer exists,
  as this will be useful for encoding when we want to check if a pointer type
  exists.
2021-09-21 18:04:57 +01:00
baldurk 42f508df85 Add i32/i8 helpers for DXIL 2021-09-21 18:04:57 +01:00
baldurk d15f264c81 Store values rather than indices for aliases/symtab to allow rebasing 2021-09-21 18:04:57 +01:00
baldurk 9efdf6920a Don't require stripping the blob to fetch editable non-debug DXIL chunk 2021-09-21 18:04:57 +01:00
baldurk ff6d495c45 On debug pass encoded DXIL through validator just in case 2021-09-21 18:04:57 +01:00
baldurk fccaee058e Handle attribute sets with per-function-parameter attributes in DXIL
* This also fixes the string (not enum) attribute decoding
2021-09-21 18:04:57 +01:00
baldurk a67b0beb7f Don't warn on vector instructions - DXIL uses them sometimes 2021-09-21 18:04:57 +01:00
baldurk 012fedbb4a Fix basic block symtab entries 2021-09-21 18:04:57 +01:00
baldurk 1f68db5c08 Preserve value symtabs in exactly the order they come in
* Sometimes these are sorted, but that seems to be a recent dxc change.
2021-09-21 18:04:57 +01:00
baldurk 731c81e3c7 Fix encoding of constants with potential forward references 2021-09-21 18:04:57 +01:00
baldurk 976cb0e21a Preserve uselists through DXIL decode/encode 2021-09-21 18:04:57 +01:00
baldurk 097e6657e8 Write attached metadata in functions 2021-09-21 18:04:57 +01:00
baldurk 29c16d17e8 Encode function instructions 2021-09-21 18:04:57 +01:00
baldurk 410ee1472b Start emitting function blocks, with attached metadata and constants
* We now track the values in a simple array so getting value IDs amounts to just
  getting an index in this array. This avoids the need to iterate in an llvm-
  identical way to enumerate values. That does mean that we need to insert new
  values into the array in the correct order, which isn't too bad.
2021-09-21 18:04:57 +01:00
baldurk 3b8dee0233 Refactor DXIL handling to rely on pointers instead of indexing
* The indexing works fine and handles forward references nicer, but once we
  start modifying things all the indices will need to be rebased.
2021-09-21 18:04:57 +01:00
baldurk 606c011aac Emit global symbol table 2021-09-21 18:04:57 +01:00
baldurk 3ce8d68fba Emit metadata block 2021-09-21 18:04:57 +01:00
baldurk a2a5d8ec8a Emit the global constants block in DXIL 2021-09-21 18:04:56 +01:00
baldurk f6e8e78bbf Emit global var and function records in module
* The value IDs currently aren't fetched in LLVM-matching order so we don't have
  those yet for global var initialisers
2021-09-21 18:04:56 +01:00
baldurk 6d60d96fe6 Set up llvm encoder to handle abbrev selection, and write type lock 2021-09-21 18:04:56 +01:00
baldurk 045aad23ad Write param attr blocks
* We cheat slightly with the attributes - we combine these on load, so we lose
  information about multiple groups they may reference. So we save the groups
  that we read from and use that to write the attribute.
2021-09-21 18:04:56 +01:00
baldurk 9e3385d18d Emit root module block and blockinfo subblock
* It looks like LLVM (at DXC's version anyway) hardcodes a series of
  abbreviations, so we do the same
2021-09-21 18:04:56 +01:00