[Mesa-dev] [PATCH 4/9] glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f

Kenneth Graunke kenneth at whitecape.org
Thu Feb 28 13:56:13 PST 2013


On 02/28/2013 11:33 AM, Matt Turner wrote:
> On Tue, Feb 26, 2013 at 10:31 AM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 02/19/2013 05:03 PM, Matt Turner wrote:
>>>
>>> ---
>>>    src/glsl/opt_algebraic.cpp |   16 +++++++++++++---
>>>    1 files changed, 13 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
>>> index 75948db..952941e 100644
>>> --- a/src/glsl/opt_algebraic.cpp
>>> +++ b/src/glsl/opt_algebraic.cpp
>>> @@ -186,12 +186,12 @@
>>> ir_algebraic_visitor::swizzle_if_required(ir_expression *expr,
>>>    ir_rvalue *
>>>    ir_algebraic_visitor::handle_expression(ir_expression *ir)
>>>    {
>>> -   ir_constant *op_const[2] = {NULL, NULL};
>>> -   ir_expression *op_expr[2] = {NULL, NULL};
>>> +   ir_constant *op_const[3] = {NULL, NULL, NULL};
>>> +   ir_expression *op_expr[3] = {NULL, NULL, NULL};
>>>       ir_expression *temp;
>>>       unsigned int i;
>>>
>>> -   assert(ir->get_num_operands() <= 2);
>>> +   assert(ir->get_num_operands() <= 3);
>>
>>
>> Doesn't this part of the change have to occur before other patches in this
>> series?  What happens if you run piglit on the commit just before this?  I'd
>> prefer bisects not hit spurious failures.
>
> Not strictly necessary, I don't think, since all backends are lowering
> LRP at this point. I could be wrong about the order of things though.
> Anyway still a good idea.

It is necessary - do_common_optimization occurs prior to linking, during 
linking, and after linking.  Backends don't get involved until link 
time, so at least the first optimization pass happens prior to any lowering.



More information about the mesa-dev mailing list