summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2016-04-08 17:29:45 -0400
committerJason Ekstrand <[email protected]>2016-04-28 15:52:17 -0700
commitf4ebff89e4a59b7cc21317eca341d5c8de4f1c81 (patch)
treeb7cab22d415b16870cb1cdaa81f907e81a910d27
parent492b3554a7c61ca5fb3687d6fc696d51713c8136 (diff)
nir/normalize_cubemap_coords: fixup for new foreach_block()
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/compiler/nir/nir_normalize_cubemap_coords.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/compiler/nir/nir_normalize_cubemap_coords.c b/src/compiler/nir/nir_normalize_cubemap_coords.c
index 99eeacb1f5b..ab17467fbb1 100644
--- a/src/compiler/nir/nir_normalize_cubemap_coords.c
+++ b/src/compiler/nir/nir_normalize_cubemap_coords.c
@@ -33,16 +33,10 @@
* or 1.0. This is based on the old GLSL IR based pass by Eric.
*/
-struct normalize_cubemap_state {
- nir_builder b;
- bool progress;
-};
-
static bool
-normalize_cubemap_coords_block(nir_block *block, void *void_state)
+normalize_cubemap_coords_block(nir_block *block, nir_builder *b)
{
- struct normalize_cubemap_state *state = void_state;
- nir_builder *b = &state->b;
+ bool progress = false;
nir_foreach_instr(block, instr) {
if (instr->type != nir_instr_type_tex)
@@ -84,26 +78,28 @@ normalize_cubemap_coords_block(nir_block *block, void *void_state)
&tex->src[i].src,
nir_src_for_ssa(normalized));
- state->progress = true;
+ progress = true;
}
}
- return true;
+ return progress;
}
static bool
normalize_cubemap_coords_impl(nir_function_impl *impl)
{
- struct normalize_cubemap_state state;
- nir_builder_init(&state.b, impl);
- state.progress = false;
+ nir_builder b;
+ nir_builder_init(&b, impl);
+ bool progress = false;
- nir_foreach_block_call(impl, normalize_cubemap_coords_block, &state);
+ nir_foreach_block(block, impl) {
+ progress |= normalize_cubemap_coords_block(block, &b);
+ }
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);
- return state.progress;
+ return progress;
}
bool