]> git.tdb.fi Git - libs/gl.git/commitdiff
Better checking of where the binding qualifier is allowed
authorMikko Rasa <tdb@tdb.fi>
Sat, 3 Apr 2021 14:12:50 +0000 (17:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 3 Apr 2021 16:40:26 +0000 (19:40 +0300)
source/glsl/validate.cpp

index 7235e2237a81493fec5f31352874bc5ebc2e7f41..54451bcd4714f337ec114a39f016b1930ef16fa0 100644 (file)
@@ -81,11 +81,15 @@ void DeclarationValidator::visit(Layout &layout)
                                TypeDeclaration *type = variable->type_declaration;
                                while(BasicTypeDeclaration *basic = dynamic_cast<BasicTypeDeclaration *>(type))
                                        type = basic->base_type;
-                               allowed = (scope==GLOBAL && dynamic_cast<ImageTypeDeclaration *>(type));
-                               err_descr = "variable of non-opaque type";
+                               bool uniform = (variable->interface=="uniform");
+                               allowed = (scope==GLOBAL && uniform && dynamic_cast<ImageTypeDeclaration *>(type));
+                               err_descr = (uniform ? "variable of non-opaque type" : "non-uniform variable");
                        }
                        else if(iface_block)
-                               allowed = true;
+                       {
+                               allowed = (iface_block->interface=="uniform");
+                               err_descr = "non-uniform interface block";
+                       }
                }
                else if(i->name=="constant_id")
                {