diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-02-11 17:50:22 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-02-11 17:50:22 +0100 |
commit | 8f4793b225b4fc396eda7f2f9b52bd5eac47c3df (patch) | |
tree | f9fd967df4099a8698e6f3f6b4ba6bab62d25f56 /thirdparty/glslang/SPIRV/disassemble.cpp | |
parent | e11f0d9bfd2d7ceae9f8d3c3fd7dd3422bb9edf6 (diff) |
Revert "vulkan: Update volk, headers and glslang to 1.3.204"
This reverts commit d233908fb6c02f96f13de8b627510a5149bfecc3.
Diffstat (limited to 'thirdparty/glslang/SPIRV/disassemble.cpp')
-rw-r--r-- | thirdparty/glslang/SPIRV/disassemble.cpp | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/thirdparty/glslang/SPIRV/disassemble.cpp b/thirdparty/glslang/SPIRV/disassemble.cpp index 74dd605409..73c988c5b3 100644 --- a/thirdparty/glslang/SPIRV/disassemble.cpp +++ b/thirdparty/glslang/SPIRV/disassemble.cpp @@ -43,7 +43,6 @@ #include <stack> #include <sstream> #include <cstring> -#include <utility> #include "disassemble.h" #include "doc.h" @@ -101,7 +100,6 @@ protected: void outputMask(OperandClass operandClass, unsigned mask); void disassembleImmediates(int numOperands); void disassembleIds(int numOperands); - std::pair<int, std::string> decodeString(); int disassembleString(); void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands); @@ -292,44 +290,31 @@ void SpirvStream::disassembleIds(int numOperands) } } -// decode string from words at current position (non-consuming) -std::pair<int, std::string> SpirvStream::decodeString() +// return the number of operands consumed by the string +int SpirvStream::disassembleString() { - std::string res; - int wordPos = word; - char c; - bool done = false; + int startWord = word; + + out << " \""; + const char* wordString; + bool done = false; do { - unsigned int content = stream[wordPos]; + unsigned int content = stream[word]; + wordString = (const char*)&content; for (int charCount = 0; charCount < 4; ++charCount) { - c = content & 0xff; - content >>= 8; - if (c == '\0') { + if (*wordString == 0) { done = true; break; } - res += c; + out << *(wordString++); } - ++wordPos; - } while(! done); - - return std::make_pair(wordPos - word, res); -} - -// return the number of operands consumed by the string -int SpirvStream::disassembleString() -{ - out << " \""; - - std::pair<int, std::string> decoderes = decodeString(); + ++word; + } while (! done); - out << decoderes.second; out << "\""; - word += decoderes.first; - - return decoderes.first; + return word - startWord; } void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands) @@ -346,7 +331,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, nextNestedControl = 0; } } else if (opCode == OpExtInstImport) { - idDescriptor[resultId] = decodeString().second; + idDescriptor[resultId] = (const char*)(&stream[word]); } else { if (resultId != 0 && idDescriptor[resultId].size() == 0) { @@ -443,7 +428,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, --numOperands; // Get names for printing "(XXX)" for readability, *after* this id if (opCode == OpName) - idDescriptor[stream[word - 1]] = decodeString().second; + idDescriptor[stream[word - 1]] = (const char*)(&stream[word]); break; case OperandVariableIds: disassembleIds(numOperands); |