]> git.tdb.fi Git - libs/gl.git/commitdiff
Don't add null entries to variable values
authorMikko Rasa <tdb@tdb.fi>
Thu, 25 Feb 2021 10:24:41 +0000 (12:24 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 25 Feb 2021 10:24:41 +0000 (12:24 +0200)
This triggered a bug now that function parameters are processed within
the function's scope.

source/glsl/optimize.cpp

index 1f5b5d317c720993b91f2dbc5dd8fb880417cd7c..fcb1075ecbadc6a1d412142dc8191a83587ff917 100644 (file)
@@ -160,7 +160,7 @@ void ConstantConditionEliminator::visit(Assignment &assign)
 
 void ConstantConditionEliminator::visit(VariableDeclaration &var)
 {
-       if(var.constant || current_block->parent)
+       if((var.constant || current_block->parent) && var.init_expression)
                variable_values[&var] = var.init_expression.get();
 }