X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.cpp;h=df3312e1fa9f6b46f3fdc52f7e305ded14059bab;hp=e11f181e0b42d1140b67b313cfe449ff8bad52d7;hb=ea844415db7fb7705ecbfea9cf27df2a8f00b802;hpb=3fe1aab63922eec99d8bf6fd4fd60bec10df173c diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index e11f181e..df3312e1 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -77,11 +77,9 @@ void DeclarationValidator::visit(Layout &layout) if(variable) { - TypeDeclaration *type = variable->type_declaration; - while(BasicTypeDeclaration *basic = dynamic_cast(type)) - type = basic->base_type; + const TypeDeclaration *base_type = get_ultimate_base_type(variable->type_declaration); bool uniform = (variable->interface=="uniform"); - allowed = (scope==GLOBAL && uniform && dynamic_cast(type)); + allowed = (scope==GLOBAL && uniform && dynamic_cast(base_type)); err_descr = (uniform ? "variable of non-opaque type" : "non-uniform variable"); } else if(iface_block) @@ -258,10 +256,7 @@ void DeclarationValidator::visit(VariableDeclaration &var) error(var, format("Interface qualifier not allowed on %s", descr)); else if(scope==GLOBAL && variable->interface=="uniform" && features.target_api==VULKAN) { - TypeDeclaration *type = variable->type_declaration; - while(BasicTypeDeclaration *basic = dynamic_cast(type)) - type = basic->base_type; - if(!dynamic_cast(type)) + if(!dynamic_cast(get_ultimate_base_type(variable->type_declaration))) error(var, "Interface qualifier 'uniform' not allowed on non-opaque variable in global scope"); } }