diff options
author | Matt Turner <[email protected]> | 2017-03-02 11:24:19 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2017-03-23 14:34:44 -0700 |
commit | 01548f9f01644623ff7eb9778fc78f2eb90fc99a (patch) | |
tree | c5655b6ef92dbfc0c78f70379758d5d4531f12e9 /src/compiler/nir/nir_lower_atomics.c | |
parent | 0bd615d961d117f8ae0354df813cc98ea0df4755 (diff) |
nir: Return progress from nir_lower_atomics().
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_atomics.c')
-rw-r--r-- | src/compiler/nir/nir_lower_atomics.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c index 7a213fcb46e..1993013f8f6 100644 --- a/src/compiler/nir/nir_lower_atomics.c +++ b/src/compiler/nir/nir_lower_atomics.c @@ -35,7 +35,7 @@ * that directly store the buffer index and byte offset */ -static void +static bool lower_instr(nir_intrinsic_instr *instr, const struct gl_shader_program *shader_program, nir_shader *shader) @@ -87,13 +87,13 @@ lower_instr(nir_intrinsic_instr *instr, break; default: - return; + return false; } if (instr->variables[0]->var->data.mode != nir_var_uniform && instr->variables[0]->var->data.mode != nir_var_shader_storage && instr->variables[0]->var->data.mode != nir_var_shared) - return; /* atomics passed as function arguments can't be lowered */ + return false; /* atomics passed as function arguments can't be lowered */ void *mem_ctx = ralloc_parent(instr); unsigned uniform_loc = instr->variables[0]->var->data.location; @@ -168,19 +168,23 @@ lower_instr(nir_intrinsic_instr *instr, nir_instr_insert_before(&instr->instr, &new_instr->instr); nir_instr_remove(&instr->instr); + + return true; } -void +bool nir_lower_atomics(nir_shader *shader, const struct gl_shader_program *shader_program) { + bool progress = false; + nir_foreach_function(function, shader) { if (function->impl) { nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) - lower_instr(nir_instr_as_intrinsic(instr), - shader_program, shader); + progress |= lower_instr(nir_instr_as_intrinsic(instr), + shader_program, shader); } } @@ -188,4 +192,6 @@ nir_lower_atomics(nir_shader *shader, nir_metadata_dominance); } } + + return progress; } |