[Mesa-dev] [PATCH 06/22] glsl: Add sin, cos and sign to get_range
Thomas Helland
thomashelland90 at gmail.com
Sat Jan 3 11:18:11 PST 2015
They are bound between -1 and 1, so exploit that.
v2: Put in alphabetical order
Just return directly instead of assigning to temp variable.
---
src/glsl/opt_minmax.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 2faa3c3..ffdf203 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -308,6 +308,14 @@ get_range(ir_rvalue *rval)
low = new(mem_ctx) ir_constant(0.0f);
return minmax_range(low, high);
+ case ir_unop_sin:
+ case ir_unop_sin_reduced:
+ case ir_unop_cos:
+ case ir_unop_cos_reduced:
+ case ir_unop_sign:
+ return minmax_range(new(mem_ctx) ir_constant(-1.0f),
+ new(mem_ctx) ir_constant(1.0f));
+
case ir_binop_min:
case ir_binop_max:
r0 = get_range(expr->operands[0]);
--
2.2.1
More information about the mesa-dev
mailing list