From 3c8ce91bc0434b3a25eb919fc490c6ff8a8ed67e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 5 Apr 2021 12:25:49 +0300 Subject: [PATCH] Require initializers on constant variables --- source/glsl/validate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index 7e5f295f..d154388f 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -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()) -- 2.45.2