diff options
author | Matt Turner <[email protected]> | 2014-10-31 10:33:17 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-11-03 11:27:38 -0800 |
commit | 336e76c1439823185d425ebecb849ce38d55c4eb (patch) | |
tree | c1899bdf81bf5100d8ed5609cb4992d606af8373 /src/glsl/opt_algebraic.cpp | |
parent | 263eb7fa39a16bcce7d64a4b8343c6adbc3e916c (diff) |
glsl: Emit mul instead of dot if only one component left.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85683
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85691
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r-- | src/glsl/opt_algebraic.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c8d1ba1e2f5..a2d7e4919c4 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -572,9 +572,12 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (count >= op_const[i]->type->vector_elements) break; + ir_expression_operation op = count == 1 ? + ir_binop_mul : ir_binop_dot; + /* Swizzle both operands to remove the channels that were zero. */ return new(mem_ctx) - ir_expression(ir_binop_dot, glsl_type::float_type, + ir_expression(op, glsl_type::float_type, new(mem_ctx) ir_swizzle(ir->operands[0], components, count), new(mem_ctx) ir_swizzle(ir->operands[1], |