summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_build.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2013-08-12 17:34:27 +1000
committerDave Airlie <[email protected]>2013-08-27 10:41:09 +1000
commit81204d0e9cb52d05352df1b416e4e661701296e6 (patch)
tree1905f309507ece671528755e2cf77758cf8899cc /src/gallium/auxiliary/tgsi/tgsi_build.c
parent92cbfded6a3000e19385191bcf30f57e2eb933b6 (diff)
tgsi: finish declaration parsing for arrays.
I previously fixed this partly in 9e8400f4c95bde1f955c7977066583b507159a10, however I didn't go far enough in testing it, now when I parse a TGSI shader with arrays in it my iterator can see the ArrayID set to the proper value. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_build.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 523430b3ca7..fa18462bed4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -124,6 +124,7 @@ tgsi_build_declaration(
unsigned semantic,
unsigned invariant,
unsigned local,
+ unsigned array,
struct tgsi_header *header )
{
struct tgsi_declaration declaration;
@@ -139,7 +140,7 @@ tgsi_build_declaration(
declaration.Semantic = semantic;
declaration.Invariant = invariant;
declaration.Local = local;
-
+ declaration.Array = array;
header_bodysize_grow( header );
return declaration;
@@ -339,6 +340,21 @@ tgsi_default_declaration_array( void )
return a;
}
+static struct tgsi_declaration_array
+tgsi_build_declaration_array(unsigned arrayid,
+ struct tgsi_declaration *declaration,
+ struct tgsi_header *header)
+{
+ struct tgsi_declaration_array da;
+
+ da = tgsi_default_declaration_array();
+ da.ArrayID = arrayid;
+
+ declaration_grow(declaration, header);
+
+ return da;
+}
+
struct tgsi_full_declaration
tgsi_default_full_declaration( void )
{
@@ -379,6 +395,7 @@ tgsi_build_full_declaration(
full_decl->Declaration.Semantic,
full_decl->Declaration.Invariant,
full_decl->Declaration.Local,
+ full_decl->Declaration.Array,
header );
if (maxsize <= size)
@@ -472,6 +489,19 @@ tgsi_build_full_declaration(
header);
}
+ if (full_decl->Declaration.Array) {
+ struct tgsi_declaration_array *da;
+
+ if (maxsize <= size) {
+ return 0;
+ }
+ da = (struct tgsi_declaration_array *)&tokens[size];
+ size++;
+ *da = tgsi_build_declaration_array(
+ full_decl->Array.ArrayID,
+ declaration,
+ header);
+ }
return size;
}