diff options
Diffstat (limited to 'src/compiler/nir/nir_lower_io.c')
-rw-r--r-- | src/compiler/nir/nir_lower_io.c | 19 |
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; } /** |