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

Function GetExtensionString

source/extensions.cpp:26–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace spvtools {
25
26std::string GetExtensionString(const spv_parsed_instruction_t* inst) {
27 if ((inst->opcode != static_cast<uint16_t>(spv::Op::OpExtension)) &&
28 (inst->opcode !=
29 static_cast<uint16_t>(spv::Op::OpConditionalExtensionINTEL))) {
30 return "ERROR_not_op_extension";
31 }
32
33 const bool is_conditional =
34 inst->opcode ==
35 static_cast<uint16_t>(spv::Op::OpConditionalExtensionINTEL);
36 assert(inst->num_operands == (is_conditional ? 2 : 1));
37 const uint16_t op_i = is_conditional ? 1 : 0;
38
39 const auto& operand = inst->operands[op_i];
40 assert(operand.type == SPV_OPERAND_TYPE_LITERAL_STRING);
41 assert(inst->num_words > operand.offset);
42 (void)operand; /* No unused variables in release builds. */
43
44 return spvDecodeLiteralStringOperand(*inst, op_i);
45}
46
47std::string ExtensionSetToString(const ExtensionSet& extensions) {
48 std::stringstream ss;

Callers 3

CheckIfKnownExtensionFunction · 0.85
ValidateExtensionFunction · 0.85
RegisterExtensionFunction · 0.85

Calls 1

Tested by

no test coverage detected