summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-12-03 16:41:36 -0800
committerMatt Turner <[email protected]>2015-12-16 19:59:05 -0800
commit257fb76403e58afbb203958ef94c7ce035e96225 (patch)
tree715e9fc3abaab7aec962847f76eebd8cfc18d430 /src/mesa/program
parent4a5cff24d77df6070656b501514d8c304fdbabdf (diff)
ir_to_mesa: Skip useless comparison instructions.
Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index a0a42daaac5..66dea0bbdc2 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1113,7 +1113,13 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
if (ir->operands[0]->type->is_vector() ||
ir->operands[1]->type->is_vector()) {
src_reg temp = get_temp(glsl_type::vec4_type);
- emit(ir, OPCODE_SNE, dst_reg(temp), op[0], op[1]);
+ if (ir->operands[0]->type->is_boolean() &&
+ ir->operands[1]->as_constant() &&
+ ir->operands[1]->as_constant()->is_zero()) {
+ temp = op[0];
+ } else {
+ emit(ir, OPCODE_SNE, dst_reg(temp), op[0], op[1]);
+ }
/* After the dot-product, the value will be an integer on the
* range [0,4]. Zero stays zero, and positive values become 1.0.