]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/validate.cpp
Rewrite type comparisons as a visitor
[libs/gl.git] / source / glsl / validate.cpp
index cb866b4ba215562c10fff9255bd1867b51ff6f00..4a5ffe841801b064c04c7ea68d6d91eb53ea1c59 100644 (file)
@@ -690,14 +690,14 @@ void StageInterfaceValidator::visit(VariableDeclaration &var)
                }
                if(var.type_declaration && var.linked_declaration->type_declaration)
                {
-                       const TypeDeclaration *type = var.type_declaration;
+                       TypeDeclaration *type = var.type_declaration;
                        if(stage->type==Stage::GEOMETRY)
                        {
                                if(const BasicTypeDeclaration *basic = dynamic_cast<const BasicTypeDeclaration *>(type))
                                        if(basic->kind==BasicTypeDeclaration::ARRAY && basic->base_type)
                                                type = basic->base_type;
                        }
-                       if(!is_same_type(*type, *var.linked_declaration->type_declaration))
+                       if(!TypeComparer().apply(*type, *var.linked_declaration->type_declaration))
                        {
                                error(var, format("Mismatched type '%s' for 'in %s'", type->name, var.name));
                                add_info(*var.linked_declaration, format("Linked to 'out %s' with type '%s'",
@@ -750,7 +750,7 @@ void GlobalInterfaceValidator::check_uniform(const Uniform &uni)
                        error(*uni.node, format("Mismatched binding %d for uniform '%s'", uni.bind_point, uni.name));
                        add_info(*i->second->node, format("Previously declared here with binding %d", i->second->bind_point));
                }
-               if(uni.type && i->second->type && !is_same_type(*uni.type, *i->second->type))
+               if(uni.type && i->second->type && !TypeComparer().apply(*uni.type, *i->second->type))
                {
                        string type_name = (dynamic_cast<const StructDeclaration *>(uni.type) ?
                                "structure" : format("type '%s'", uni.type->name));