summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/tgsi
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-20 14:47:22 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-20 14:47:22 -0600
commitf69b5c56feb60791bad27d491ee9592238d4efb0 (patch)
tree4e20d2ee723239121e5bf8b94a9786dc05e00440 /src/mesa/pipe/tgsi
parent478d1e2c9c73fc29542375c44d01ab964ce8eccf (diff)
Clean-up the TGSI_SEMANTIC tokens, introduce semantic indexes.
Still need to produce decl instructions for vertex shaders...
Diffstat (limited to 'src/mesa/pipe/tgsi')
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_build.c2
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_dump.c22
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_token.h24
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c23
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h3
5 files changed, 32 insertions, 42 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_build.c b/src/mesa/pipe/tgsi/exec/tgsi_build.c
index 1320872c64..78f648aae2 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_build.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_build.c
@@ -309,7 +309,7 @@ tgsi_default_declaration_semantic( void )
{
struct tgsi_declaration_semantic ds;
- ds.SemanticName = TGSI_SEMANTIC_DEPTH;
+ ds.SemanticName = TGSI_SEMANTIC_POSITION;
ds.SemanticIndex = 0;
ds.Padding = 0;
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
index 0a47ad2a8c..315354198a 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
@@ -201,28 +201,22 @@ static const char *TGSI_INTERPOLATES_SHORT[] =
static const char *TGSI_SEMANTICS[] =
{
- "SEMANTIC_DEPTH",
- "SEMANTIC_COLOR0",
- "SEMANTIC_COLOR1",
- "SEMANTIC_COLOR0B",
- "SEMANTIC_COLOR1B",
"SEMANTIC_POSITION",
+ "SEMANTIC_COLOR",
+ "SEMANTIC_BCOLOR",
"SEMANTIC_FOG",
- "SEMANTIC_OTHER,"
- "SEMANTIC_TEX0",
+ "SEMANTIC_TEXCOORD",
+ "SEMANTIC_GENERIC,"
};
static const char *TGSI_SEMANTICS_SHORT[] =
{
- "DEPTH",
- "COLOR0",
- "COLOR1",
- "COLOR0B",
- "COLOR1B",
"POSITION",
+ "COLOR",
+ "BCOLOR",
"FOG",
- "OTHER",
- "TEX0"
+ "TEXCOORD",
+ "GENERIC",
};
static const char *TGSI_IMMS[] =
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_token.h b/src/mesa/pipe/tgsi/exec/tgsi_token.h
index a642ba131a..2d468b801e 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_token.h
+++ b/src/mesa/pipe/tgsi/exec/tgsi_token.h
@@ -103,23 +103,13 @@ struct tgsi_declaration_interpolation
unsigned Padding : 28;
};
-#define TGSI_SEMANTIC_DEPTH 0
-#define TGSI_SEMANTIC_COLOR0 1
-#define TGSI_SEMANTIC_COLOR1 2
-#define TGSI_SEMANTIC_COLOR0B 3 /**< back-face primary color */
-#define TGSI_SEMANTIC_COLOR1B 4 /**< back-face secondary color */
-#define TGSI_SEMANTIC_POSITION 5
-#define TGSI_SEMANTIC_FOG 6
-#define TGSI_SEMANTIC_OTHER 7 /* XXX temp */
-#define TGSI_SEMANTIC_TEX0 8
-#define TGSI_SEMANTIC_TEX1 9
-#define TGSI_SEMANTIC_TEX2 10
-#define TGSI_SEMANTIC_TEX3 11
-#define TGSI_SEMANTIC_TEX4 12
-#define TGSI_SEMANTIC_TEX5 13
-#define TGSI_SEMANTIC_TEX6 14
-#define TGSI_SEMANTIC_TEX7 15
-#define TGSI_SEMANTIC_COUNT 16 /**< number of semantic values */
+#define TGSI_SEMANTIC_POSITION 0
+#define TGSI_SEMANTIC_COLOR 1
+#define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
+#define TGSI_SEMANTIC_FOG 3
+#define TGSI_SEMANTIC_TEXCOORD 4
+#define TGSI_SEMANTIC_GENERIC 5
+#define TGSI_SEMANTIC_COUNT 6 /**< number of semantic values */
struct tgsi_declaration_semantic
{
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 115c5d1eb0..c7b62c9b84 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -473,7 +473,8 @@ make_frag_input_decl(
GLuint index,
GLuint interpolate,
GLuint usage_mask,
- GLuint semantic_name )
+ GLuint semantic_name,
+ GLuint semantic_index )
{
struct tgsi_full_declaration decl;
@@ -486,6 +487,7 @@ make_frag_input_decl(
decl.u.DeclarationRange.First = index;
decl.u.DeclarationRange.Last = index;
decl.Semantic.SemanticName = semantic_name;
+ decl.Semantic.SemanticIndex = semantic_index;
decl.Interpolation.Interpolate = interpolate;
return decl;
@@ -495,6 +497,7 @@ static struct tgsi_full_declaration
make_frag_output_decl(
GLuint index,
GLuint semantic_name,
+ GLuint semantic_index,
GLuint usage_mask )
{
struct tgsi_full_declaration decl;
@@ -507,7 +510,7 @@ make_frag_output_decl(
decl.u.DeclarationRange.First = index;
decl.u.DeclarationRange.Last = index;
decl.Semantic.SemanticName = semantic_name;
- decl.Semantic.SemanticIndex = 0;
+ decl.Semantic.SemanticIndex = semantic_index;
return decl;
}
@@ -528,7 +531,8 @@ tgsi_mesa_compile_fp_program(
const struct gl_fragment_program *program,
GLuint numInputs,
const GLuint inputMapping[],
- const ubyte inputSemantic[],
+ const ubyte inputSemanticName[],
+ const ubyte inputSemanticIndex[],
const GLuint interpMode[],
const GLuint outputMapping[],
struct tgsi_token *tokens,
@@ -553,13 +557,13 @@ tgsi_mesa_compile_fp_program(
ti = 3;
for (i = 0; i < numInputs; i++) {
- switch (inputSemantic[i]) {
+ switch (inputSemanticName[i]) {
case TGSI_SEMANTIC_POSITION:
/* Fragment XY pos */
fulldecl = make_frag_input_decl(i,
TGSI_INTERPOLATE_CONSTANT,
TGSI_WRITEMASK_XY,
- TGSI_SEMANTIC_POSITION );
+ TGSI_SEMANTIC_POSITION, 0 );
ti += tgsi_build_full_declaration(
&fulldecl,
&tokens[ti],
@@ -569,7 +573,7 @@ tgsi_mesa_compile_fp_program(
fulldecl = make_frag_input_decl(i,
TGSI_INTERPOLATE_LINEAR,
TGSI_WRITEMASK_ZW,
- TGSI_SEMANTIC_POSITION );
+ TGSI_SEMANTIC_POSITION, 0 );
ti += tgsi_build_full_declaration(
&fulldecl,
&tokens[ti],
@@ -580,7 +584,8 @@ tgsi_mesa_compile_fp_program(
fulldecl = make_frag_input_decl(i,
interpMode[i],
TGSI_WRITEMASK_XYZW,
- inputSemantic[i] );
+ inputSemanticName[i],
+ inputSemanticIndex[i]);
ti += tgsi_build_full_declaration(&fulldecl,
&tokens[ti],
header,
@@ -599,7 +604,7 @@ tgsi_mesa_compile_fp_program(
fulldecl = make_frag_output_decl(
0,
- TGSI_SEMANTIC_DEPTH,
+ TGSI_SEMANTIC_POSITION, 0, /* Z / Depth */
TGSI_WRITEMASK_Z );
ti += tgsi_build_full_declaration(
&fulldecl,
@@ -610,7 +615,7 @@ tgsi_mesa_compile_fp_program(
if( program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR) ) {
fulldecl = make_frag_output_decl(
1,
- TGSI_SEMANTIC_COLOR0,
+ TGSI_SEMANTIC_COLOR, 0,
TGSI_WRITEMASK_XYZW );
ti += tgsi_build_full_declaration(
&fulldecl,
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
index d61d80bab0..b40331981e 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h
@@ -12,7 +12,8 @@ tgsi_mesa_compile_fp_program(
const struct gl_fragment_program *program,
GLuint numInputs,
const GLuint inputMapping[],
- const ubyte inputSemantic[],
+ const ubyte inputSemanticName[],
+ const ubyte inputSemanticIndex[],
const GLuint interpMode[],
const GLuint outputMapping[],
struct tgsi_token *tokens,