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

Function GetNSDIVersion

source/val/validate_extensions.cpp:117–125  ·  view source on GitHub ↗

Returns the declared NSDI version from the OpExtInstImport referenced by |inst|. Returns 0 if not a NonSemantic.Shader.DebugInfo import.

Source from the content-addressed store, hash-verified

115// Returns the declared NSDI version from the OpExtInstImport referenced by
116// |inst|. Returns 0 if not a NonSemantic.Shader.DebugInfo import.
117uint32_t GetNSDIVersion(const ValidationState_t& _, const Instruction* inst) {
118 const auto* import_inst = _.FindDef(inst->word(3));
119 if (!import_inst) return 0;
120 const std::string name = import_inst->GetOperandAs<std::string>(1);
121 const char kPrefix[] = "NonSemantic.Shader.DebugInfo.";
122 if (name.find(kPrefix) != 0) return 0;
123 return static_cast<uint32_t>(
124 std::strtoul(name.c_str() + sizeof(kPrefix) - 1, nullptr, 10));
125}
126
127// Check that the operand of a debug info instruction |inst| at |word_index|
128// is a result id of an instruction with |expected_opcode|.

Callers 2

ValidateOperandDebugTypeFunction · 0.85
ValidateExtInstDebugInfoFunction · 0.85

Calls 3

FindDefMethod · 0.80
wordMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected