[Mesa-dev] [PATCH 28/47] nir/lower_samplers: fixup for new foreach_block()
Connor Abbott
cwabbott0 at gmail.com
Wed Apr 13 04:35:07 UTC 2016
Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/compiler/nir/nir_lower_samplers.c | 40 ++++++++++-------------------------
1 file changed, 11 insertions(+), 29 deletions(-)
diff --git a/src/compiler/nir/nir_lower_samplers.c b/src/compiler/nir/nir_lower_samplers.c
index f5d3e59..457fd01 100644
--- a/src/compiler/nir/nir_lower_samplers.c
+++ b/src/compiler/nir/nir_lower_samplers.c
@@ -152,39 +152,21 @@ 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_foreach_block(impl, lower_block_cb, &state);
+ nir_builder b;
+ nir_builder_init(&b, impl);
+
+ nir_foreach_block(impl, block) {
+ 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, shader_program, stage, &b);
+ }
+ }
+ }
}
void
--
2.5.0
More information about the mesa-dev
mailing list