glsl: Correctly handle unary plus operator.
authorCarl Worth <cworth@cworth.org>
Wed, 21 Jul 2010 18:23:51 +0000 (11:23 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 21 Jul 2010 18:42:27 +0000 (11:42 -0700)
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

index 5cadcd19461c662051727cfd39c29ab216c93d7c..e9257eee28914b5d4b3d2c7d337dcfe92376b264 100644 (file)
@@ -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;