[Mesa-dev] [PATCH] tgsi: track max array per file
Rob Clark
robdclark at gmail.com
Mon Jan 5 09:00:21 PST 2015
From: Rob Clark <robclark at freedesktop.org>
NOTE IN[] and OUT[] don't need (have?) ArrayID's.. and TEMP[] can
optionally have them. So we implicitly assume that ArrayID==0 always
exists for each file. This is why array_max[file] is never less than
zero.
You can tell from indirect_files(_read/written) if the legacy array-
id zero was actually used.
Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
I wasn't 100% sure about when/if you get array DCL's for IN/OUT files,
so I didn't try to differentiate between no-array and only ArrayID==0.
I think at least IN/OUT should be like the legacy no-ArrayID case for
TEMP.
src/gallium/auxiliary/tgsi/tgsi_scan.c | 2 ++
src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 2b44271..87f60f3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -165,6 +165,8 @@ 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);
for (reg = fulldecl->Range.First;
reg <= fulldecl->Range.Last;
reg++) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 93a9898..12eee54 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -61,6 +61,8 @@ struct tgsi_shader_info
int file_max[TGSI_FILE_COUNT]; /**< highest index of declared registers */
int const_file_max[PIPE_MAX_CONSTANT_BUFFERS];
+ unsigned array_max[TGSI_FILE_COUNT]; /**< highest index array per register file */
+
uint immediate_count; /**< number of immediates declared */
uint num_instructions;
--
2.1.0
More information about the mesa-dev
mailing list