[Mesa-dev] [PATCH 03/16] glsl: Use constant_expression_value instead of as_constant

Connor Abbott cwabbott0 at gmail.com
Mon Jul 21 16:28:38 PDT 2014


On Mon, Jul 21, 2014 at 3:39 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Mon, Jul 21, 2014 at 2:04 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> Just a few lines earlier we may have wrapped the index expression with
>> ir_unop_i2u expression.  Whenever that happens, as_constant will return
>> NULL, and that almost always happens.
>
> Are you saying that since we just passed array_index to i2u we know it
> must be a constant? I can follow that much, but I don't see anything
> that really makes sure this is a constant.

I think this is more of optimization, in that if deref->array_index
were a constant but it got wrapped in an i2u expressoin then we
would've gone and generated an add and a mul instruction when that
isn't really necessary.

In any case, this patch is

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list