On Tue, Jun 10, 2014 at 9:46 AM, Ian Romanick <[email protected]> wrote: > On 06/09/2014 02:11 PM, Matt Turner wrote: >> Cuts five instructions out of SynMark's Gl32VSInstancing benchmark. >> --- >> src/glsl/opt_algebraic.cpp | 46 >> ++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 46 insertions(+) >> >> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp >> index d57c3e8..be65799 100644 >> --- a/src/glsl/opt_algebraic.cpp >> +++ b/src/glsl/opt_algebraic.cpp >> @@ -119,6 +119,44 @@ update_type(ir_expression *ir) >> ir->type = ir->operands[1]->type; >> } >> >> +/* Recognize (v.x + v.y) + (v.z + v.w) as dot(v, 1.0) */ >> +static ir_expression * >> +try_replace_with_dot(ir_expression *expr0, ir_expression *expr1, void >> *mem_ctx) >> +{ >> + if (expr0 && expr0->operation == ir_binop_add && >> + expr1 && expr1->operation == ir_binop_add) { >> + ir_swizzle *x = expr0->operands[0]->as_swizzle(); >> + ir_swizzle *y = expr0->operands[1]->as_swizzle(); >> + ir_swizzle *z = expr1->operands[0]->as_swizzle(); >> + ir_swizzle *w = expr1->operands[1]->as_swizzle(); >> + >> + if (!x || x->mask.num_components != 1 || x->mask.has_duplicates || >> + !y || y->mask.num_components != 1 || y->mask.has_duplicates || >> + !z || z->mask.num_components != 1 || z->mask.has_duplicates || >> + !w || w->mask.num_components != 1 || w->mask.has_duplicates) { > > Are the has_duplicates checks necessary? If num_components must be 1, > it's not obvious to me what the extra checks are doing.
Right.. I don't think so. I'll remove them. _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
