Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-02-16 13:49:24 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-02-16 13:49:24 +0300
commit29cc18988cfecbbcfa46e9e09273fe970e15a920 (patch)
tree697d9153c54568f6b9cad93e0758b3e681eb469b
parent339e61a0e07aff8e212db431f6126dbab05192a9 (diff)
Fix regression from adding 64-bit switch support.
Missed some cases where we did not handle the loaded type width properly.
-rw-r--r--spirv_cross.cpp5
-rw-r--r--spirv_parser.cpp11
2 files changed, 14 insertions, 2 deletions
diff --git a/spirv_cross.cpp b/spirv_cross.cpp
index cf60197e..fac7587d 100644
--- a/spirv_cross.cpp
+++ b/spirv_cross.cpp
@@ -1677,6 +1677,11 @@ const SmallVector<SPIRBlock::Case> &Compiler::get_case_list(const SPIRBlock &blo
const auto &type = get<SPIRType>(var->basetype);
width = type.width;
}
+ else if (const auto *undef = maybe_get<SPIRUndef>(block.condition))
+ {
+ const auto &type = get<SPIRType>(undef->basetype);
+ width = type.width;
+ }
else
{
auto search = ir.load_type_width.find(block.condition);
diff --git a/spirv_parser.cpp b/spirv_parser.cpp
index 55700fdb..29782c26 100644
--- a/spirv_parser.cpp
+++ b/spirv_parser.cpp
@@ -291,7 +291,15 @@ void Parser::parse(const Instruction &instruction)
{
// The SPIR-V debug information extended instructions might come at global scope.
if (current_block)
+ {
current_block->ops.push_back(instruction);
+ if (length >= 2)
+ {
+ const auto *type = maybe_get<SPIRType>(ops[0]);
+ if (type)
+ ir.load_type_width.insert({ ops[1], type->width });
+ }
+ }
break;
}
@@ -1211,10 +1219,9 @@ void Parser::parse(const Instruction &instruction)
{
const auto *type = maybe_get<SPIRType>(ops[0]);
if (type)
- {
ir.load_type_width.insert({ ops[1], type->width });
- }
}
+
if (!current_block)
SPIRV_CROSS_THROW("Currently no block to insert opcode.");