Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIRV shader debugger: OpDebugValue does not update the value of an vector element. #3264

Closed
csyonghe opened this issue Feb 29, 2024 · 2 comments
Assignees
Labels
Bug A crash, misbehaviour, or other problem Unresolved Waiting for a fix or implementation

Comments

@csyonghe
Copy link

Description

When debugging SPIRV shader that uses OpDebugValue to update an element of a OpDebugTypeVector debug variable, the variable value does not change in the debug watch window.

Steps to reproduce

repro.zip

  • Open the attached repro file in top-of-tree render doc.
  • Select the vkCmdDispatch command from event browser.
  • Goto "Pipeline State" tab, click "Debug" button to debug the compute shader.
  • Step through line 75 of the shader source.
  • Should expect t.memberB to have updated vector value, but it is not updated.

Environment

  • RenderDoc commit: 70b79d7
  • Operating System: Windows 11
  • Graphics API: Vulkan 1.2/SPIRV 1.5
@Zorro666 Zorro666 self-assigned this Feb 29, 2024
@Zorro666 Zorro666 added Bug A crash, misbehaviour, or other problem Unresolved Waiting for a fix or implementation labels Feb 29, 2024
@Zorro666
Copy link
Collaborator

The construction of using DebugValue to index into a vector and using OpAccessChain through a pointer to a structure member to modify the y-component is not currently handled by the RenderDoc source level debugging.

Source

    t.memberB = float3(1, 2, 3);
    t.memberB.y = 4.0;

SPIRV slang

%167 = OpAccessChain %_ptr_Function_v3float %t %int_1
       OpStore %167 %168
%175 = OpAccessChain %_ptr_Function_float %167 %int_1
       OpStore %175 %float_4

For reference: SPIRV glslang construction which does work with RenderDoc source debugging

%86 = OpAccessChain %_ptr_Function_v3float %t %int_1
      OpStore %86 %84
%89 = OpAccessChain %_ptr_Function_float %t %int_1 %uint_1
      OpStore %89 %float_4

@csyonghe
Copy link
Author

The difference with glslang and slang's own spirv backend (enabled with -emit-spirv-directly in slangc) is that Slang uses more SSA registers than explicit OpVars and is relying on OpDebugValue to update a debug variable. Therefore we don't use OpDebugDeclare to link a debug variable with an actual variable as done in glslang, but rely more heavily on OpDebugValue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A crash, misbehaviour, or other problem Unresolved Waiting for a fix or implementation
Projects
None yet
Development

No branches or pull requests

2 participants