summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_program.h
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-25 14:29:11 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-25 14:29:11 -0600
commit40c543eb71368c646259afb87d5c76551f6b45b7 (patch)
tree1e0c89610cc347607580fb4044e08bb0a060739e /src/mesa/state_tracker/st_program.h
parentf9ed2fdaace0d4d7f091a4423a8638945e920b0d (diff)
Translate mesa vertex/fragment programs to TGSI programs at same time to do proper linking.
Previously, programs were translated independently during validation. The problem is the translation to TGSI format, which packs shader input/outputs into continuous slots, depends on which vertex program is being paired with which fragment shader. Now, we look at the outputs of the vertex program in conjunction with the inputs of the fragment shader to be sure the attributes match up correctly. The new 'linked_program_pair' class keeps track of the associations between vertex and fragment shaders. It's also the place where the TGSI tokens are kept since they're no longer per-program state but per-linkage. Still a few loose ends, like implementing some kind of hash/lookup table for linked_program_pairs.
Diffstat (limited to 'src/mesa/state_tracker/st_program.h')
-rw-r--r--src/mesa/state_tracker/st_program.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 419afa4e78..355dee574b 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -47,11 +47,11 @@ struct st_fragment_program
{
struct gl_fragment_program Base;
GLboolean error; /* If program is malformed for any reason. */
- GLuint id; /**< String id, for tracking ProgramStringNotify changes. */
+
+ GLuint serialNo;
/** The program in TGSI format */
struct tgsi_token tokens[ST_FP_MAX_TOKENS];
- GLboolean dirty;
#if defined(USE_X86_ASM) || defined(SLANG_X86)
struct x86_function sse2_program;
@@ -68,7 +68,8 @@ struct st_vertex_program
{
struct gl_vertex_program Base; /**< The Mesa vertex program */
GLboolean error; /**< Set if program is malformed for any reason. */
- GLuint id; /**< String id, for tracking ProgramStringNotify changes. */
+
+ GLuint serialNo;
/** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */
GLuint input_to_index[MAX_VERTEX_PROGRAM_ATTRIBS];
@@ -77,7 +78,6 @@ struct st_vertex_program
/** The program in TGSI format */
struct tgsi_token tokens[ST_FP_MAX_TOKENS];
- GLboolean dirty;
#if defined(USE_X86_ASM) || defined(SLANG_X86)
struct x86_function sse2_program;
@@ -90,7 +90,8 @@ struct st_vertex_program
};
-extern void st_init_program_functions(struct dd_function_table *functions);
+extern void
+st_init_program_functions(struct dd_function_table *functions);
static inline struct st_fragment_program *
@@ -99,6 +100,7 @@ st_fragment_program( struct gl_fragment_program *fp )
return (struct st_fragment_program *)fp;
}
+
static inline struct st_vertex_program *
st_vertex_program( struct gl_vertex_program *vp )
{
@@ -107,13 +109,18 @@ st_vertex_program( struct gl_vertex_program *vp )
extern const struct cso_fragment_shader *
-st_translate_fragment_shader(struct st_context *st,
- struct st_fragment_program *fp);
+st_translate_fragment_program(struct st_context *st,
+ struct st_fragment_program *fp,
+ const GLuint inputMapping[],
+ struct tgsi_token *tokens,
+ GLuint maxTokens);
extern const struct cso_vertex_shader *
-st_translate_vertex_shader(struct st_context *st,
- struct st_vertex_program *vp);
-
+st_translate_vertex_program(struct st_context *st,
+ struct st_vertex_program *vp,
+ const GLuint vert_output_to_slot[],
+ struct tgsi_token *tokens,
+ GLuint maxTokens);
#endif