Commit acf6307 1 parent 7109ef2 commit acf6307 Copy full SHA for acf6307
File tree 1 file changed +25
-6
lines changed
renderdoc/driver/shaders/dxil
1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -6241,14 +6241,33 @@ SourceMappingInfo Program::ParseDbgOpDeclare(const DXIL::Instruction &inst) cons
6241
6241
SourceMappingInfo ret;
6242
6242
ret.isDeclare = true ;
6243
6243
6244
- // arg 0 contains the SSA Id of the alloca result which represents the local variable (a pointer)
6244
+ // arg 0 contains the SSA Id of the result which represents the local variable (a pointer)
6245
6245
const Metadata *allocaInstMD = cast<Metadata>(inst.args [0 ]);
6246
6246
RDCASSERT (allocaInstMD);
6247
- const Instruction *allocaInst = cast<Instruction>(allocaInstMD->value );
6248
- RDCASSERT (allocaInst);
6249
- RDCASSERTEQUAL (allocaInst->op , Operation::Alloca);
6250
- ret.dbgVarId = Program::GetResultSSAId (*allocaInst);
6251
- Program::MakeResultId (*allocaInst, ret.dbgVarName );
6247
+ const DXIL::Value *value = allocaInstMD->value ;
6248
+ const Instruction *varInst = cast<Instruction>(value);
6249
+ if (varInst)
6250
+ {
6251
+ // Instruction can be alloca or NoOp
6252
+ RDCASSERT (varInst->op == Operation::Alloca || varInst->op == Operation::NoOp);
6253
+ ret.dbgVarId = Program::GetResultSSAId (*varInst);
6254
+ Program::MakeResultId (*varInst, ret.dbgVarName );
6255
+ }
6256
+ else
6257
+ {
6258
+ const GlobalVar *gv = cast<GlobalVar>(allocaInstMD->value );
6259
+ if (gv)
6260
+ {
6261
+ ret.dbgVarId = gv->ssaId ;
6262
+ rdcstr n = DXBC::BasicDemangle (gv->name );
6263
+ DXIL::SanitiseName (n);
6264
+ ret.dbgVarName = n;
6265
+ }
6266
+ else
6267
+ {
6268
+ RDCERR (" Unhandled metadata value type %s" , ToStr (allocaInstMD->value ->kind ()).c_str ());
6269
+ }
6270
+ }
6252
6271
6253
6272
// arg 1 is DILocalVariable metadata
6254
6273
const Metadata *localVariableMD = cast<Metadata>(inst.args [1 ]);
You can’t perform that action at this time.
0 commit comments