Mesa (master): tgsi: add prolog() method to tgsi_transform_context
Brian Paul
brianp at kemper.freedesktop.org
Mon Sep 22 22:59:46 UTC 2014
Module: Mesa
Branch: master
Commit: b16bb3f50f0d71f7e720c4feefcb86e15090d52f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b16bb3f50f0d71f7e720c4feefcb86e15090d52f
Author: Brian Paul <brianp at vmware.com>
Date: Fri Mar 14 14:49:33 2014 -0600
tgsi: add prolog() method to tgsi_transform_context
Called when the user can insert new decls, instructions.
This could be used in a few places in the 'draw' module.
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
---
src/gallium/auxiliary/tgsi/tgsi_transform.c | 7 +++++++
src/gallium/auxiliary/tgsi/tgsi_transform.h | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c
index b16d296..93e5b98 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
@@ -109,6 +109,7 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
struct tgsi_transform_context *ctx)
{
uint procType;
+ boolean first_instruction = TRUE;
/* input shader */
struct tgsi_parse_context parse;
@@ -166,10 +167,16 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
struct tgsi_full_instruction *fullinst
= &parse.FullToken.FullInstruction;
+ if (first_instruction && ctx->prolog) {
+ ctx->prolog(ctx);
+ }
+
if (ctx->transform_instruction)
ctx->transform_instruction(ctx, fullinst);
else
ctx->emit_instruction(ctx, fullinst);
+
+ first_instruction = FALSE;
}
break;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h b/src/gallium/auxiliary/tgsi/tgsi_transform.h
index 8b96664..5ec0719 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
@@ -57,6 +57,12 @@ struct tgsi_transform_context
struct tgsi_full_property *prop);
/**
+ * Called after last declaration, before first instruction. This is
+ * where the user might insert new declarations and/or instructions.
+ */
+ void (*prolog)(struct tgsi_transform_context *ctx);
+
+ /**
* Called at end of input program to allow caller to append extra
* instructions. Return number of tokens emitted.
*/
More information about the mesa-commit
mailing list