glsl: When we've emitted a semantic error for ==, return a bool constant.
authorEric Anholt <eric@anholt.net>
Sat, 9 Apr 2011 22:54:34 +0000 (12:54 -1000)
committerEric Anholt <eric@anholt.net>
Wed, 13 Apr 2011 22:48:26 +0000 (15:48 -0700)
This prevents later errors (including an assertion failure) from
cascading the failure.

Fixes invalid-equality-04.vert.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33303
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
src/glsl/ast_to_hir.cpp

index 108c7c35d373395d29e1df37dfa5434a6507b48f..ea20ebae114447e8b2b53adf83fe3abc5d7235e6 100644 (file)
@@ -1073,10 +1073,14 @@ ast_expression::hir(exec_list *instructions,
         error_emitted = true;
       }
 
-      result = do_comparison(ctx, operations[this->oper], op[0], op[1]);
-      type = glsl_type::bool_type;
+      if (error_emitted) {
+        result = new(ctx) ir_constant(false);
+      } else {
+        result = do_comparison(ctx, operations[this->oper], op[0], op[1]);
+        assert(result->type == glsl_type::bool_type);
+        type = glsl_type::bool_type;
+      }
 
-      assert(error_emitted || (result->type == glsl_type::bool_type));
       break;
 
    case ast_bit_and: