summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_sanity.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-11-05 19:26:20 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-11-05 19:27:27 -0700
commit639a2b0ec853eda49e3e7150b2ed7f8f40d101af (patch)
tree54aeff3d84a5e14319068a328351a547baf6c024 /src/gallium/auxiliary/tgsi/tgsi_sanity.c
parentde14fdd63f26a2e6fc55fad92c08966f269601a6 (diff)
downloadexternal_mesa3d-639a2b0ec853eda49e3e7150b2ed7f8f40d101af.zip
external_mesa3d-639a2b0ec853eda49e3e7150b2ed7f8f40d101af.tar.gz
external_mesa3d-639a2b0ec853eda49e3e7150b2ed7f8f40d101af.tar.bz2
gallium: don't range check tgsi register index for indirect accesses
Fixes progs/vp/arl.txt test.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_sanity.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index 1165924..bc7b941 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -153,17 +153,21 @@ check_register_usage(
if (!check_file_name( ctx, file ))
return FALSE;
- if (index < 0 || index > MAX_REGISTERS) {
- report_error( ctx, "%s[%i]: Invalid index %s", file_names[file], index, name );
- return FALSE;
- }
-
if (indirect_access) {
+ /* Note that 'index' is an offset relative to the value of the
+ * address register. No range checking done here.
+ */
if (!is_any_register_declared( ctx, file ))
report_error( ctx, "%s: Undeclared %s register", file_names[file], name );
ctx->regs_ind_used[file] = TRUE;
}
else {
+ if (index < 0 || index > MAX_REGISTERS) {
+ report_error( ctx, "%s[%i]: Invalid index %s",
+ file_names[file], index, name );
+ return FALSE;
+ }
+
if (!is_register_declared( ctx, file, index ))
report_error( ctx, "%s[%d]: Undeclared %s register", file_names[file], index, name );
ctx->regs_used[file][index / BITS_IN_REG_FLAG] |= (1 << (index % BITS_IN_REG_FLAG));