Mesa (glsl2): glsl: Correctly handle unary plus operator.

Carl Worth cworth at kemper.freedesktop.org
Wed Jul 21 18:51:57 UTC 2010


Module: Mesa
Branch: glsl2
Commit: c24bcad9f88379ffba9e2f0ff92f22cdf60c2927
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c24bcad9f88379ffba9e2f0ff92f22cdf60c2927

Author: Carl Worth <cworth at cworth.org>
Date:   Wed Jul 21 11:23:51 2010 -0700

glsl: Correctly handle unary plus operator.

Previously, any occurence of the unary plus operator would trigger a
bogus type mismatch error. Fix this by making the ast_plus case look
more like the ast_neg case as far as type-checking is concerned.

With this change the shaders/CorrectPreprocess8.frag test in piglit
now passes.

---

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

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 5cadcd1..e9257ee 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -660,9 +660,9 @@ ast_expression::hir(exec_list *instructions,
    case ast_plus:
       op[0] = this->subexpressions[0]->hir(instructions, state);
 
-      error_emitted = op[0]->type->is_error();
-      if (type->is_error())
-	 op[0]->type = type;
+      type = unary_arithmetic_result_type(op[0]->type, state, & loc);
+
+      error_emitted = type->is_error();
 
       result = op[0];
       break;




More information about the mesa-commit mailing list