summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Krol <michal@tungstengraphics.com>2008-05-31 19:48:13 +0200
committerMichal Krol <michal@tungstengraphics.com>2008-05-31 19:48:13 +0200
commita49381587f73c67469ec7546419cfc41387f938c (patch)
treea122bec2b1314d6f8e7ad2252317f92abd133b29
parent3de18c2ac3cf679875d22d7ae9e62a11f5ea03c9 (diff)
tgsi: Fix build after TGSI declaration interface changes.
-rw-r--r--src/gallium/auxiliary/tgsi/exec/tgsi_exec.c8
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.c8
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_build.c126
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_build.h19
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_dump.c58
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_parse.c17
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_parse.h9
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_scan.c4
8 files changed, 52 insertions, 197 deletions
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
index 826b432f09..6ba0949183 100644
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c
@@ -1411,13 +1411,11 @@ exec_declaration(
unsigned first, last, mask;
eval_coef_func eval;
- assert( decl->Declaration.Declare == TGSI_DECLARE_RANGE );
-
- first = decl->u.DeclarationRange.First;
- last = decl->u.DeclarationRange.Last;
+ first = decl->DeclarationRange.First;
+ last = decl->DeclarationRange.Last;
mask = decl->Declaration.UsageMask;
- switch( decl->Interpolation.Interpolate ) {
+ switch( decl->Declaration.Interpolate ) {
case TGSI_INTERPOLATE_CONSTANT:
eval = eval_constant_coef;
break;
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
index 189dc6024d..a59e22b6ea 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
@@ -1923,16 +1923,14 @@ emit_declaration(
unsigned first, last, mask;
unsigned i, j;
- assert( decl->Declaration.Declare == TGSI_DECLARE_RANGE );
-
- first = decl->u.DeclarationRange.First;
- last = decl->u.DeclarationRange.Last;
+ first = decl->DeclarationRange.First;
+ last = decl->DeclarationRange.Last;
mask = decl->Declaration.UsageMask;
for( i = first; i <= last; i++ ) {
for( j = 0; j < NUM_CHANNELS; j++ ) {
if( mask & (1 << j) ) {
- switch( decl->Interpolation.Interpolate ) {
+ switch( decl->Declaration.Interpolate ) {
case TGSI_INTERPOLATE_CONSTANT:
emit_coef_a0( func, 0, i, j );
emit_inputs( func, 0, i, j );
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_build.c b/src/gallium/auxiliary/tgsi/util/tgsi_build.c
index 9c883ab704..63cc27becc 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_build.c
@@ -90,9 +90,8 @@ tgsi_default_declaration( void )
declaration.Type = TGSI_TOKEN_TYPE_DECLARATION;
declaration.Size = 1;
declaration.File = TGSI_FILE_NULL;
- declaration.Declare = TGSI_DECLARE_RANGE;
declaration.UsageMask = TGSI_WRITEMASK_XYZW;
- declaration.Interpolate = 0;
+ declaration.Interpolate = TGSI_INTERPOLATE_CONSTANT;
declaration.Semantic = 0;
declaration.Padding = 0;
declaration.Extended = 0;
@@ -103,7 +102,6 @@ tgsi_default_declaration( void )
struct tgsi_declaration
tgsi_build_declaration(
unsigned file,
- unsigned declare,
unsigned usage_mask,
unsigned interpolate,
unsigned semantic,
@@ -112,11 +110,10 @@ tgsi_build_declaration(
struct tgsi_declaration declaration;
assert( file <= TGSI_FILE_IMMEDIATE );
- assert( declare <= TGSI_DECLARE_MASK );
+ assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE );
declaration = tgsi_default_declaration();
declaration.File = file;
- declaration.Declare = declare;
declaration.UsageMask = usage_mask;
declaration.Interpolate = interpolate;
declaration.Semantic = semantic;
@@ -144,7 +141,7 @@ tgsi_default_full_declaration( void )
struct tgsi_full_declaration full_declaration;
full_declaration.Declaration = tgsi_default_declaration();
- full_declaration.Interpolation = tgsi_default_declaration_interpolation();
+ full_declaration.DeclarationRange = tgsi_default_declaration_range();
full_declaration.Semantic = tgsi_default_declaration_semantic();
return full_declaration;
@@ -159,6 +156,7 @@ tgsi_build_full_declaration(
{
unsigned size = 0;
struct tgsi_declaration *declaration;
+ struct tgsi_declaration_range *dr;
if( maxsize <= size )
return 0;
@@ -167,63 +165,21 @@ tgsi_build_full_declaration(
*declaration = tgsi_build_declaration(
full_decl->Declaration.File,
- full_decl->Declaration.Declare,
full_decl->Declaration.UsageMask,
full_decl->Declaration.Interpolate,
full_decl->Declaration.Semantic,
header );
- switch( full_decl->Declaration.Declare ) {
- case TGSI_DECLARE_RANGE:
- {
- struct tgsi_declaration_range *dr;
-
- if( maxsize <= size )
- return 0;
- dr = (struct tgsi_declaration_range *) &tokens[size];
- size++;
-
- *dr = tgsi_build_declaration_range(
- full_decl->u.DeclarationRange.First,
- full_decl->u.DeclarationRange.Last,
- declaration,
- header );
- break;
- }
-
- case TGSI_DECLARE_MASK:
- {
- struct tgsi_declaration_mask *dm;
-
- if( maxsize <= size )
- return 0;
- dm = (struct tgsi_declaration_mask *) &tokens[size];
- size++;
-
- *dm = tgsi_build_declaration_mask(
- full_decl->u.DeclarationMask.Mask,
- declaration,
- header );
- break;
- }
-
- default:
- assert( 0 );
- }
-
- if( full_decl->Declaration.Interpolate ) {
- struct tgsi_declaration_interpolation *di;
-
- if( maxsize <= size )
- return 0;
- di = (struct tgsi_declaration_interpolation *) &tokens[size];
- size++;
+ if (maxsize <= size)
+ return 0;
+ dr = (struct tgsi_declaration_range *) &tokens[size];
+ size++;
- *di = tgsi_build_declaration_interpolation(
- full_decl->Interpolation.Interpolate,
- declaration,
- header );
- }
+ *dr = tgsi_build_declaration_range(
+ full_decl->DeclarationRange.First,
+ full_decl->DeclarationRange.Last,
+ declaration,
+ header );
if( full_decl->Declaration.Semantic ) {
struct tgsi_declaration_semantic *ds;
@@ -244,6 +200,17 @@ tgsi_build_full_declaration(
}
struct tgsi_declaration_range
+tgsi_default_declaration_range( void )
+{
+ struct tgsi_declaration_range dr;
+
+ dr.First = 0;
+ dr.Last = 0;
+
+ return dr;
+}
+
+struct tgsi_declaration_range
tgsi_build_declaration_range(
unsigned first,
unsigned last,
@@ -255,6 +222,7 @@ tgsi_build_declaration_range(
assert( last >= first );
assert( last <= 0xFFFF );
+ declaration_range = tgsi_default_declaration_range();
declaration_range.First = first;
declaration_range.Last = last;
@@ -263,50 +231,6 @@ tgsi_build_declaration_range(
return declaration_range;
}
-struct tgsi_declaration_mask
-tgsi_build_declaration_mask(
- unsigned mask,
- struct tgsi_declaration *declaration,
- struct tgsi_header *header )
-{
- struct tgsi_declaration_mask declaration_mask;
-
- declaration_mask.Mask = mask;
-
- declaration_grow( declaration, header );
-
- return declaration_mask;
-}
-
-struct tgsi_declaration_interpolation
-tgsi_default_declaration_interpolation( void )
-{
- struct tgsi_declaration_interpolation di;
-
- di.Interpolate = TGSI_INTERPOLATE_CONSTANT;
- di.Padding = 0;
-
- return di;
-}
-
-struct tgsi_declaration_interpolation
-tgsi_build_declaration_interpolation(
- unsigned interpolate,
- struct tgsi_declaration *declaration,
- struct tgsi_header *header )
-{
- struct tgsi_declaration_interpolation di;
-
- assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE );
-
- di = tgsi_default_declaration_interpolation();
- di.Interpolate = interpolate;
-
- declaration_grow( declaration, header );
-
- return di;
-}
-
struct tgsi_declaration_semantic
tgsi_default_declaration_semantic( void )
{
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_build.h b/src/gallium/auxiliary/tgsi/util/tgsi_build.h
index 80bffc4ae7..423cf141f5 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_build.h
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_build.h
@@ -37,7 +37,6 @@ tgsi_default_declaration( void );
struct tgsi_declaration
tgsi_build_declaration(
unsigned file,
- unsigned declare,
unsigned usage_mask,
unsigned interpolate,
unsigned semantic,
@@ -54,27 +53,15 @@ tgsi_build_full_declaration(
unsigned maxsize );
struct tgsi_declaration_range
+tgsi_default_declaration_range( void );
+
+struct tgsi_declaration_range
tgsi_build_declaration_range(
unsigned first,
unsigned last,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
-struct tgsi_declaration_mask
-tgsi_build_declaration_mask(
- unsigned mask,
- struct tgsi_declaration *declaration,
- struct tgsi_header *header );
-
-struct tgsi_declaration_interpolation
-tgsi_default_declaration_interpolation( void );
-
-struct tgsi_declaration_interpolation
-tgsi_build_declaration_interpolation(
- unsigned interpolate,
- struct tgsi_declaration *declaration,
- struct tgsi_header *header );
-
struct tgsi_declaration_semantic
tgsi_default_declaration_semantic( void );
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_dump.c b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
index b018ea9fa1..d1a3dfd9c7 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
@@ -546,19 +546,13 @@ tgsi_dump_declaration(
TXT( "\nDCL " );
ENM( decl->Declaration.File, TGSI_FILES_SHORT );
- switch( decl->Declaration.Declare ) {
- case TGSI_DECLARE_RANGE:
- CHR( '[' );
- UID( decl->u.DeclarationRange.First );
- if( decl->u.DeclarationRange.First != decl->u.DeclarationRange.Last ) {
- TXT( ".." );
- UID( decl->u.DeclarationRange.Last );
- }
- CHR( ']' );
- break;
- default:
- assert( 0 );
+ CHR( '[' );
+ UID( decl->DeclarationRange.First );
+ if (decl->DeclarationRange.First != decl->DeclarationRange.Last) {
+ TXT( ".." );
+ UID( decl->DeclarationRange.Last );
}
+ CHR( ']' );
if( decl->Declaration.UsageMask != TGSI_WRITEMASK_XYZW ) {
CHR( '.' );
@@ -586,10 +580,8 @@ tgsi_dump_declaration(
}
}
- if (decl->Declaration.Interpolate) {
- TXT( ", " );
- ENM( decl->Interpolation.Interpolate, TGSI_INTERPOLATES_SHORT );
- }
+ TXT( ", " );
+ ENM( decl->Declaration.Interpolate, TGSI_INTERPOLATES_SHORT );
}
static void
@@ -601,8 +593,6 @@ dump_declaration_verbose(
{
TXT( "\nFile : " );
ENM( decl->Declaration.File, TGSI_FILES );
- TXT( "\nDeclare : " );
- ENM( decl->Declaration.Declare, TGSI_DECLARES );
if( deflt || fd->Declaration.UsageMask != decl->Declaration.UsageMask ) {
TXT( "\nUsageMask : " );
if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
@@ -620,7 +610,7 @@ dump_declaration_verbose(
}
if( deflt || fd->Declaration.Interpolate != decl->Declaration.Interpolate ) {
TXT( "\nInterpolate: " );
- UID( decl->Declaration.Interpolate );
+ ENM( decl->Declaration.Interpolate, TGSI_INTERPOLATES );
}
if( deflt || fd->Declaration.Semantic != decl->Declaration.Semantic ) {
TXT( "\nSemantic : " );
@@ -632,32 +622,10 @@ dump_declaration_verbose(
}
EOL();
- switch( decl->Declaration.Declare ) {
- case TGSI_DECLARE_RANGE:
- TXT( "\nFirst: " );
- UID( decl->u.DeclarationRange.First );
- TXT( "\nLast : " );
- UID( decl->u.DeclarationRange.Last );
- break;
-
- case TGSI_DECLARE_MASK:
- TXT( "\nMask: " );
- UIX( decl->u.DeclarationMask.Mask );
- break;
-
- default:
- assert( 0 );
- }
-
- if( decl->Declaration.Interpolate ) {
- EOL();
- TXT( "\nInterpolate: " );
- ENM( decl->Interpolation.Interpolate, TGSI_INTERPOLATES );
- if( ignored ) {
- TXT( "\nPadding : " );
- UIX( decl->Interpolation.Padding );
- }
- }
+ TXT( "\nFirst: " );
+ UID( decl->DeclarationRange.First );
+ TXT( "\nLast : " );
+ UID( decl->DeclarationRange.Last );
if( decl->Declaration.Semantic ) {
EOL();
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_parse.c b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c
index 5c0b0bfd61..d16f0cdcad 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c
@@ -118,22 +118,7 @@ tgsi_parse_token(
*decl = tgsi_default_full_declaration();
decl->Declaration = *(struct tgsi_declaration *) &token;
- switch( decl->Declaration.Type ) {
- case TGSI_DECLARE_RANGE:
- next_token( ctx, &decl->u.DeclarationRange );
- break;
-
- case TGSI_DECLARE_MASK:
- next_token( ctx, &decl->u.DeclarationMask );
- break;
-
- default:
- assert (0);
- }
-
- if( decl->Declaration.Interpolate ) {
- next_token( ctx, &decl->Interpolation );
- }
+ next_token( ctx, &decl->DeclarationRange );
if( decl->Declaration.Semantic ) {
next_token( ctx, &decl->Semantic );
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_parse.h b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h
index 4102101093..054350712d 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_parse.h
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h
@@ -65,13 +65,8 @@ struct tgsi_full_src_register
struct tgsi_full_declaration
{
struct tgsi_declaration Declaration;
- union
- {
- struct tgsi_declaration_range DeclarationRange;
- struct tgsi_declaration_mask DeclarationMask;
- } u;
- struct tgsi_declaration_interpolation Interpolation;
- struct tgsi_declaration_semantic Semantic;
+ struct tgsi_declaration_range DeclarationRange;
+ struct tgsi_declaration_semantic Semantic;
};
struct tgsi_full_immediate
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_scan.c b/src/gallium/auxiliary/tgsi/util/tgsi_scan.c
index 65650ed22a..bda7bc2e2e 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_scan.c
@@ -93,8 +93,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
= &parse.FullToken.FullDeclaration;
uint file = fulldecl->Declaration.File;
uint i;
- for (i = fulldecl->u.DeclarationRange.First;
- i <= fulldecl->u.DeclarationRange.Last;
+ for (i = fulldecl->DeclarationRange.First;
+ i <= fulldecl->DeclarationRange.Last;
i++) {
/* only first 32 regs will appear in this bitfield */