OSDN Git Service

glsl/ast: update rhs in addition to the var's constant_value
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 15 Aug 2017 17:47:08 +0000 (13:47 -0400)
committerAndres Gomez <agomez@igalia.com>
Sat, 19 Aug 2017 14:39:35 +0000 (17:39 +0300)
We continue in the code to do some more things with the rhs, including
setting a constant initializer. If the type is wrong, this causes some
confusion down the line, leading to assertions. This makes sure that the
rhs processing continues to flow as-if the type was correct to start
with (even though the state has been marked as an error state).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101766
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 978c4c597aa48e65bd6822a85e6b8f82ca9281f1)

src/compiler/glsl/ast_to_hir.cpp

index a9c0d05..df43e09 100644 (file)
@@ -4281,7 +4281,7 @@ process_initializer(ir_variable *var, ast_declaration *decl,
       } else {
          if (var->type->is_numeric()) {
             /* Reduce cascading errors. */
-            var->constant_value = type->qualifier.flags.q.constant
+            rhs = var->constant_value = type->qualifier.flags.q.constant
                ? ir_constant::zero(state, var->type) : NULL;
          }
       }