Commit Graph

280 Commits

Author SHA1 Message Date
baldurk db1f17476e Track variables being changed across steps/runs
* This allows us to more accurately display those that have been modified since
  the last step, when a source-level step covers multiple instruction-level
  steps.
* We also do our own sorting of source variables based on how recently they were
  updated. This applies in both directions, so stepping backwards and
  'reversing' a variable change will also count as a recent update.
2022-08-03 17:44:11 +01:00
baldurk 935fa49c98 Store source vars data per-instruction rather than per-state
* Since the source vars data doesn't change for a given instruction, we can pre-
  calculate it and save time on re-calculating per-state.
* Note callstack *can* change per-state on SPIR-V where the same instruction can
  be reached by different flow paths, so the callstack remains part of the per-
  state data.
2022-08-03 17:44:11 +01:00
baldurk fda5c4819a Scroll shader viewer to entry point file & line using debug info 2022-07-22 16:10:59 +01:00
baldurk c817b6f9ff Fix clang warning 2022-06-30 14:49:02 +01:00
baldurk 7990254bc0 Avoid copying shader debug states, only move them 2022-06-30 13:51:26 +01:00
baldurk b9e5e2fd5c Use QList for variables in ShaderViewer
* Using a linked list instead of a vector makes insert/erase operations for
  variables being created and destroyed significantly faster.
2022-06-30 13:24:36 +01:00
baldurk 20f42feab4 Improve mapping of breakpoints to disassembly & source
* We breakpoint directly on source/disassembly lines rather than trying to map
  to instructions that may get stepped over and skipped.
2022-06-22 20:04:42 +01:00
baldurk fcc7eada44 Ignore whitespace when matching variable tooltip expressions 2022-06-02 17:01:48 +01:00
baldurk 77232e0288 Fix lookup of HLSL direct cbuffer variable references 2022-05-31 13:06:42 +01:00
baldurk abe645f031 Add support for saving and loading structure definitions 2022-05-20 14:15:30 +01:00
baldurk cb49f21f2a Support enums in buffer formatter 2022-05-20 13:37:26 +01:00
baldurk cef00a102b Add struct VarType and combine flags into single field
* This is not a space saving right now, but allows more flags to be added
  without adding more storage.
2022-05-20 13:37:25 +01:00
baldurk 2fc0866c9f Fix display of register names for matrix source variables 2022-05-09 11:32:11 +01:00
baldurk e5000ff91b Handle source variables that map to non-existant debug variables 2022-05-04 15:47:04 +01:00
baldurk d9c98f44f6 Fix stepping backwards working incorrectly with multiple location maps 2022-04-28 16:34:44 +01:00
baldurk 1201d47db4 Fix tooltips for sampler variables in shader debugger 2022-04-21 00:58:15 +01:00
baldurk 26585e9a1b Fix arrayed resource bindings shader debug variables. Closes #2550 2022-04-18 17:06:44 +01:00
baldurk be38f45171 Fix handling of split-register matrix source variables. Closes #2536 2022-04-11 12:57:10 +01:00
baldurk 9c1eeed29b Fix copy-paste error with GLSL unsigned integer texture declarations 2022-03-30 12:51:36 +01:00
baldurk 378cad24bd Fix some missing comments in custom shader snippet generation 2022-03-30 12:48:38 +01:00
baldurk ad9a4e854f Fix to bizarre CI failure
* For some reason using != on these QSet<QString> fails in release only on
  github's CI only. I don't know what is broken on their runners but this
  workaround fixes it.
2022-03-09 03:02:13 +00:00
baldurk a265a8363d Compile fixes 2022-03-08 18:32:31 +00:00
baldurk 7b4f535663 Refactor watch variables to support complex types including structs 2022-03-07 18:45:57 +00:00
baldurk b0db52c80b Show variable context menu for constants panel as well 2022-03-07 14:45:44 +00:00
baldurk 26de305e1a Allow adding a watch for any text selection 2022-03-07 14:45:44 +00:00
baldurk 8e76069ecf Switch watch variables control from table to tree widget
* This will allow watching structs or arrays
2022-03-07 14:45:44 +00:00
baldurk 3af7458763 Continue to show last value of a watch variable when it's not available 2022-03-07 14:45:44 +00:00
baldurk 87f2adc829 Improve mapping of source locations to instructions in shader debugging 2022-03-07 14:45:44 +00:00
baldurk fcdea67879 Update copyright years to 2022 2022-02-17 17:38:32 +00:00
Steve Karolewics c6c93efd22 Fix shader debugging display of high-level boolean variables 2022-02-04 20:04:19 +00:00
baldurk e58cb9a73b Fix stepping over/into on instructions in the same function 2022-02-04 16:45:15 +00:00
baldurk 7f130077da When source debugging, skip non-mapped instructions
* We entirely skip over any instructions that don't have a source mapping. These
  are assumed to be filler instructions or others that don't correspond usefully
  to anything in the source.
2022-02-04 16:45:15 +00:00
baldurk fdda8be9c6 Allow watch variables to specify a color-swatch with ,c. Closes #2475 2022-02-02 15:00:44 +00:00
baldurk e42b0ff2ca Refactor ShaderVariable use and non-32-bit precision. Closes #2466 2022-02-02 15:00:43 +00:00
baldurk 3ac4bd0ebd Refactor custom shaders to abstract binding differences. Closes #2458
* Newly written shaders and any updated shaders can now use pre-defined macros
  to abstract away binding differences between APIs, so custom shaders will be
  more portable in particular shaders written in HLSL for D3D or GLSL on OpenGL
  won't break on vulkan because they refer to incorrect binds.
2022-01-31 19:14:08 +00:00
Mikkel Gjoel 41d39b58ce Pass range-min/max to ApplyCustomShader
Adding rangeminmax to globals, snippet support and updated docs to match

Fixes bug in replay_output.cpp, causing a crash due to missing texhandle
2021-11-03 20:26:18 +00:00
baldurk d4a5592780 Add functionality to reset an edited shader to original. Closes #2334
* We also add the ability to toggle on/off the replacement being active without
  needing to intentionally add a compile error (and this also makes it more
  explicitly clear when the shader replacement is enabled or not. This could be
  useful for quick A/B testing between the edited version and the original.
2021-11-02 14:09:50 +00:00
baldurk de38cf7b9c Require explicit debug information to support source debugging
* SPIR-V files currently can have source files, but not source debugging
  information, which is a distinction that didn't exist otherwise.
2021-11-02 12:27:42 +00:00
baldurk 4c4b0c58ec Fix 0-based line numbers in shader viewer find results
* Scintilla lines are numbered from 0 but for user display we want to be
  1-based.
2021-07-22 11:57:12 +01:00
baldurk 124d0e71b6 Implement more flexible step/run options. Closes #2276 Closes #2312
* We split stepping for source debugging into step over/into/out depending on
  how it handles function calls. Step Into is the same behaviour as before - it
  steps to the next source line executed regardless of if it's inside a function
  call. Step Over is similar but will not enter function calls. We define that
  as the callstack growing (so staying the same or shrinking - returning from a
  function - is OK), and this is as accurate as the underlying debug
  information. Step Out will run until the callstack shrinks, i.e. returning
  from a function.
* This is a slight behaviour change of keyboard shortcuts - F10 was effectively
  doing step into and will now step over. F11 will step into which is the old
  behaviour.
* All these variants have backwards versions, and to remain consistent we keep
  the shift modifier as forwards/backwards. This differs from visal studio where
  step out is shift-F10.
* The seems like the best balance - using any other variant would likely confuse
  muscle memory of anyone used to visual studio (where these shortcuts are
  intended to mimick), if only because F10 would be step into whether or not F11
  is used for step over or some other key which would likely be even more
  confusing either way. Trying to twist to use Shift-F10 for step out would be
  inconsistent with the other backwards running operations and likely cause more
  confusion than it saves in matching VS's shortcuts exactly. Also an accidental
  Shift-F10 is not too destructive, the user can realise it didn't Step Out
  forwards, and press Ctrl-F10 or look up the button.
* The hope is that most likely people doing source debugging and familiar with
  these keys expect F10 to step over, so the previous behaviour was unexpected
  but easy to work around, and that changing the meaning of the key won't
  disrupt them. Or at least the disruption is less than other alternatives.
2021-07-21 13:39:26 +01:00
baldurk 71bbc53759 Implement double clicking to go to find-all results. Closes #2277 2021-07-20 16:59:11 +01:00
baldurk 091cde69d4 Slightly tweak find-all highlight colour. Refs #2277 2021-07-20 15:52:55 +01:00
baldurk 8d5ef8109e When pre-populating find text, also try current word and select the text 2021-07-20 15:41:29 +01:00
baldurk e182a477b8 Close floating find windows when pressing escape 2021-07-20 15:41:03 +01:00
baldurk c451dc81f3 runTo expects an instruction instead of a step index 2021-06-30 16:18:08 +01:00
baldurk cc7115e24c Show better window titles for edited shaders 2021-06-28 13:10:11 +01:00
baldurk 331db5b4ba Fix custom shader edits to write the exact editor contents to disk 2021-05-17 13:47:58 +01:00
baldurk c715d2c7ad Pre-populate selected text in shader find dialog when pressing ctrl-f 2021-05-13 15:01:54 +01:00
baldurk b4ec703d97 Expose shader printf messages in the UI 2021-05-11 16:15:31 +01:00
baldurk 6271f010cc Don't hardcode font size/width calculating margin sizes. Closes #2227 2021-04-12 13:04:02 +01:00