]> git.tdb.fi Git - libs/gl.git/commitdiff
Disallow bool variables in shader interface blocks
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 09:21:35 +0000 (11:21 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 09:24:33 +0000 (11:24 +0200)
Although OpenGL allows them in uniform blocks, SPIR-V says they can't be
used with externally visible storage classes.

source/glsl/validate.cpp

index 0c4b98cbb2c8fd9de87ec21b553d911febde227a..ec322f4207751af90482893dc21dc4f4dce39e0a 100644 (file)
@@ -254,8 +254,13 @@ void DeclarationValidator::visit(VariableDeclaration &var)
        }
        else if(kind==BasicTypeDeclaration::VOID)
                error(var, "Type 'void' not allowed on variable");
-       else if(kind==BasicTypeDeclaration::BOOL && !var.interface.empty() && var.source!=BUILTIN_SOURCE)
-               error(var, "Type 'bool' not allowed on interface variable");
+       else if(kind==BasicTypeDeclaration::BOOL && var.source!=BUILTIN_SOURCE)
+       {
+               if(scope==INTERFACE_BLOCK)
+                       error(var, "Type 'bool' not allowed in an interface block");
+               else if(!var.interface.empty())
+                       error(var, "Type 'bool' not allowed on interface variable");
+       }
 
        if(var.init_expression)
        {