Mesa (master): glsl: When we've emitted a semantic error for ==, return a bool constant.

Eric Anholt anholt at kemper.freedesktop.org
Wed Apr 13 18:08:53 PDT 2011


Module: Mesa
Branch: master
Commit: 175829f1a8ab0df7594131cc569462e45c1974ec
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=175829f1a8ab0df7594131cc569462e45c1974ec

Author: Eric Anholt <eric at anholt.net>
Date:   Sat Apr  9 12:54:34 2011 -1000

glsl: When we've emitted a semantic error for ==, return a bool constant.

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 at whitecape.org>
Reviewed-by: Chad Versace <chad.versace at intel.com>

---

 src/glsl/ast_to_hir.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 108c7c3..ea20eba 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -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:



More information about the mesa-commit mailing list