summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_scan.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-05-10 17:41:26 +0200
committerMarek Olšák <[email protected]>2015-06-05 19:44:32 +0200
commitcf2c9265a3977d43beb9a9894a5b934af74df7d7 (patch)
treebe7b584cd211609477627b09db1adbe02aa01be6 /src/gallium/auxiliary/tgsi/tgsi_scan.c
parent78395dbf9ff429d98523f8b4a340f7188d8b4db0 (diff)
tgsi/scan: get more information about arrays and handle arrays correctly (v2)
v2: use less memory for the information
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_scan.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index d821072935a..369f56a1955 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -167,13 +167,31 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
= &parse.FullToken.FullDeclaration;
const uint file = fulldecl->Declaration.File;
uint reg;
- if (fulldecl->Declaration.Array)
- info->array_max[file] = MAX2(info->array_max[file], fulldecl->Array.ArrayID);
+
+ if (fulldecl->Declaration.Array) {
+ unsigned array_id = fulldecl->Array.ArrayID;
+
+ switch (file) {
+ case TGSI_FILE_INPUT:
+ assert(array_id < ARRAY_SIZE(info->input_array_first));
+ info->input_array_first[array_id] = fulldecl->Range.First;
+ info->input_array_last[array_id] = fulldecl->Range.Last;
+ break;
+ case TGSI_FILE_OUTPUT:
+ assert(array_id < ARRAY_SIZE(info->output_array_first));
+ info->output_array_first[array_id] = fulldecl->Range.First;
+ info->output_array_last[array_id] = fulldecl->Range.Last;
+ break;
+ }
+ info->array_max[file] = MAX2(info->array_max[file], array_id);
+ }
+
for (reg = fulldecl->Range.First;
reg <= fulldecl->Range.Last;
reg++) {
unsigned semName = fulldecl->Semantic.Name;
- unsigned semIndex = fulldecl->Semantic.Index;
+ unsigned semIndex =
+ fulldecl->Semantic.Index + (reg - fulldecl->Range.First);
/* only first 32 regs will appear in this bitfield */
info->file_mask[file] |= (1 << reg);