glsl: evaluate switch expression once

v2: intialize test_val in constructor

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5185

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Cc: mesa-stable
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12234>
This commit is contained in:
Marcin Ślusarz
2021-08-06 10:49:29 +02:00
committed by Marge Bot
parent 3f2c54a27f
commit bdae3c366e
3 changed files with 15 additions and 5 deletions
+1
View File
@@ -1595,6 +1595,7 @@ ast_switch_statement::ast_switch_statement(ast_expression *test_expression,
{
this->test_expression = test_expression;
this->body = body;
this->test_val = NULL;
}