summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_mesa_to_tgsi.c
diff options
context:
space:
mode:
authormichal <michal@michal-laptop.(none)>2007-10-28 14:42:26 +0000
committerMichal Krol <michal@tungstengraphics.com>2007-10-28 17:34:33 +0000
commitc5ad88e9f1d6a915d9464df0b8fa4de65a3513d2 (patch)
tree90a35c8c958873c1bdb0ace26a5d3fe8148d10fc /src/mesa/state_tracker/st_mesa_to_tgsi.c
parente420e9d48577de57f912ab39d59c2d1d4d14b8f6 (diff)
Declare temporaries in a more compact fashion.
The following declarations: DCL TEMP[0] DCL TEMP[1] DCL TEMP[2] DCL TEMP[4] become: DCL TEMP[0..2] DCL TEMP[4]
Diffstat (limited to 'src/mesa/state_tracker/st_mesa_to_tgsi.c')
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index cb0c96169e..0e3533af4d 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -572,36 +572,36 @@ make_output_decl(
return decl;
}
-
-
-static struct tgsi_full_declaration
-make_temp_decl(
- GLuint start_index,
- GLuint end_index )
-{
- struct tgsi_full_declaration decl;
- decl = tgsi_default_full_declaration();
- decl.Declaration.File = TGSI_FILE_TEMPORARY;
- decl.Declaration.Declare = TGSI_DECLARE_RANGE;
- decl.u.DeclarationRange.First = start_index;
- decl.u.DeclarationRange.Last = end_index;
- return decl;
-}
-
+
+
+static struct tgsi_full_declaration
+make_temp_decl(
+ GLuint start_index,
+ GLuint end_index )
+{
+ struct tgsi_full_declaration decl;
+ decl = tgsi_default_full_declaration();
+ decl.Declaration.File = TGSI_FILE_TEMPORARY;
+ decl.Declaration.Declare = TGSI_DECLARE_RANGE;
+ decl.u.DeclarationRange.First = start_index;
+ decl.u.DeclarationRange.Last = end_index;
+ return decl;
+}
+
/**
* Find the temporaries which are used in the given program.
- * Put the indices of the temporaries in 'tempsUsed'.
- * \return number of temporaries used
- */
-static void
-find_temporaries(const struct gl_program *program,
- GLboolean tempsUsed[MAX_PROGRAM_TEMPS])
-{
- GLuint i, j;
-
- for (i = 0; i < MAX_PROGRAM_TEMPS; i++)
- tempsUsed[i] = GL_FALSE;
+ * Put the indices of the temporaries in 'tempsUsed'.
+ * \return number of temporaries used
+ */
+static void
+find_temporaries(const struct gl_program *program,
+ GLboolean tempsUsed[MAX_PROGRAM_TEMPS])
+{
+ GLuint i, j;
+
+ for (i = 0; i < MAX_PROGRAM_TEMPS; i++)
+ tempsUsed[i] = GL_FALSE;
for (i = 0; i < program->NumInstructions; i++) {
const struct prog_instruction *inst = program->Instructions + i;
@@ -610,12 +610,12 @@ find_temporaries(const struct gl_program *program,
if (inst->SrcReg[j].File == PROGRAM_TEMPORARY)
tempsUsed[inst->SrcReg[j].Index] = GL_TRUE;
if (inst->DstReg.File == PROGRAM_TEMPORARY)
- tempsUsed[inst->DstReg.Index] = GL_TRUE;
- }
- }
-}
-
-
+ tempsUsed[inst->DstReg.Index] = GL_TRUE;
+ }
+ }
+}
+
+
/**
@@ -775,34 +775,34 @@ tgsi_translate_mesa_program(
maxTokens - ti );
}
}
-
- /* temporary decls */
- {
- GLboolean tempsUsed[MAX_PROGRAM_TEMPS + 1];
- GLboolean inside_range = GL_FALSE;
- GLuint start_range;
-
- find_temporaries(program, tempsUsed);
- tempsUsed[MAX_PROGRAM_TEMPS] = GL_FALSE;
- for (i = 0; i < MAX_PROGRAM_TEMPS + 1; i++) {
- if (tempsUsed[i] && !inside_range) {
- inside_range = GL_TRUE;
- start_range = i;
- }
- else if (!tempsUsed[i] && inside_range) {
- struct tgsi_full_declaration fulldecl;
-
- inside_range = GL_FALSE;
- fulldecl = make_temp_decl( start_range, i - 1 );
- ti += tgsi_build_full_declaration(
- &fulldecl,
- &tokens[ti],
- header,
- maxTokens - ti );
- }
- }
- }
-
+
+ /* temporary decls */
+ {
+ GLboolean tempsUsed[MAX_PROGRAM_TEMPS + 1];
+ GLboolean inside_range = GL_FALSE;
+ GLuint start_range;
+
+ find_temporaries(program, tempsUsed);
+ tempsUsed[MAX_PROGRAM_TEMPS] = GL_FALSE;
+ for (i = 0; i < MAX_PROGRAM_TEMPS + 1; i++) {
+ if (tempsUsed[i] && !inside_range) {
+ inside_range = GL_TRUE;
+ start_range = i;
+ }
+ else if (!tempsUsed[i] && inside_range) {
+ struct tgsi_full_declaration fulldecl;
+
+ inside_range = GL_FALSE;
+ fulldecl = make_temp_decl( start_range, i - 1 );
+ ti += tgsi_build_full_declaration(
+ &fulldecl,
+ &tokens[ti],
+ header,
+ maxTokens - ti );
+ }
+ }
+ }
+
/* immediates/literals */
#if EMIT_IMMEDIATES
for (i = 0; i < program->Parameters->NumParameters; i++) {