]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/validate.cpp
Use correct variable to access values
[libs/gl.git] / source / glsl / validate.cpp
index 6a4b8eb0dc0e34ced99b82fcc08d41c22c569bf0..1d0192fea1a44faa0bde09e4888601e5d874c608 100644 (file)
@@ -254,9 +254,9 @@ void DeclarationValidator::visit(VariableDeclaration &var)
                        error(var, format("Mismatched interface qualifier '%s' inside '%s' block", var.interface, iface_block->interface));
                else if(scope==STRUCT || scope==FUNCTION)
                        error(var, format("Interface qualifier not allowed on %s", descr));
-               else if(scope==GLOBAL && variable->interface=="uniform" && features.target_api==VULKAN)
+               else if(scope==GLOBAL && var.interface=="uniform" && !var.block_declaration && features.target_api==VULKAN)
                {
-                       if(!dynamic_cast<const ImageTypeDeclaration *>(get_ultimate_base_type(variable->type_declaration)))
+                       if(!dynamic_cast<const ImageTypeDeclaration *>(get_ultimate_base_type(var.type_declaration)))
                                error(var, "Interface qualifier 'uniform' not allowed on non-opaque variable in global scope");
                }
        }
@@ -356,7 +356,8 @@ void IdentifierValidator::record_definition(const string &name, Statement &state
 
 void IdentifierValidator::visit(TypeDeclaration &type)
 {
-       check_definition(type.name, type);
+       if(type.source!=INTERNAL_SOURCE)
+               check_definition(type.name, type);
 }
 
 void IdentifierValidator::visit(StructDeclaration &strct)
@@ -834,6 +835,11 @@ void GlobalInterfaceValidator::check_uniform(const Uniform &uni)
                        error(*uni.node, format("Mismatched location %d for uniform '%s'", uni.location, uni.name));
                        add_info(*i->second->node, format("Previously declared here with location %d", i->second->location));
                }
+               if(i->second->desc_set!=uni.desc_set)
+               {
+                       error(*uni.node, format("Mismatched descriptor set %d for uniform '%s'", uni.desc_set, uni.name));
+                       add_info(*i->second->node, format("Previously declared here with descriptor set %d", i->second->desc_set));
+               }
                if(uni.bind_point>=0 && i->second->bind_point>=0 && i->second->bind_point!=uni.bind_point)
                {
                        error(*uni.node, format("Mismatched binding %d for uniform '%s'", uni.bind_point, uni.name));