[Mesa-dev] [PATCH 11/22] nir: simplify get_io_offset() parameters

Karol Herbst kherbst at redhat.com
Tue Nov 13 15:48:15 UTC 2018


From: Rob Clark <robdclark at gmail.com>

For pointers we'll need to add another caller, plus in addition a
type_align() fxn ptr.  So  just simplify things and pass the
lower_io_state to get_io_offset().

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/compiler/nir/nir_lower_io.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index b3595bb19d5..2a6c284de2b 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -87,11 +87,11 @@ nir_is_per_vertex_io(const nir_variable *var, gl_shader_stage stage)
 }
 
 static nir_ssa_def *
-get_io_offset(nir_builder *b, nir_deref_instr *deref,
-              nir_ssa_def **vertex_index,
-              int (*type_size)(const struct glsl_type *),
-              unsigned *component)
+get_io_offset(nir_deref_instr *deref, nir_ssa_def **vertex_index,
+              struct lower_io_state *state, unsigned *component)
 {
+   nir_builder *b = &state->builder;
+   int (*type_size)(const struct glsl_type *) = state->type_size;
    nir_deref_path path;
    nir_deref_path_init(&path, deref, NULL);
 
@@ -421,8 +421,8 @@ nir_lower_io_block(nir_block *block,
       nir_ssa_def *vertex_index = NULL;
       unsigned component_offset = var->data.location_frac;
 
-      offset = get_io_offset(b, deref, per_vertex ? &vertex_index : NULL,
-                             state->type_size, &component_offset);
+      offset = get_io_offset(deref, per_vertex ? &vertex_index : NULL,
+                             state, &component_offset);
 
       nir_intrinsic_instr *replacement;
 
-- 
2.19.1



More information about the mesa-dev mailing list