[Mesa-dev] [PATCH 4/7] util: simplify temp register selection in u_pstipple.c

Brian Paul brianp at vmware.com
Fri Oct 31 14:14:03 PDT 2014


On 10/31/2014 02:52 PM, Charmaine Lee wrote:
> The series looks good. Just a minor comment below.
>
> Reviewed-by: Charmaine Lee <charmainel at vmware.com>
>
>> From: mesa-dev <mesa-dev-bounces at lists.freedesktop.org> on behalf of Brian Paul <brianp at vmware.com>
>> Sent: Thursday, October 30, 2014 8:04 PM
>> To: mesa-dev at lists.freedesktop.org
>> Subject: [Mesa-dev] [PATCH 4/7] util: simplify temp register selection in       u_pstipple.c
>
>> ---
>> src/gallium/auxiliary/util/u_pstipple.c |   30 ++++++++++++------------------
>> 1 file changed, 12 insertions(+), 18 deletions(-)
>
>> diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c
> index 5c6c8fc..ba80956 100644
>> --- a/src/gallium/auxiliary/util/u_pstipple.c
>> +++ b/src/gallium/auxiliary/util/u_pstipple.c
>> @@ -267,7 +267,6 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
>
>>        struct tgsi_full_declaration decl;
>>        struct tgsi_full_instruction newInst;
>> -      uint i;
>>        int wincoordInput;
>
>>        /* find free texture sampler */
>> @@ -280,17 +279,10 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
>>        else
>>           wincoordInput = pctx->wincoordInput;
>
>> -      /* find one free temp register */
>> -      for (i = 0; i < 32; i++) {
>> -         if ((pctx->tempsUsed & (1 << i)) == 0) {
>> -            /* found a free temp */
>> -            if (pctx->texTemp < 0)
>> -               pctx->texTemp  = i;
>> -            else
>> -               break;
>> -         }
>> -      }
>> -      assert(pctx->texTemp >= 0);
>> +      /* We can always use temp[0] since this code is before
>> +       * the rest of the shader.
>> +       */
>> +      pctx->texTemp = 0;
>
> Since texTemp is only used in this function, how about change it to a local variable.

Will do.  Thanks.

-Brian




More information about the mesa-dev mailing list