[Mesa-dev] [PATCH 06/16] glsl: Add sin, cos and sign to get_range
Thomas Helland
thomashelland90 at gmail.com
Sun Nov 16 17:51:51 PST 2014
They are bound between -1 and 1, so report that.
---
src/glsl/opt_minmax.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 111d183..341006e 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -271,6 +271,10 @@ get_range(ir_rvalue *rval)
minmax_range r0;
minmax_range r1;
+ void *mem_ctx = ralloc_parent(rval);
+ ir_constant *low = NULL;
+ ir_constant *high = NULL;
+
if(expr) {
switch(expr->operation) {
case ir_binop_min:
@@ -279,6 +283,15 @@ get_range(ir_rvalue *rval)
r1 = get_range(expr->operands[1]);
return combine_range(r0, r1, expr->operation == ir_binop_min);
+ case ir_unop_sin:
+ case ir_unop_sin_reduced:
+ case ir_unop_cos:
+ case ir_unop_cos_reduced:
+ case ir_unop_sign:
+ high = new(mem_ctx) ir_constant(1.0f);
+ low = new(mem_ctx) ir_constant(-1.0f);
+ return minmax_range(low, high);
+
default:
break;
}
--
2.0.3
More information about the mesa-dev
mailing list