On Wed, May 25, 2016 at 12:17 PM, Ian Romanick <i...@freedesktop.org> wrote:
> On 05/23/2016 11:42 PM, mathias.froehl...@gmx.net wrote:
>> From: Mathias Fröhlich <mathias.froehl...@web.de>
>>
>> Replaces loops that iterate all lights and test
>> which of them is enabled by a loop only iterating over
>> the bits set in the enabled bitmask.
>> ---
>>  src/mesa/tnl/t_vb_light.c    |  2 +-
>>  src/mesa/tnl/t_vb_lighttmp.h | 27 ++++++++++++++++++++-------
>>  2 files changed, 21 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
>> index 029265a..0cdb925 100644
>> --- a/src/mesa/tnl/t_vb_light.c
>> +++ b/src/mesa/tnl/t_vb_light.c
>> @@ -394,7 +394,7 @@ static void validate_lighting( struct gl_context *ctx,
>>        tab = _tnl_light_tab;
>>     }
>>     else {
>> -      if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev)
>> +      if (_mesa_bitcount(ctx->Light._EnabledLights) == 1)
>
> I think using an is_pow2() predicate here would be better.  It looks
> like the only one in Mesa is in src/intel/isl/isl_priv.h, but it should
> be easy enough to add that to somewhere in src/util.

There's also a util_is_power_of_two in gallium -
src/gallium/auxiliary/util/u_math.h. I guess the math helper functions
never made it through the helper unification bikeshed.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to