diff options
author | Francisco Jerez <[email protected]> | 2012-04-30 18:27:52 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2012-05-11 12:39:40 +0200 |
commit | 1279923d72942ee201fcc6ad40d552143f651f03 (patch) | |
tree | 73eb59a3e623c04a0344c8b57188e96d362ec197 /src/gallium/auxiliary/tgsi/tgsi_build.c | |
parent | 5f55cbc7d93c6568566893f9345e43fff311a32b (diff) |
gallium/tgsi: Move interpolation info from tgsi_declaration to a separate token.
Move Interpolate, Centroid and CylindricalWrap from tgsi_declaration
to a separate token -- they only make sense for FS inputs and we need
room for other flags in the top-level declaration token.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_build.c')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_build.c | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 6c3f77581f0..b4f50038bed 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -104,12 +104,10 @@ tgsi_default_declaration( void ) declaration.NrTokens = 1; declaration.File = TGSI_FILE_NULL; declaration.UsageMask = TGSI_WRITEMASK_XYZW; - declaration.Interpolate = TGSI_INTERPOLATE_CONSTANT; + declaration.Interpolate = 0; declaration.Dimension = 0; declaration.Semantic = 0; - declaration.Centroid = 0; declaration.Invariant = 0; - declaration.CylindricalWrap = 0; return declaration; } @@ -121,9 +119,7 @@ tgsi_build_declaration( unsigned interpolate, unsigned dimension, unsigned semantic, - unsigned centroid, unsigned invariant, - unsigned cylindrical_wrap, struct tgsi_header *header ) { struct tgsi_declaration declaration; @@ -137,9 +133,7 @@ tgsi_build_declaration( declaration.Interpolate = interpolate; declaration.Dimension = dimension; declaration.Semantic = semantic; - declaration.Centroid = centroid; declaration.Invariant = invariant; - declaration.CylindricalWrap = cylindrical_wrap; header_bodysize_grow( header ); @@ -194,6 +188,36 @@ tgsi_build_declaration_dimension(unsigned index_2d, return dd; } +static struct tgsi_declaration_interp +tgsi_default_declaration_interp( void ) +{ + struct tgsi_declaration_interp di; + + di.Interpolate = TGSI_INTERPOLATE_CONSTANT; + di.Centroid = 0; + di.CylindricalWrap = 0; + + return di; +} + +static struct tgsi_declaration_interp +tgsi_build_declaration_interp(unsigned interpolate, + unsigned centroid, + unsigned cylindrical_wrap, + struct tgsi_declaration *declaration, + struct tgsi_header *header) +{ + struct tgsi_declaration_interp di; + + di.Interpolate = interpolate; + di.Centroid = centroid; + di.CylindricalWrap = cylindrical_wrap; + + declaration_grow(declaration, header); + + return di; +} + static struct tgsi_declaration_semantic tgsi_default_declaration_semantic( void ) { @@ -298,6 +322,7 @@ tgsi_default_full_declaration( void ) full_declaration.Declaration = tgsi_default_declaration(); full_declaration.Range = tgsi_default_declaration_range(); full_declaration.Semantic = tgsi_default_declaration_semantic(); + full_declaration.Interp = tgsi_default_declaration_interp(); full_declaration.ImmediateData.u = NULL; full_declaration.Resource = tgsi_default_declaration_resource(); full_declaration.SamplerView = tgsi_default_declaration_sampler_view(); @@ -327,9 +352,7 @@ tgsi_build_full_declaration( full_decl->Declaration.Interpolate, full_decl->Declaration.Dimension, full_decl->Declaration.Semantic, - full_decl->Declaration.Centroid, full_decl->Declaration.Invariant, - full_decl->Declaration.CylindricalWrap, header ); if (maxsize <= size) @@ -357,6 +380,22 @@ tgsi_build_full_declaration( header); } + if (full_decl->Declaration.Interpolate) { + struct tgsi_declaration_interp *di; + + if (maxsize <= size) { + return 0; + } + di = (struct tgsi_declaration_interp *)&tokens[size]; + size++; + + *di = tgsi_build_declaration_interp(full_decl->Interp.Interpolate, + full_decl->Interp.Centroid, + full_decl->Interp.CylindricalWrap, + declaration, + header); + } + if( full_decl->Declaration.Semantic ) { struct tgsi_declaration_semantic *ds; |