[Mesa-dev] [PATCH 4/7] util: simplify temp register selection in u_pstipple.c
Charmaine Lee
charmainel at vmware.com
Fri Oct 31 13:52:09 PDT 2014
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.
> if (pctx->wincoordInput < 0) {
> /* declare new position input reg */
>@@ -313,12 +305,14 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
> decl.Range.Last = pctx->freeSampler;
> ctx->emit_declaration(ctx, &decl);
>- /* declare new temp regs */
>- decl = tgsi_default_full_declaration();
>- decl.Declaration.File = TGSI_FILE_TEMPORARY;
>- decl.Range.First =
>- decl.Range.Last = pctx->texTemp;
>- ctx->emit_declaration(ctx, &decl);
>+ /* declare temp[0] reg if not already declared */
>+ if ((pctx->tempsUsed & 0x1) == 0) {
>+ decl = tgsi_default_full_declaration();
>+ decl.Declaration.File = TGSI_FILE_TEMPORARY;
>+ decl.Range.First =
>+ decl.Range.Last = pctx->texTemp;
>+ ctx->emit_declaration(ctx, &decl);
>+ }
> /* emit immediate = {1/32, 1/32, 1, 1}
> * The index/position of this immediate will be pctx->numImmed
>--
>1.7.10.4
_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=dMTqrakxe895Y1JgK2Fm6G2IzlobZfMtVdJTlRk8YUY&m=D0L1pFoh8D-Bfo98T41gkzc5BsANmFzMe_KB7YgC2mo&s=jQkRRvIGaqEBbd_God8cylqHDWK4ikqLXfG5t3eP4zk&e=
More information about the mesa-dev
mailing list