nir/lower_io: fix handling for compact arrays with indirect derefs

this logic relies on constant indexing for compact arrays, but this is
frequently not the case for compact array builtins (e.g., gl_TessLevelOuter).
the usual strategy of lowering to temps isn't viable in TCS, which means
io lowering has to be able to handle indirect access to these builtins
without crashing

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27534>
(cherry picked from commit 9e2c7314f2)
This commit is contained in:
Mike Blumenkrantz 2024-02-08 13:14:37 -05:00 committed by Eric Engestrom
parent a77f728e1a
commit 0675801f72
2 changed files with 2 additions and 2 deletions

View File

@ -664,7 +664,7 @@
"description": "nir/lower_io: fix handling for compact arrays with indirect derefs",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@ -216,7 +216,7 @@ get_io_offset(nir_builder *b, nir_deref_instr *deref,
p++;
}
if (path.path[0]->var->data.compact) {
if (path.path[0]->var->data.compact && nir_src_is_const((*p)->arr.index)) {
assert((*p)->deref_type == nir_deref_type_array);
assert(glsl_type_is_scalar((*p)->type));