diff options
author | Jason Ekstrand <[email protected]> | 2018-12-14 11:16:09 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-01-08 00:38:29 +0000 |
commit | cd93b0a670f277349b421664583196a56e3a9f50 (patch) | |
tree | d14aea3c265ed62008b5b87df7a730ca060ad7cf | |
parent | abfe674c54bee6f8fdcae411b07db89c10b9d530 (diff) |
nir/validate: Require array indices to match the deref bit size
This doesn't currently change anything because array indices are
required to be 32 bits and all derefs are also 32 bits. However, we
will one day have 64-bit derefs for OpenCL.
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
-rw-r--r-- | src/compiler/nir/nir_validate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index c896b9a8037..063de4faf27 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -464,8 +464,10 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state) validate_assert(state, instr->type == glsl_get_array_element(parent->type)); - if (instr->deref_type == nir_deref_type_array) - validate_src(&instr->arr.index, state, 32, 1); + if (instr->deref_type == nir_deref_type_array) { + validate_src(&instr->arr.index, state, + nir_dest_bit_size(instr->dest), 1); + } break; default: |