nir/lower_io: Don't use variable to get deref mode
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 10 Jul 2019 09:55:24 +0000 (11:55 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Wed, 10 Jul 2019 10:31:41 +0000 (12:31 +0200)
commit133273aa22d09cbb2d53b7bf6a8e1da6302c4f15
tree963acceb4a1c61bdb031ca9e4dacf76ea040ff8a
parentf18b8a1174a3ac7ca1c75bfe8ac0a5e595d094f6
nir/lower_io: Don't use variable to get deref mode

Drivers only use lower_io for modes where pointers don't have a
meaningful value, and dereferences can always be traced back to a
variable. But there can be other modes, like global mode with
VK_EXT_buffer_device_address, where pointers cannot be traced back to a
variable, and lower_io would segfault on loads/stores of these since
nir_deref_instr_get_variable() would return NULL.

Just use the mode on the deref itself to filter out these modes before
we try to get the variable.

Fixes: 118a66df990 ("radv: Use NIR barycentric coordinates")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/compiler/nir/nir_lower_io.c