Mesa (master): nir/lower_io: Don't use variable to get deref mode
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 10 10:52:37 UTC 2019
Module: Mesa
Branch: master
Commit: 133273aa22d09cbb2d53b7bf6a8e1da6302c4f15
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=133273aa22d09cbb2d53b7bf6a8e1da6302c4f15
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Wed Jul 10 11:55:24 2019 +0200
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 at basnieuwenhuizen.nl>
---
src/compiler/nir/nir_lower_io.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 9275803d6f5..279e6e77b6a 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -461,8 +461,7 @@ nir_lower_io_block(nir_block *block,
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
- nir_variable *var = nir_deref_instr_get_variable(deref);
- nir_variable_mode mode = var->data.mode;
+ nir_variable_mode mode = deref->mode;
if ((state->modes & mode) == 0)
continue;
@@ -473,6 +472,8 @@ nir_lower_io_block(nir_block *block,
mode != nir_var_uniform)
continue;
+ nir_variable *var = nir_deref_instr_get_variable(deref);
+
b->cursor = nir_before_instr(instr);
const bool per_vertex = nir_is_per_vertex_io(var, b->shader->info.stage);
More information about the mesa-commit
mailing list