summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_eu.h
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-02-13 17:17:52 -0700
committerBrian Paul <brianp@vmware.com>2009-02-13 17:18:36 -0700
commitc51c822ee02cb47ddba46da668577d51b7c02831 (patch)
tree905cafdc5a02f07aa67fc04e66a7fb1734abec20 /src/mesa/drivers/dri/i965/brw_eu.h
parent74b6d55864b9264323a09856781f655e453b182b (diff)
i965: rewrite the code for handling shader subroutine calls
Previously, the prog_instruction::Data field was used to map original Mesa instructions to brw instructions in order to resolve subroutine calls. This was a rather tangled mess. Plus it's an obstacle to implementing dynamic allocation/growing of the instruction buffer (it's still a fixed size). Mesa's GLSL compiler emits a label for each subroutine and CAL instruction. Now we use those labels to patch the subroutine calls after code generation has been done. We just keep a list of all CAL instructions that needs patching and a list of all subroutine labels. It's a simple matter to resolve them. This also consolidates some redundant post-emit code between brw_vs_emit.c and brw_wm_glsl.c and removes some loops that cleared the prog_instruction::Data fields at the end. Plus, a bunch of new comments.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_eu.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index 9e2b39af9b..b36a1976ef 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -91,6 +91,11 @@ struct brw_indirect {
};
+struct brw_glsl_label;
+struct brw_glsl_call;
+
+
+
#define BRW_EU_MAX_INSN_STACK 5
#define BRW_EU_MAX_INSN 1200
@@ -106,9 +111,22 @@ struct brw_compile {
GLuint flag_value;
GLboolean single_program_flow;
struct brw_context *brw;
+
+ struct brw_glsl_label *first_label; /**< linked list of labels */
+ struct brw_glsl_call *first_call; /**< linked list of CALs */
};
+void
+brw_save_label(struct brw_compile *c, const char *name, GLuint position);
+
+void
+brw_save_call(struct brw_compile *c, const char *name, GLuint call_pos);
+
+void
+brw_resolve_cals(struct brw_compile *c);
+
+
static INLINE int type_sz( GLuint type )
{