Commit Graph

170 Commits

Author SHA1 Message Date
baldurk 56f82f6bf1 Optimise UI for large descriptor arrays with few dynamically used binds
* We tune the pipeline state view and texture viewer to only iterate over a
  small list of dynamically used binds in the (vastly more common) case where
  unused binds are not being shown.
2020-09-03 18:09:47 +01:00
baldurk 83f7a26ee9 Query which shader disassembly formats require a pipeline
* This allows us to be a bit more friendly in the UI when we don't have a
  particular pipeline associated with a shader.
2020-09-01 14:03:59 +01:00
Steve Karolewics 99bfc41caa Add bounds checks for resources in shader viewer UI 2020-06-12 13:39:50 +01:00
baldurk 60b710f24a Fix display of matrices inside source variable-mapped structures 2020-06-05 12:44:38 +01:00
baldurk 759fad10e3 Remove sleep accidentally left in 2020-05-19 16:35:10 +01:00
baldurk a81994071f Wait for shader viewer background debugging, add cancel button
* Until we properly support background debugging we need to wait for it to
  complete, otherwise the user could close the window and we'd crash.
2020-05-15 20:31:42 +01:00
Steve Karolewics ef58d7e1f8 Extend info in accessed resources panel in the shader viewer 2020-05-08 20:43:04 +01:00
baldurk 4c195dd93c Fix source variables not being marked as modified 2020-05-05 18:17:43 +01:00
baldurk e2fce8cad1 Fix crash if accessed resource is unbound 2020-04-30 18:15:29 +01:00
baldurk 2865fe101d Deduplicate resource accesses by binding not by name
* For D3D this should be equivalent since name == bindpoint, but for SPIR-V this
  prevents the same binding being loaded into multiple SSA variables from being
  added every time.
2020-04-29 18:48:51 +01:00
baldurk fe882fe872 Default to debug variables panel if there's no high-level debug info 2020-04-29 18:48:50 +01:00
baldurk 1da60805e0 Allow source variable mappings to point to the root of a complex type
* For vulkan debugging where high-level variables are not scattered amongst
  vectors, there's no point in having the whole tree expanded for source mapping
  struct-to-struct or array-to-array.
2020-04-29 18:48:50 +01:00
Steve Karolewics 08d1189d99 Give ShaderViewer its own copy of bindpoint mappings
Previously this data was a reference to the current pipeline state, so
when the selected event changed, the ShaderViewer's bindpoint mappings
would be inaccurate.
2020-04-27 18:16:46 +01:00
Steve Karolewics 2c4f2a57a8 Add resource tracking to DXBC shader debugging
When a resource is accessed, it is now tracked by the debug step. The
shader viewer has a new panel to display resources accessed up to the
current step, with context menus to go to previous/next access of a
specific resource.
2020-04-27 18:16:46 +01:00
baldurk 267798b240 Add boolean vartype 2020-04-24 20:14:48 +01:00
baldurk 97665b2c30 Display resources in shader viewer tooltips properly 2020-04-23 19:14:09 +01:00
baldurk aae3a75f6e Add newly added variables to start of variables list
* But all variables added in a single step still remain in the order they're
  reported in as changes.
2020-04-23 19:14:08 +01:00
baldurk 1ec3320e99 Don't bounds check instruction numbers against disassembly line count 2020-04-17 16:52:35 +01:00
baldurk 8e082ae109 Preserve order when combining structures in shader viewer 2020-04-14 18:25:18 +01:00
baldurk 97c7dd681f Add global samplers array to shader debug trace 2020-04-09 18:36:12 +01:00
baldurk 47dedaf8c5 Support shader variables that refer to resource bindings 2020-04-09 18:36:12 +01:00
baldurk 59c3a2fbd9 Implement matrix multiplication with matrix/vector/scalar 2020-04-08 18:39:02 +01:00
baldurk 9ba81634b4 Improve the title of shader edit windows 2020-04-03 15:19:28 +01:00
baldurk 27f2a4b7f9 Don't modify states/variables list on replay thread
* Otherwise this can race with the UI thread if it's executing a shortcut.
2020-03-30 21:47:39 +01:00
baldurk 04f90e055d Protect against empty traces in shader viewer 2020-03-20 16:16:51 +00:00
baldurk 3bb57bfed7 Support input source vars referencing complex struct type debug vars 2020-03-18 17:34:59 +00:00
Steve Karolewics 67447b7b7e Improve handling of resource arrays for D3D12
When getting read only resources from the pipe state, stitch back up
according to the bindpoint mappings. When displaying resources in UI,
don't traverse unbounded arrays. Fix resource swizzle on load/sample/
gather instructions, which happens on fetch result, not on the source
operand. Added more tests for unbounded arrays and different ways to
index into arrays.
2020-03-16 20:01:30 +00:00
baldurk 936e6372cb Remove use of 3rdparty/ prefix from includes
* We instead always have 3rdparty/ in the relevant include search paths and rely
  on that. Each library still has its own unique base dir within 3rdparty to
  clarify where the include is coming from.
2020-03-11 18:00:53 +00:00
baldurk e22ed4b877 Fix handling of component swizzle display in cbuffer. Closes #1754 2020-03-04 19:12:24 +00:00
baldurk 175f71beb1 Always combine structures even with only one child
* This means that foo.bar.baz will still have a hierarchy created even if each
  level only has one child.
2020-03-02 17:37:23 +00:00
baldurk a2b437b903 Change Find/Replace dialog to have Find Next/Find Previous buttons
* Enter and shift-enter in the find text go forwarwd and backwards respectively.
* This replaces the previous system of selecting a direction explicitly and only
  ever going in that direction when finding.
2020-02-25 18:19:52 +00:00
baldurk fd14205d40 Don't refresh current event every ContinueDebug 2020-02-24 18:10:56 +00:00
baldurk de7f9d8e1c Remove hasSourceMapping from ShaderDebugTrace
* We expect to always have source mapping, from reflection data if nothing else.
2020-02-20 19:07:29 +00:00
baldurk 08e9d9b594 Fix typo - don't apply debug variables expansion to source vars 2020-02-20 19:07:29 +00:00
baldurk 3baedb966e Don't add a value representation for matrix/struct/array debug variables 2020-02-20 19:07:29 +00:00
baldurk b0e4cd6235 Handle matrix registers in shader viewer 2020-02-20 19:07:28 +00:00
baldurk d58691bc16 Standardise debug and source variable naming conventions
* We standardise on definitions: source variable names contain the full path,
  and identify debug variable by full path. Debug variable members only contain
  the child element - so foo doesn't contain members foo[0] or foo.bar, it
  contains [0] or bar. Path walking happens when mapping source variable to
  debug variable.
* This works just as well for DXBC but works much better for SPIR-V where debug
  variables can be more complex.
2020-02-20 19:07:28 +00:00
baldurk f2c401a255 Check that all states are present before allowing any stepping 2020-02-18 19:18:51 +00:00
baldurk 69a82202e5 Remove redundant/tautological checks 2020-02-13 11:01:45 +00:00
Steve Karolewics 671add4035 Fix shader debugging and pipeline viewer with constant buffer arrays
With SM5.1 and D3D12, constant buffer arrays can be declared which
are treated as an array of resources on the shader side, and a simple
collection of descriptors on the D3D12 side. DXBCDebug::GlobalState
handles the bridge between these by storing each array resource as a
nested ShaderVariable struct. Accessing the data for instructions
traverses the structure similarly. The shader viewer handles nested
resources and displays them in the appropriate tree view. In the
pipeline viewer, descriptors for CB arrays now indicate the array
index and correctly handle buffer offsets for viewing.
2020-02-11 17:10:57 +00:00
baldurk fe30fa91fb Fix python binding consistency with wrong naming scheme 2020-02-06 19:10:43 +00:00
baldurk 95ef40fe7c Add builtin to SourceVariableMapping 2020-02-06 17:58:42 +00:00
baldurk 661ee35f30 Refactor ShaderDebugTrace to not return a single list of complete states
* The ShaderDebugTrace now only sets up the initial state of an opaque
  ShaderDebugger handle.
* This handle can then be passed to a new function - ContinueDebug - to
  iteratively return N more states. The number of states is implementation
  defined and may be a fixed number or it may run for a fixed time.
* The states themselves no longer contain a complete snapshot of all variables,
  but instead only the changed variables for that iteration. The changes are
  stored as before and after value to make it easier to step forwards and
  backwards (only the ShaderDebugState is needed to move forward or backwards,
  you don't have to search back for the last set value of a variable to 'undo' a
  change).
2020-02-06 17:58:42 +00:00
baldurk 410f9d86bd Remove register/HLSL handling from shader viewer, work agnostically
* The shader viewer shouldn't handle specifics of D3D bytecode, instead it now
  works generally with whatever the debug and source variables are.
* VarType::Unknown is used for D3D registers which are typeless.
2020-02-06 17:58:41 +00:00
baldurk fdb6617cb1 Pass back 'registers' for resource bindings in debug trace 2020-02-06 17:58:41 +00:00
baldurk 0e0ff8714c Add fake source-mapping information for constants in debug traces
* cbuffer and input registers no longer have any names elided into them, they
  are 'raw' registers. The source mapping provides the information of where they
  come from as best as possible.
* Since we're now using source-mapping for constants, fix some source mapping
  issues with arrays, nested structs/arrays, and matrix major-ness.
2020-02-06 17:58:41 +00:00
baldurk 66cebe0a4c Refactor shader debug trace to have single mutable variable array
* Moving away from 'registers' explicitly being stored, we now have a single
  variable array where the shader representation is responsible for allocating
  it.
* In DXBC we calculate the number of each type of mutable variable (temps,
  indexable temps, and outputs) and assign slots linearly.
* We also update some naming - high-level variables aren't "locals" since they
  could be globals too, and debugging variables aren't "registers" but simply
  the variables we use for debugging which may be more complex than float4 for
  other APIs.
* The local variable matching by string name is unnecessary for this change
  but will be more useful in future after further refactors where there isn't
  a single list of variables to index into at the upper level.
2020-02-06 17:58:41 +00:00
baldurk 01461db738 Store mapping from instruction to disassembly line in shader debug trace
* This avoids having the UI need to do a scan and expecting to find
  "instruction:" on the start of a line.
* We also move the callstack to be stored per-step, and not in the line info
  mapping.
2020-02-06 17:58:41 +00:00
baldurk 14c1af06a3 Make ShaderViewer::ensureLineScrolled more conservative 2020-02-06 17:58:41 +00:00
baldurk 796f5ab328 Make sure scintilla margin is updated when text is updated 2020-02-06 17:58:41 +00:00