nir/normalize_cubemap_coords: fixup for new foreach_block()
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 8 Apr 2016 21:29:45 +0000 (17:29 -0400)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 Apr 2016 22:52:17 +0000 (15:52 -0700)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_normalize_cubemap_coords.c

index 99eeacb1f5be6f3cef073aad15a8df936579a8a6..ab17467fbb13dd9a4f10e07138aad151b6f81bec 100644 (file)
  * 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