[Mesa-dev] [PATCH 04/23] nir/lower_io: Make get_io_offset take a nir_deref, not a nir_deref_var.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 30 00:58:08 PDT 2015


We have a nir_deref_var, but it doesn't actually need that.  Upcoming
patches will make us call get_io_offset further down the dereference
chain, so handling an arbitrary dereference will be nice.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/nir/nir_lower_io.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c
index f027973..3b0a03a 100644
--- a/src/glsl/nir/nir_lower_io.c
+++ b/src/glsl/nir/nir_lower_io.c
@@ -78,7 +78,7 @@ deref_has_indirect(nir_deref_var *deref)
 }
 
 static unsigned
-get_io_offset(nir_deref_var *deref, nir_instr *instr, nir_src *indirect,
+get_io_offset(nir_deref *deref, nir_instr *instr, nir_src *indirect,
               struct lower_io_state *state)
 {
    bool found_indirect = false;
@@ -87,7 +87,7 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr, nir_src *indirect,
    nir_builder *b = &state->builder;
    b->cursor = nir_before_instr(instr);
 
-   nir_deref *tail = &deref->deref;
+   nir_deref *tail = deref;
    while (tail->child != NULL) {
       const struct glsl_type *parent_type = tail->type;
       tail = tail->child;
@@ -187,7 +187,7 @@ nir_lower_io_block(nir_block *block, void *void_state)
          load->num_components = intrin->num_components;
 
          nir_src indirect;
-         unsigned offset = get_io_offset(intrin->variables[0],
+         unsigned offset = get_io_offset(&intrin->variables[0]->deref,
                                          &intrin->instr, &indirect, state);
 
          unsigned location = intrin->variables[0]->var->data.driver_location;
@@ -233,7 +233,7 @@ nir_lower_io_block(nir_block *block, void *void_state)
          store->num_components = intrin->num_components;
 
          nir_src indirect;
-         unsigned offset = get_io_offset(intrin->variables[0],
+         unsigned offset = get_io_offset(&intrin->variables[0]->deref,
                                          &intrin->instr, &indirect, state);
          offset += intrin->variables[0]->var->data.driver_location;
 
-- 
2.5.3



More information about the mesa-dev mailing list