summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_io.c
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2017-03-09 11:01:22 -0800
committerMatt Turner <[email protected]>2017-03-23 14:34:44 -0700
commitabc8a702d0f01852f85705a87c9d624300c1efec (patch)
tree9b08ab26713bbecdc04117304e34b1a8a7af571e /src/compiler/nir/nir_lower_io.c
parenta934b002221eb9ad8c15cfe5ab2ff39e7432c2c6 (diff)
nir: Return progress from nir_lower_io().
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_io.c')
-rw-r--r--src/compiler/nir/nir_lower_io.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 1156b80ea8f..1ae2cc7fa8d 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -364,6 +364,7 @@ nir_lower_io_block(nir_block *block,
{
nir_builder *b = &state->builder;
const nir_shader_compiler_options *options = b->shader->options;
+ bool progress = false;
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
@@ -474,18 +475,20 @@ nir_lower_io_block(nir_block *block,
nir_instr_insert_before(&intrin->instr, &replacement->instr);
nir_instr_remove(&intrin->instr);
+ progress = true;
}
- return true;
+ return progress;
}
-static void
+static bool
nir_lower_io_impl(nir_function_impl *impl,
nir_variable_mode modes,
int (*type_size)(const struct glsl_type *),
nir_lower_io_options options)
{
struct lower_io_state state;
+ bool progress = false;
nir_builder_init(&state.builder, impl);
state.modes = modes;
@@ -493,23 +496,29 @@ nir_lower_io_impl(nir_function_impl *impl,
state.options = options;
nir_foreach_block(block, impl) {
- nir_lower_io_block(block, &state);
+ progress |= nir_lower_io_block(block, &state);
}
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);
+ return progress;
}
-void
+bool
nir_lower_io(nir_shader *shader, nir_variable_mode modes,
int (*type_size)(const struct glsl_type *),
nir_lower_io_options options)
{
+ bool progress = false;
+
nir_foreach_function(function, shader) {
if (function->impl) {
- nir_lower_io_impl(function->impl, modes, type_size, options);
+ progress |= nir_lower_io_impl(function->impl, modes,
+ type_size, options);
}
}
+
+ return progress;
}
/**