if(offset>=0)
{
int *layout_offset = 0;
+ bool has_matrix_order = false;
if(var.layout)
{
vector<Layout::Qualifier> &qualifiers = var.layout->qualifiers;
for(vector<Layout::Qualifier>::iterator i=qualifiers.begin(); i!=qualifiers.end(); ++i)
+ {
if(i->name=="offset" && i->has_value)
{
layout_offset = &i->value;
if(i->value>=offset)
offset = i->value;
- break;
}
+ else if(i->name=="column_major" || i->name=="row_major")
+ has_matrix_order = true;
+ }
}
MemoryRequirementsCalculator::Result mem_reqs = MemoryRequirementsCalculator().apply(var);
var.layout->qualifiers.push_back(qual);
}
+ if(!has_matrix_order)
+ {
+ const BasicTypeDeclaration *basic = dynamic_cast<const BasicTypeDeclaration *>(var.type_declaration);
+ while(basic && basic->kind==BasicTypeDeclaration::ARRAY)
+ basic = dynamic_cast<const BasicTypeDeclaration *>(basic->base_type);
+ if(basic && basic->kind==BasicTypeDeclaration::MATRIX)
+ {
+ Layout::Qualifier qual;
+ qual.name = "column_major";
+ var.layout->qualifiers.push_back(qual);
+ }
+ }
+
offset += mem_reqs.size;
}
}
allowed = (iface_block && !variable && iface_block->interface=="uniform");
value = false;
}
+ else if(i->name=="column_major" || i->name=="row_major")
+ {
+ allowed = (variable && scope==INTERFACE_BLOCK);
+ if(allowed)
+ {
+ BasicTypeDeclaration *basic = dynamic_cast<BasicTypeDeclaration *>(variable->type_declaration);
+ while(basic && basic->kind==BasicTypeDeclaration::ARRAY)
+ basic = dynamic_cast<BasicTypeDeclaration *>(basic->base_type);
+ allowed = (basic && basic->kind==BasicTypeDeclaration::MATRIX);
+ err_descr = "non-matrix variable";
+ }
+ }
if(!allowed)
{