nir/lower_samplers: fixup for new foreach_block()
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 8 Apr 2016 21:33:42 +0000 (17:33 -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_lower_samplers.c

index 7dfa96cc98ac0c7c92c6db38d036550b4b80bf27..9bff20b3a83dacb6082c8e95144c1e2d4b10707e 100644 (file)
@@ -152,39 +152,19 @@ lower_sampler(nir_tex_instr *instr, const struct gl_shader_program *shader_progr
    instr->texture = NULL;
 }
 
-typedef struct {
-   nir_builder builder;
-   const struct gl_shader_program *shader_program;
-   gl_shader_stage stage;
-} lower_state;
-
-static bool
-lower_block_cb(nir_block *block, void *_state)
-{
-   lower_state *state = (lower_state *) _state;
-
-   nir_foreach_instr(block, instr) {
-      if (instr->type == nir_instr_type_tex) {
-         nir_tex_instr *tex_instr = nir_instr_as_tex(instr);
-         lower_sampler(tex_instr, state->shader_program, state->stage,
-                       &state->builder);
-      }
-   }
-
-   return true;
-}
-
 static void
 lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_program,
            gl_shader_stage stage)
 {
-   lower_state state;
-
-   nir_builder_init(&state.builder, impl);
-   state.shader_program = shader_program;
-   state.stage = stage;
+   nir_builder b;
+   nir_builder_init(&b, impl);
 
-   nir_foreach_block_call(impl, lower_block_cb, &state);
+   nir_foreach_block(block, impl) {
+      nir_foreach_instr(block, instr) {
+         if (instr->type == nir_instr_type_tex)
+            lower_sampler(nir_instr_as_tex(instr), shader_program, stage, &b);
+      }
+   }
 }
 
 void