X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.cpp;h=b313354dc9c54d56688fe7d7b32b24f8328bcbfc;hb=180698dbb41d312128c496721f1207c6688fe350;hp=54451bcd4714f337ec114a39f016b1930ef16fa0;hpb=a3637962f082182d72998a35ea86e48d51e520c3;p=libs%2Fgl.git diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index 54451bcd..b313354d 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -114,7 +114,9 @@ void DeclarationValidator::visit(Layout &layout) } } else if(i->name=="offset") - allowed = (variable && scope==INTERFACE_BLOCK); + allowed = (variable && scope==INTERFACE_BLOCK && iface_block->interface=="uniform"); + else if(i->name=="align") + allowed = (scope==INTERFACE_BLOCK && iface_block->interface=="uniform"); else if(i->name=="points") { allowed = (stage->type==Stage::GEOMETRY && iface_layout && (iface_layout->interface=="in" || iface_layout->interface=="out")); @@ -139,6 +141,18 @@ void DeclarationValidator::visit(Layout &layout) 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(variable->type_declaration); + while(basic && basic->kind==BasicTypeDeclaration::ARRAY) + basic = dynamic_cast(basic->base_type); + allowed = (basic && basic->kind==BasicTypeDeclaration::MATRIX); + err_descr = "non-matrix variable"; + } + } if(!allowed) { @@ -214,6 +228,8 @@ void DeclarationValidator::visit(VariableDeclaration &var) { if(scope==STRUCT || scope==INTERFACE_BLOCK) error(var, format("Constant qualifier not allowed on %s", descr)); + if(!var.init_expression) + error(var, "Constant variable must have an initializer"); } if(!var.interpolation.empty() || !var.sampling.empty())