diff options
author | Brian <[email protected]> | 2007-08-23 17:00:47 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-23 17:00:47 -0600 |
commit | d8b16d416de95daa4f0ede9b839bdbf0fa6bf1b1 (patch) | |
tree | 9ee52ee42b11661ab89eb66474d49bf600a8e777 /src/mesa/pipe/tgsi | |
parent | 83547d1dca7281ffe03424d12316b26bb07b89c9 (diff) |
Checkpoint: new vertex/fragment attribute naming
Replace VF_ATTRIB_x with TGSI_ATTRIB_x
When converting mesa programs to TGSI programs, also convert the InputsRead
and OutputsWritten to a mask of TGSI_ATTRIB_ bits.
Still need to do conversion for vertex programs...
Diffstat (limited to 'src/mesa/pipe/tgsi')
-rw-r--r-- | src/mesa/pipe/tgsi/core/tgsi_token.h | 41 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c | 84 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h | 25 |
3 files changed, 99 insertions, 51 deletions
diff --git a/src/mesa/pipe/tgsi/core/tgsi_token.h b/src/mesa/pipe/tgsi/core/tgsi_token.h index a12a2d73705..ca53071a60e 100644 --- a/src/mesa/pipe/tgsi/core/tgsi_token.h +++ b/src/mesa/pipe/tgsi/core/tgsi_token.h @@ -1478,47 +1478,6 @@ struct tgsi_dst_register_ext_predicate }; -/** - * The specific values here are not important. - */ -enum { - TGSI_ATTRIB_POS = 0, - TGSI_ATTRIB_WEIGHT = 1, - TGSI_ATTRIB_NORMAL = 2, - TGSI_ATTRIB_COLOR0 = 3, - TGSI_ATTRIB_COLOR1 = 4, - TGSI_ATTRIB_FOG = 5, - TGSI_ATTRIB_COLOR_INDEX = 6, /* XXX omit? */ - TGSI_ATTRIB_EDGEFLAG = 7, - TGSI_ATTRIB_TEX0 = 8, - TGSI_ATTRIB_TEX1 = 9, - TGSI_ATTRIB_TEX2 = 10, - TGSI_ATTRIB_TEX3 = 11, - TGSI_ATTRIB_TEX4 = 12, - TGSI_ATTRIB_TEX5 = 13, - TGSI_ATTRIB_TEX6 = 14, - TGSI_ATTRIB_TEX7 = 15, - TGSI_ATTRIB_VAR0 = 16, - TGSI_ATTRIB_VAR1 = 17, - TGSI_ATTRIB_VAR2 = 18, - TGSI_ATTRIB_VAR3 = 19, - TGSI_ATTRIB_VAR4 = 20, - TGSI_ATTRIB_VAR5 = 21, - TGSI_ATTRIB_VAR6 = 22, - TGSI_ATTRIB_VAR7 = 23, - TGSI_ATTRIB_POINTSIZE = 24, - TGSI_ATTRIB_BFC0 = 25, - TGSI_ATTRIB_BFC1 = 26, - TGSI_ATTRIB_CLIP_POS = 27, - TGSI_ATTRIB_VERTEX_HEADER = 28, - TGSI_ATTRIB_MAX = 29 -}; - - -#define TGSI_MAX_TEXTURE 8 -#define TGSI_MAX_VARYING 8 - - #if defined __cplusplus } // extern "C" #endif // defined __cplusplus diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c index dfb263ebdc3..993d220c508 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c @@ -1,5 +1,7 @@ #include "tgsi_platform.h"
#include "tgsi_mesa.h"
+#include "pipe/tgsi/core/tgsi_attribs.h"
+#include "pipe/tgsi/mesa/mesa_to_tgsi.h"
#define TGSI_DEBUG 1
@@ -7,8 +9,8 @@ /**
* Convert a VERT_ATTRIB_x to a TGSI_ATTRIB_y
*/
-static GLuint
-translate_vertex_input(GLuint attrib)
+uint
+tgsi_mesa_translate_vertex_input(GLuint attrib)
{
/* XXX these could be implemented with array lookups too.... */
switch (attrib) {
@@ -70,8 +72,8 @@ translate_vertex_input(GLuint attrib) /**
* Convert VERT_RESULT_x to TGSI_ATTRIB_y
*/
-static GLuint
-translate_vertex_ouput(GLuint attrib)
+uint
+tgsi_mesa_translate_vertex_output(GLuint attrib)
{
switch (attrib) {
case VERT_RESULT_HPOS:
@@ -130,8 +132,8 @@ translate_vertex_ouput(GLuint attrib) /**
* Convert a FRAG_ATTRIB_x to a TGSI_ATTRIB_y
*/
-static GLuint
-translate_fragment_input(GLuint attrib)
+uint
+tgsi_mesa_translate_fragment_input(GLuint attrib)
{
switch (attrib) {
case FRAG_ATTRIB_WPOS:
@@ -184,8 +186,8 @@ translate_fragment_input(GLuint attrib) /**
* Convert FRAG_RESULT_x to TGSI_ATTRIB_y
*/
-static GLuint
-translate_fragment_output(GLuint attrib)
+uint
+tgsi_mesa_translate_fragment_output(GLuint attrib)
{
switch (attrib) {
case FRAG_RESULT_DEPR:
@@ -209,6 +211,68 @@ translate_fragment_output(GLuint attrib) }
+uint
+tgsi_mesa_translate_vertex_input_mask(GLbitfield mask)
+{
+ uint tgsiMask = 0x0;
+ uint i;
+ for (i = 0; i < VERT_ATTRIB_MAX && mask; i++) {
+ if (mask & (1 << i)) {
+ tgsiMask |= 1 << tgsi_mesa_translate_vertex_input(i);
+ }
+ mask &= ~(1 << i);
+ }
+ return tgsiMask;
+}
+
+
+uint
+tgsi_mesa_translate_vertex_output_mask(GLbitfield mask)
+{
+ uint tgsiMask = 0x0;
+ uint i;
+ for (i = 0; i < VERT_RESULT_MAX && mask; i++) {
+ if (mask & (1 << i)) {
+ tgsiMask |= 1 << tgsi_mesa_translate_vertex_output(i);
+ }
+ mask &= ~(1 << i);
+ }
+ return tgsiMask;
+}
+
+uint
+tgsi_mesa_translate_fragment_input_mask(GLbitfield mask)
+{
+ uint tgsiMask = 0x0;
+ uint i;
+ for (i = 0; i < FRAG_ATTRIB_MAX && mask; i++) {
+ if (mask & (1 << i)) {
+ tgsiMask |= 1 << tgsi_mesa_translate_fragment_input(i);
+ }
+ mask &= ~(1 << i);
+ }
+ return tgsiMask;
+}
+
+
+uint
+tgsi_mesa_translate_fragment_output_mask(GLbitfield mask)
+{
+ uint tgsiMask = 0x0;
+ uint i;
+ for (i = 0; i < FRAG_RESULT_MAX && mask; i++) {
+ if (mask & (1 << i)) {
+ tgsiMask |= 1 << tgsi_mesa_translate_fragment_output(i);
+ }
+ mask &= ~(1 << i);
+ }
+ return tgsiMask;
+}
+
+
+
+
+
/*
* Map mesa register file to TGSI register file.
@@ -290,11 +354,11 @@ map_register_file_index( * color results -> index 1, 2, ...
*/
if( index == FRAG_RESULT_DEPR ) {
- mapped_index = 0;
+ mapped_index = TGSI_ATTRIB_POS;
}
else {
assert( index == FRAG_RESULT_COLR );
- mapped_index = index + 1;
+ mapped_index = TGSI_ATTRIB_COLOR0;
}
}
else {
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h index 9256318997a..fda3fa397f8 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h @@ -19,6 +19,31 @@ tgsi_mesa_compile_vp_program( struct tgsi_token *tokens,
GLuint maxTokens );
+uint
+tgsi_mesa_translate_vertex_input(GLuint attrib);
+
+uint
+tgsi_mesa_translate_vertex_output(GLuint attrib);
+
+uint
+tgsi_mesa_translate_fragment_input(GLuint attrib);
+
+uint
+tgsi_mesa_translate_fragment_output(GLuint attrib);
+
+uint
+tgsi_mesa_translate_vertex_input_mask(GLbitfield mask);
+
+uint
+tgsi_mesa_translate_vertex_output_mask(GLbitfield mask);
+
+uint
+tgsi_mesa_translate_fragment_input_mask(GLbitfield mask);
+
+uint
+tgsi_mesa_translate_fragment_output_mask(GLbitfield mask);
+
+
#if defined __cplusplus
} // extern "C"
#endif // defined __cplusplus
|