MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / GetDebugSourceText

Function GetDebugSourceText

source/val/validate_extensions.cpp:1129–1139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1127}
1128
1129std::string GetDebugSourceText(ValidationState_t& _, const Instruction* inst,
1130 uint32_t ext_inst_opcode) {
1131 assert(ext_inst_opcode == NonSemanticShaderDebugInfoDebugSource ||
1132 ext_inst_opcode == NonSemanticShaderDebugInfoDebugSourceContinued);
1133 const uint32_t string_operand =
1134 (ext_inst_opcode == NonSemanticShaderDebugInfoDebugSource) ? 6 : 5;
1135 auto* debug_source_text_insn = _.FindDef(inst->word(string_operand));
1136 // Validated to be an OpString
1137 assert(debug_source_text_insn->opcode() == spv::Op::OpString);
1138 return debug_source_text_insn->GetOperandAs<std::string>(1);
1139}
1140
1141// We build up a vector that is length of the DebugSource lines and get how long
1142// they are to make sure anyone using a DebugSource provides valid Line/Columns

Callers 1

Calls 3

FindDefMethod · 0.80
wordMethod · 0.80
opcodeMethod · 0.45

Tested by

no test coverage detected