Good point, but as it is this follows the convention that's been working all along so far. I can add a comment about looking for the final RET in the future.

-Brian

On 09/22/2014 11:50 AM, Roland Scheidegger wrote:
Do you want to call it at (outermost) RET opcode (if any) instead?
tgsi is kinda undecided if there should be a ret opcode in main but
sometimes there is...

Roland

Am 22.09.2014 17:44, schrieb Brian Paul:
We want to call the caller's epilog callback when we find the TGSI
END instruction, not after it.
---
  src/gallium/auxiliary/tgsi/tgsi_transform.c |   19 ++++++++++++-------
  1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c 
b/src/gallium/auxiliary/tgsi/tgsi_transform.c
index 93e5b98..5a5f56c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
@@ -171,10 +171,19 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
                 ctx->prolog(ctx);
              }

-            if (ctx->transform_instruction)
-               ctx->transform_instruction(ctx, fullinst);
-            else
+            if (fullinst->Instruction.Opcode == TGSI_OPCODE_END
+                && ctx->epilog) {
+               /* Emit caller's epilog */
+               ctx->epilog(ctx);
+               /* Emit END */
                 ctx->emit_instruction(ctx, fullinst);
+            }
+            else {
+               if (ctx->transform_instruction)
+                  ctx->transform_instruction(ctx, fullinst);
+               else
+                  ctx->emit_instruction(ctx, fullinst);
+            }

              first_instruction = FALSE;
           }
@@ -220,10 +229,6 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
        }
     }

-   if (ctx->epilog) {
-      ctx->epilog(ctx);
-   }
-
     tgsi_parse_free (&parse);

     return ctx->ti;



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

Reply via email to