|
@@ -3032,7 +3032,7 @@ string CompilerGLSL::to_composite_constructor_expression(uint32_t id)
|
|
|
return to_rerolled_array_expression(to_enclosed_expression(id), type);
|
|
return to_rerolled_array_expression(to_enclosed_expression(id), type);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
- return to_expression(id);
|
|
|
|
|
|
|
+ return to_unpacked_expression(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
string CompilerGLSL::to_expression(uint32_t id, bool register_expression_read)
|
|
string CompilerGLSL::to_expression(uint32_t id, bool register_expression_read)
|
|
@@ -8265,14 +8265,14 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|
|
if (type_is_empty(out_type) && !backend.supports_empty_struct)
|
|
if (type_is_empty(out_type) && !backend.supports_empty_struct)
|
|
|
constructor_op += "0";
|
|
constructor_op += "0";
|
|
|
else if (splat)
|
|
else if (splat)
|
|
|
- constructor_op += to_expression(elems[0]);
|
|
|
|
|
|
|
+ constructor_op += to_unpacked_expression(elems[0]);
|
|
|
else
|
|
else
|
|
|
constructor_op += build_composite_combiner(result_type, elems, length);
|
|
constructor_op += build_composite_combiner(result_type, elems, length);
|
|
|
constructor_op += " }";
|
|
constructor_op += " }";
|
|
|
}
|
|
}
|
|
|
else if (swizzle_splat && !composite)
|
|
else if (swizzle_splat && !composite)
|
|
|
{
|
|
{
|
|
|
- constructor_op = remap_swizzle(get<SPIRType>(result_type), 1, to_expression(elems[0]));
|
|
|
|
|
|
|
+ constructor_op = remap_swizzle(get<SPIRType>(result_type), 1, to_unpacked_expression(elems[0]));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -8280,7 +8280,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|
|
if (type_is_empty(out_type) && !backend.supports_empty_struct)
|
|
if (type_is_empty(out_type) && !backend.supports_empty_struct)
|
|
|
constructor_op += "0";
|
|
constructor_op += "0";
|
|
|
else if (splat)
|
|
else if (splat)
|
|
|
- constructor_op += to_expression(elems[0]);
|
|
|
|
|
|
|
+ constructor_op += to_unpacked_expression(elems[0]);
|
|
|
else
|
|
else
|
|
|
constructor_op += build_composite_combiner(result_type, elems, length);
|
|
constructor_op += build_composite_combiner(result_type, elems, length);
|
|
|
constructor_op += ")";
|
|
constructor_op += ")";
|
|
@@ -10228,6 +10228,12 @@ void CompilerGLSL::append_global_func_args(const SPIRFunction &func, uint32_t in
|
|
|
|
|
|
|
|
string CompilerGLSL::to_member_name(const SPIRType &type, uint32_t index)
|
|
string CompilerGLSL::to_member_name(const SPIRType &type, uint32_t index)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (type.type_alias != TypeID(0) &&
|
|
|
|
|
+ !has_extended_decoration(type.type_alias, SPIRVCrossDecorationBufferBlockRepacked))
|
|
|
|
|
+ {
|
|
|
|
|
+ return to_member_name(get<SPIRType>(type.type_alias), index);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
auto &memb = ir.meta[type.self].members;
|
|
auto &memb = ir.meta[type.self].members;
|
|
|
if (index < memb.size() && !memb[index].alias.empty())
|
|
if (index < memb.size() && !memb[index].alias.empty())
|
|
|
return memb[index].alias;
|
|
return memb[index].alias;
|
|
@@ -12776,6 +12782,14 @@ void CompilerGLSL::fixup_type_alias()
|
|
|
// This is not allowed, drop the type_alias.
|
|
// This is not allowed, drop the type_alias.
|
|
|
type.type_alias = 0;
|
|
type.type_alias = 0;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (type.type_alias && !type_is_block_like(this->get<SPIRType>(type.type_alias)))
|
|
|
|
|
+ {
|
|
|
|
|
+ // If the alias master is not a block-like type, there is no reason to use type aliasing.
|
|
|
|
|
+ // This case can happen if two structs are declared with the same name, but they are unrelated.
|
|
|
|
|
+ // Aliases are only used to deal with aliased types for structs which are used in different buffer types
|
|
|
|
|
+ // which all create a variant of the same struct with different DecorationOffset values.
|
|
|
|
|
+ type.type_alias = 0;
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|