[Mesa-dev] [PATCH 05/12] nir: Make deref_has_indirect public
Ian Romanick
idr at freedesktop.org
Thu Jun 28 04:46:18 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/nir/nir.h | 1 +
src/compiler/nir/nir_lower_io_arrays_to_elements.c | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 7e9f3968f63..f05c51197ac 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2650,6 +2650,7 @@ bool nir_lower_phis_to_scalar(nir_shader *shader);
void nir_lower_io_arrays_to_elements(nir_shader *producer, nir_shader *consumer);
void nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader,
bool outputs_only);
+bool nir_deref_has_indirect(gl_shader_stage stage, nir_deref_var *deref);
void nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask);
void nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask);
diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
index 9a5eec8f870..7753f85824d 100644
--- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c
+++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
@@ -194,12 +194,13 @@ lower_array(nir_builder *b, nir_intrinsic_instr *intr, nir_variable *var,
nir_instr_remove(&intr->instr);
}
-static bool
-deref_has_indirect(nir_builder *b, nir_variable *var, nir_deref_var *deref)
+bool
+nir_deref_has_indirect(gl_shader_stage stage, nir_deref_var *deref)
{
+ const nir_variable *const var = deref->var;
nir_deref *tail = &deref->deref;
- if (nir_is_per_vertex_io(var, b->shader->info.stage)) {
+ if (nir_is_per_vertex_io(var, stage)) {
tail = tail->child;
}
@@ -249,10 +250,10 @@ create_indirects_mask(nir_shader *shader, uint64_t *indirects,
uint64_t loc_mask = ((uint64_t)1) << var->data.location;
if (var->data.patch) {
- if (deref_has_indirect(&b, var, intr->variables[0]))
+ if (nir_deref_has_indirect(b.shader->info.stage, intr->variables[0]))
patch_indirects[var->data.location_frac] |= loc_mask;
} else {
- if (deref_has_indirect(&b, var, intr->variables[0]))
+ if (nir_deref_has_indirect(b.shader->info.stage, intr->variables[0]))
indirects[var->data.location_frac] |= loc_mask;
}
}
--
2.14.4
More information about the mesa-dev
mailing list