Commit Graph

201 Commits

Author SHA1 Message Date
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
baldurk 95e6a4a971 Respect font scale for fixed-width fonts 2021-04-12 13:04:02 +01:00
baldurk dce2c62bde Fix typo in shader viewer menu item. Closes #2201 2021-03-08 16:45:05 +00:00
baldurk 29c5965599 Update some missing entries and comments from custom shader snippets 2021-01-27 12:49:36 +00:00
baldurk 026da176bb Update copyright years to 2021 2021-01-13 13:56:10 +00:00
baldurk 7ff7e0a71d Replace fixed C arrays with wrapper class in public interface
* These map more naturally to python tuples and are easier to wrap in and out.
* We also tidy up the FloatVecVal etc and standardise the members of
  ShaderValue.
2020-12-09 18:16:08 +00:00
baldurk 6b8ce92d88 Clean up docstrings in python interfaces to be strictly typed/formatted
* Also added a script that can run as part of CI to verify that the docstring
  matches, by generating a regex from the docstring documented parameter types
  and return type and making sure we find a match within the C headers. This
  ensures all parameters are documented with the right types, no extra
  parameters are documented, and the return type is correct.
* The script also checks proper scoping so that if qrenderdoc docstrings
  mention a renderdoc type, they need to scope it properly.
2020-12-07 17:44:51 +00:00
baldurk e5f4ca7bb8 Remove use of const char * in public API and OS specific where possible
* This prevents unnecessary conversions back and forth between rdcstr and const
  char * when going through interfaces. In the OS specific layer this is rarely
  an issue because most of the implementations don't convert to rdcstr, but it
  is convenient to be able to pass in an rdcstr directly. The few cases where
  there's an unecessary construction of an rdcstr is acceptable.
* A couple of places in the public API need to return a string from a global
  function, so can't return an rdcstr due to C ABI, so they still return a const
  char *.
* Similarly const char * is kept for logging, to avoid a dependency on rdcstr
  and because that's one place where unnecessary conversions/constructions may
  be impactful.
2020-12-07 17:44:50 +00:00
baldurk 9610919c16 Fix copy-paste of rich resource text
* We need to cache to the QString text on demand, which requires a context
  potentially sooner than paint/etc time.
2020-12-02 17:44:46 +00:00
baldurk 806187f613 Save and load edited shaders as capture modifications
* When a shader edit is loaded with a capture, it's loaded as "pending" and not
  immediately applied.
2020-10-21 14:14:20 +01:00
baldurk 2481957f1a When shader debugging is cancelled, still display partial debug trace 2020-09-21 14:39:20 +01:00
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