Commit Graph

278 Commits

Author SHA1 Message Date
Jake Turner 811c6c6ecc ShaderViewer uses GetShaderDebugVariable() when matching resource vars
This matches how debug variables are matched
This supports source mapping to resources which are a child member of a ShaderVariable i.e. an array element
2026-01-26 10:49:09 +13:00
qwmnerbvqwmn 67a6f20b6e Support #pragma once and multiple inclusions in HLSL editing 2026-01-23 03:02:57 +09:00
baldurk 9bef60d6c3 Display source variables mapped to OpUndef as <undefined value>
* Undefined values are still 0xccccccccc, since that value can propagate through
  operations. But source variables mapped directly to an OpUndef are displayed
  in a more semantically clear way.
2026-01-19 13:34:58 +00:00
Jake Turner 075870caf5 Fix replace all message showing N+1 replacements instead of N 2026-01-08 06:58:56 +13:00
Sharlock93 2a1b67eeb6 Sorting array members in the Watch and High Level Variables window
This sets the offset of the VariableTag for array members in the watch
window. This ensures they are sorted correctly when displayed.
This also adds sorting by sourceVarIdx if the memebers are
globalSourceVars which fixes the sorting in the High Level Variables
window for built-in Variables
2026-01-06 02:31:07 +00:00
baldurk 856c838def Update copyright years to 2026 and fix copyright ranges
* In a previous update in 2021 many copyright ranges were truncated
  accidentally, and some files have been copy-pasted with wrong years. These
  dates have been fixed based on git history and original copyright messages.
2026-01-05 14:17:28 +00:00
baldurk ddf19304b7 Handle resources encountered in the SPIR-V debugging that don't exist
* It is common for drivers to dead-code eliminate resources and they will not
  show up in reflection at all and will not have a binding. For these we will
  still encounter them when debugging so need to ensure we handle that case.
* This unfortunately makes a previously illegal/error-checked case silently
  continue, so we add API-specific asserts.
2025-12-02 12:17:35 +00:00
Jake Turner ccbb516610 Simplify DXIL Disassembler/Debugger SSA ID name strings and aliases
Store SSA ID name strings in a container which is shared between the disassembler and the debugger.
The SSA ID name strings are guaranteed to be unique by appending the SSA ID value.

Do not use resource names for SSA ID names, only show resource names when a DXIL handle is created i.e. DXOp::CreateHandle, DXOp::CreateHandleFromBinding & DXOp::CreateHandleFromHeap

This means the debugger now has a unique name for each ShaderVariable generated.

Revert the ShaderViewer consistency changes which were only required because the DXIL debugger did not generate unique names for ShaderVariables.
2025-11-13 13:10:44 +13:00
Jake Turner c534b41eb6 Tune the ShaderVariable consistency checks for resources
Do not check before/after equals existing value for ReadOnlyResource and ReadWriteResource
In the DXIL debugger for resources the same SSA ID might have different names
2025-11-11 10:53:15 +13:00
baldurk ffa70fabdc Auto-break on NonSemantic.DebugBreak instructions
* This is almost completely worthless as it seems at least NV and amdvlk both
  actually crash the GPU on this instruction, meaning there's no way to get it
  to the shader debugger. But on other drivers like radv, or maybe if this is
  fixed in future, this will be useful.
* For this reason it also can't be tested automatically.
2025-08-21 16:09:40 +01:00
baldurk ceb062b658 Add a DescriptorType to GetDescriptors query
* This will be optional in many cases but for some situations might be required
  when type information is not implicitly available in the descriptor store.
  Generally it should always be available unless the descriptor store is being
  viewed 'blank' purely from its contents with no other context.
2025-07-30 22:10:23 +01:00
baldurk 3be544c51d Prevent infinite recursion when processing includes for shader edits 2025-07-29 13:05:07 +01:00
baldurk 93617f3d11 Adjust shader viewer highlight colours for dark theme 2025-06-05 17:11:45 +01:00
Jake Turner f120f46b45 ShaderViewer UI validation for ShaderVariable construction
if members.size() == 0
rows * columns must be between 1 and 15
type must not be Struct

if members.size() > 0
type must be Struct or Unknown or ConstantBlock
rows must be 0
columns must be 0
then recurse and check construction of each element of members array
2025-05-19 16:44:25 +01:00
Jake Turner 8dcf051d99 Fine grained ShaderVariable comparison for ShaderViewer UI consistency 2025-05-14 18:11:05 +01:00
Jake Turner 47c64f607d ShaderVariable UI consistency check for duplicated variable change
Detect if a ShaderVariable has multiple changes per step
2025-05-14 16:28:37 +01:00
Jake Turner 370334ca6e Do not do ShaderViewer UI consistency checks in RELEASE builds 2025-05-09 13:27:10 +01:00
Jake Turner 6b39f8de88 ShaderViewer UI error checks for consistency in ShaderVariableChanges
Step Forwards: first appearance of a variable must have "before" = {}
Step Forwards: not-first appearance of a variable "before" must equal currently known value

Step Backwards: first appearance of a variable must have "after" = {}
Step Backwards: not-first appearance of a variable "after" must equal currently known value
2025-05-08 16:06:35 +01:00
baldurk 2322e165de Update copyright years to 2025 2025-03-14 18:54:37 +00:00
baldurk 86e8909b1e Display colour swatch when showing cbuffer values as RGB. Closes #3533 2025-03-06 16:07:49 +00:00
baldurk 959d330488 Treat RGB display of float values as in linear space always. Refs #3533 2025-03-06 16:07:49 +00:00
baldurk c9a621a812 List registers last in shader viewer tables 2024-12-19 15:13:52 +00:00
baldurk 5c73842332 Fix source variables not properly propagating updateID 2024-12-19 14:08:02 +00:00
Jake Turner 11870b184a ShaderViewer support for ShaderDirectAccess shader resources
i.e. D3D12 SM6.6 HLSL Dynamic resources which index directly into the resource/sampler heap and not via shader bindings.
2024-12-04 13:40:17 +00:00
Jake Turner 2443dbcb55 Shader Editing: Fix problem where single Replace didn't work
Use the same findHash string in performReplace() as in performFind() by including the find direction in the findHash in performReplace()
2024-11-09 07:07:11 +00:00
Louis de Carufel 71ac13e9bf Bookmarks are now listed in menu. 2024-06-13 10:27:41 +01:00
Jake Turner b7b5ec0c14 Remove device scaling factor from margins in the UI
Makes ShaderViewer, Capture Comments and Python Shell margins look correct for non-unit system scaling
2024-06-12 16:37:02 +01:00
baldurk 341f9a689b Fix shader viewer bookmarks to work with editing and viewing shaders
* Previously it was only applied for debugging shaders.
2024-05-31 15:26:07 +01:00
Louis de Carufel 0e64cc5368 Added shader viewer bookmarks and find shortcuts. 2024-05-24 10:35:06 +01:00
baldurk 205ed0e6fa Remove old shader bindpoint mapping handling entirely 2024-04-10 18:58:52 +01:00
baldurk 2bbe1a8cd9 Update shader viewer and debugging with new reporting for shader binds
* This shifts from reporting from the old style bindset/bind to the new system
  of only referencing by shader interface and index (independent of binding
  model).
* The vulkan shader debugger re-uses the replay interface to cache descriptor
  access and descriptor contents in a fashion friendly to interface-index
  lookup.
2024-04-10 18:58:51 +01:00
Jake Turner 3a8fecf08e Prevent Shader Editor tooltip showing multiple "(F5)" 2024-04-10 08:20:56 +01:00
baldurk 3e2340fe16 Add identified support for slang (the language and the tool) 2024-03-01 12:11:37 +00:00
baldurk 9f4f0e6aa1 Update copyright years to 2024 2024-02-12 11:04:52 +00:00
baldurk 69dcb42a05 Add enums and API-agnostic handling for new task and mesh shader stages
* The enums are given after compute, to preserve indices for the normal vertex
  pipeline.
* Mesh dispatches are considered a new action type, rather than being bundled
  into the `Drawcall` type. This will allow them to be distinguished by API
  backends as needed. The UI treats them as drawcalls
* We apply this universally even though it's not relevant to D3D11/GL. It means
  a couple of empty array entries but it should not cause any significant
  issues.
* Shader messages will be identified by group and thread as with compute
  shaders. For mesh shaders there is an additional subdivision to identify them
  by task group, since each task group can submit a grid of mesh groups.
2023-11-16 18:20:23 +00:00
baldurk 9d39b8e1a8 Reformat code for clang-format 15 2023-09-05 11:02:08 +01:00
baldurk e7430226e9 Match SPIR-V version as much as possible when rebuilding shaders 2023-08-22 13:41:39 +01:00
baldurk 19d7b038c2 Don't allow tooltip to display if context menu is shown in shader viewer 2023-08-04 17:06:02 +01:00
William Pearson f82ef87595 Enable tooltips for shader execute forwards/backwards menus
MakeExecuteAction already sets tooltips for each QAction it creates,
but these are not used in a QMenu unless the toolTipsVisible property
is set to true.
2023-04-14 19:04:15 +01:00
baldurk d47e79ae07 Update copyright years to 2023 2023-02-01 12:23:32 +00:00
baldurk 0acb955e19 Create virtual distinction between Vulkan & GL SPIR-V. Closes #2798
* This distinction unfortunately does not exist in SPIR-V so we have to carry
  around this metadata ourselves. Rather than allowing free specification of
  tools based on API, instead pretend that Vulkan and GL SPIR-V are separate
  format, and duplicate all SPIR-V tools to handle "both" types. This allows
  appropriate tool selection based on the encoding.
2022-12-27 13:39:44 +00:00
baldurk 305eb33204 Show better tooltips for constant buffers & structs
* { ... } is clearer than having just ??? show up which looks like an error.
2022-09-13 17:24:42 +01:00
baldurk b49d7982d6 When looking for the start of an line, ignore if there's no debug info
* When searching for the start of a range of instructions mapped to a single
  line when stepping backwards, we need to ignore instructions that don't have
  any debug info because they will look like a 'different' smaller stack.
2022-09-13 17:24:42 +01:00
baldurk 3013be8d52 Fix use of wrong instruction counter when instruction info is sparse 2022-09-13 17:24:42 +01:00
baldurk c3c791be55 When editing a shader, default to the edit base file
* In the case of a munged file with #line directives, we want to edit that file,
  not the split-out view of the file containing the entry point.
2022-08-11 10:23:48 +01:00
baldurk 855ad1afed Fix instruction number on DXBC instruction info 2022-08-10 14:56:44 +01:00
baldurk e061ea3b2e Improve handling of compilers & command line for edited shaders
* We store the compiler used (when known) in shader debug info and use that to
  select the compiler for editing as even higher priority than the default for a
  given language/encoding combination.
* We also ensure that for known tools we add the input and output parameters
  last, after any custom parameters, so that they are always present regardless
  of what the user puts in.
2022-08-10 14:56:44 +01:00
baldurk 94d1ce3917 Cache text for GPUAddress values properly 2022-08-04 16:56:32 +01:00
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