layers: Handle OpTypeBool in structs
diff --git a/layers/shader_module.cpp b/layers/shader_module.cpp
index 98c2d32..d189189 100644
--- a/layers/shader_module.cpp
+++ b/layers/shader_module.cpp
@@ -1888,7 +1888,8 @@
// Returns the base type (float, int or unsigned int) or struct (can have multiple different base types inside)
uint32_t SHADER_MODULE_STATE::GetBaseType(const spirv_inst_iter &iter) const {
const uint32_t opcode = iter.opcode();
- if (opcode == spv::OpTypeFloat || opcode == spv::OpTypeInt || opcode == spv::OpTypeStruct) {
+ if (opcode == spv::OpTypeFloat || opcode == spv::OpTypeInt || opcode == spv::OpTypeBool || opcode == spv::OpTypeStruct) {
+ // point to itself as its the base type (or a struct that needs to be traversed still)
return iter.word(1);
} else if (opcode == spv::OpTypeVector) {
const auto& component_type = get_def(iter.word(2));
@@ -1903,6 +1904,9 @@
const auto& type = get_def(iter.word(3));
return GetBaseType(type);
}
+ // If we assert here, we are missing a valid base type that must be handled. Without this assert, a return value of 0 will
+ // produce a hard bug to track
+ assert(false);
return 0;
}
diff --git a/layers/shader_validation.cpp b/layers/shader_validation.cpp
index fa68e97..1d98a18 100644
--- a/layers/shader_validation.cpp
+++ b/layers/shader_validation.cpp
@@ -65,6 +65,8 @@
} else if (a_opcode == spv::OpTypeFloat) {
// Match width
return a_base_insn.word(2) == b_base_insn.word(2);
+ } else if (a_opcode == spv::OpTypeBool) {
+ return true;
} else if (a_opcode == spv::OpTypeStruct) {
// Match on all element types
if (a_base_insn.len() != b_base_insn.len()) {