glsl: Add support for constant expression evaluation on trunc().
authorEric Anholt <eric@anholt.net>
Tue, 27 Sep 2011 21:50:45 +0000 (14:50 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 28 Sep 2011 19:09:09 +0000 (12:09 -0700)
Fixes the glsl-1.30/compiler/built-in-functions/trunc-* tests under 1.30.

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir_constant_expression.cpp

index 56a423761b590863ee984d1893e85cdcd81bec44..b3fe6cf96757b22fed9b8858d075bf082f4207ae 100644 (file)
@@ -1373,6 +1373,8 @@ ir_call::constant_expression_value()
            data.f[m*i+j] += op[0]->value.f[i+n*j];
         }
       }
+   } else if (strcmp(callee, "trunc") == 0) {
+      expr = new(mem_ctx) ir_expression(ir_unop_trunc, op[0]);
    } else {
       /* Unsupported builtin - some are not allowed in constant expressions. */
       return NULL;