MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / GetOpString

Function GetOpString

layers/error_message/spirv_logging.cpp:363–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363const char* GetOpString(const std::vector<uint32_t>& instructions, uint32_t string_id) {
364 uint32_t offset = kModuleStartingOffset;
365 while (offset < instructions.size()) {
366 const uint32_t instruction = instructions[offset];
367 const uint32_t length = Length(instruction);
368 const uint32_t opcode = Opcode(instruction);
369
370 // if here, seen all OpString and can return early
371 if (opcode == spv::OpFunction) break;
372
373 if (opcode == spv::OpString) {
374 const uint32_t result_id = instructions[offset + 1];
375 if (result_id == string_id) {
376 return reinterpret_cast<const char*>(&instructions[offset + 2]);
377 }
378 }
379 offset += length;
380 }
381 return nullptr;
382}
383
384uint32_t GetConstantValue(const std::vector<uint32_t>& instructions, uint32_t constant_id) {
385 uint32_t offset = kModuleStartingOffset;

Callers 4

ReadDebugSourceFunction · 0.85
GetLineAndFilenameFunction · 0.85
FindGlobalNameFunction · 0.85

Calls 3

LengthFunction · 0.85
OpcodeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected