]> git.tdb.fi Git - libs/gl.git/commitdiff
Require initializers on constant variables
authorMikko Rasa <tdb@tdb.fi>
Mon, 5 Apr 2021 09:25:49 +0000 (12:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 5 Apr 2021 09:25:49 +0000 (12:25 +0300)
source/glsl/validate.cpp

index 7e5f295f165ac3eda0993a7767b2b29fa9b6bbc5..d154388f98cd9eed44aa8d16c00e1e70d09f801c 100644 (file)
@@ -216,6 +216,8 @@ void DeclarationValidator::visit(VariableDeclaration &var)
        {
                if(scope==STRUCT || scope==INTERFACE_BLOCK)
                        error(var, format("Constant qualifier not allowed on %s", descr));
+               if(!var.init_expression)
+                       error(var, "Constant variable must have an initializer");
        }
 
        if(!var.interpolation.empty() || !var.sampling.empty())