Repository navigation
[SPIRV] Generate DebugFunctionDefinition in real function instead of wrapper - #6758
Conversation
|
The purpose of debug info is to connect the original source code to the corresponding machine code. In this case, the SPIR-V function that corresponds to HLSL's main function is %src_main, not %main. %main is just wrapper code inserted by dxc. By analogy: when debugging a C program the user wants to start at main, even though technically the program begins at an implementation-specific entry point like _start. Furthermore, putting the DebugFunctionDefinition into %main breaks other debug info. For example, in the following shader: %25 = OpExtInst %void %1 DebugFunction %23 %16 %18 %uint_1 %uint_1 %19 %24 %uint_3 %uint_2 The real function will refer to DebugLocalVariable %29, which points to the DebugFunction %25, but the DebugFunctionDefinition that points to %25 is in %main. |
…ions (#6966) #6758 unfortunately caused a regression for shaders compiled without -fcgl. This PR extends the original fix and corrects the regression. We now emit DebugFunction and DebugFunctionDefinition pairs for both the wrapper and the main functions, and a DebugEntrypoint that points at the wrapper function. This survives inlining.
…wrapper (microsoft#6758) This PR moves the DebugFunctionDefinition instruction from the SPIR-V wrapper to the real function. This supplies debugger users with greater accuracy.
…ions (microsoft#6966) microsoft#6758 unfortunately caused a regression for shaders compiled without -fcgl. This PR extends the original fix and corrects the regression. We now emit DebugFunction and DebugFunctionDefinition pairs for both the wrapper and the main functions, and a DebugEntrypoint that points at the wrapper function. This survives inlining.
This PR moves the DebugFunctionDefinition instruction from the SPIR-V wrapper to the real function. This supplies debugger users with greater accuracy.