summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-11-01 12:29:12 -0700
committerEric Anholt <[email protected]>2014-02-07 12:46:48 -0800
commit1e12dafcac4aac50bc588cead4cc0d6291718edd (patch)
treeaefdddde345809f39215af296dabe3aa2dbb3bae /src/glsl/opt_algebraic.cpp
parentde796b0ef09f05ca3f8a568ed07293e28ae697b0 (diff)
glsl: Optimize triop_csel with all-true or all-false.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r--src/glsl/opt_algebraic.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 7863fe8f9cf..1b4d319366c 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -571,6 +571,13 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_triop_csel:
+ if (is_vec_one(op_const[0]))
+ return ir->operands[1];
+ if (is_vec_zero(op_const[0]))
+ return ir->operands[2];
+ break;
+
default:
break;
}