summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi/tgsi_build.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2010-01-21 20:02:17 +0100
committerMichal Krol <michal@vmware.com>2010-01-28 14:07:38 +0100
commitdcf8543ab375dd9c128d1ca772b1e587cebbdc7c (patch)
tree3f41559ec3786e3a6f6710edbf5638d6f3370ba5 /src/gallium/auxiliary/tgsi/tgsi_build.c
parentd96bb01d2db4d07ab7e4b6a50da2f96787180a4d (diff)
tgsi: Handle two-dimensional constants in text parser.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_build.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index de9cbc8630..e38b0be7ab 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -103,6 +103,7 @@ tgsi_default_declaration( void )
declaration.File = TGSI_FILE_NULL;
declaration.UsageMask = TGSI_WRITEMASK_XYZW;
declaration.Interpolate = TGSI_INTERPOLATE_CONSTANT;
+ declaration.Dimension = 0;
declaration.Semantic = 0;
declaration.Centroid = 0;
declaration.Invariant = 0;
@@ -116,6 +117,7 @@ tgsi_build_declaration(
unsigned file,
unsigned usage_mask,
unsigned interpolate,
+ unsigned dimension,
unsigned semantic,
unsigned centroid,
unsigned invariant,
@@ -130,6 +132,7 @@ tgsi_build_declaration(
declaration.File = file;
declaration.UsageMask = usage_mask;
declaration.Interpolate = interpolate;
+ declaration.Dimension = dimension;
declaration.Semantic = semantic;
declaration.Centroid = centroid;
declaration.Invariant = invariant;
@@ -183,6 +186,7 @@ tgsi_build_full_declaration(
full_decl->Declaration.File,
full_decl->Declaration.UsageMask,
full_decl->Declaration.Interpolate,
+ full_decl->Declaration.Dimension,
full_decl->Declaration.Semantic,
full_decl->Declaration.Centroid,
full_decl->Declaration.Invariant,
@@ -199,6 +203,20 @@ tgsi_build_full_declaration(
declaration,
header );
+ if (full_decl->Declaration.Dimension) {
+ struct tgsi_declaration_dimension *dd;
+
+ if (maxsize <= size) {
+ return 0;
+ }
+ dd = (struct tgsi_declaration_dimension *)&tokens[size];
+ size++;
+
+ *dd = tgsi_build_declaration_dimension(full_decl->Dim.Index2D,
+ declaration,
+ header);
+ }
+
if( full_decl->Declaration.Semantic ) {
struct tgsi_declaration_semantic *ds;
@@ -249,6 +267,34 @@ tgsi_build_declaration_range(
return declaration_range;
}
+struct tgsi_declaration_dimension
+tgsi_default_declaration_dimension(void)
+{
+ struct tgsi_declaration_dimension dd;
+
+ dd.Index2D = 0;
+ dd.Padding = 0;
+
+ return dd;
+}
+
+struct tgsi_declaration_dimension
+tgsi_build_declaration_dimension(unsigned index_2d,
+ struct tgsi_declaration *declaration,
+ struct tgsi_header *header)
+{
+ struct tgsi_declaration_dimension dd;
+
+ assert(index_2d <= 0xFFFF);
+
+ dd = tgsi_default_declaration_dimension();
+ dd.Index2D = index_2d;
+
+ declaration_grow(declaration, header);
+
+ return dd;
+}
+
struct tgsi_declaration_semantic
tgsi_default_declaration_semantic( void )
{