diff options
author | Jason Ekstrand <[email protected]> | 2018-03-15 09:32:24 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:54:00 -0700 |
commit | 36efae1d6647a0495fc368bda9e6d2c14b81f482 (patch) | |
tree | a0cd77e2a3d8bc35404122888f8205c63339cfdf | |
parent | a6ebbbc594b1cac4b880d9da051bad9d70eeb2d8 (diff) |
nir/lower_samplers: Clean up function arguments
This little refactor makes us stop passing stage around and puts the
builder as the first parameter to some functions.
Acked-by: Rob Clark <[email protected]>
Acked-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/compiler/glsl/gl_nir_lower_samplers.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/compiler/glsl/gl_nir_lower_samplers.c b/src/compiler/glsl/gl_nir_lower_samplers.c index 552cd59af9b..a55652c5ae1 100644 --- a/src/compiler/glsl/gl_nir_lower_samplers.c +++ b/src/compiler/glsl/gl_nir_lower_samplers.c @@ -86,8 +86,8 @@ calc_sampler_offsets(nir_deref *tail, nir_tex_instr *instr, } static bool -lower_sampler(nir_tex_instr *instr, const struct gl_shader_program *shader_program, - gl_shader_stage stage, nir_builder *b) +lower_sampler(nir_builder *b, nir_tex_instr *instr, + const struct gl_shader_program *shader_program) { if (instr->texture == NULL) return false; @@ -116,6 +116,7 @@ lower_sampler(nir_tex_instr *instr, const struct gl_shader_program *shader_progr instr->texture_array_size = array_elements; } + gl_shader_stage stage = b->shader->info.stage; assert(location < shader_program->data->NumUniformStorage && shader_program->data->UniformStorage[location].opaque[stage].active); @@ -131,8 +132,8 @@ lower_sampler(nir_tex_instr *instr, const struct gl_shader_program *shader_progr } static bool -lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_program, - gl_shader_stage stage) +lower_impl(nir_function_impl *impl, + const struct gl_shader_program *shader_program) { nir_builder b; nir_builder_init(&b, impl); @@ -141,8 +142,8 @@ lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_progr nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { if (instr->type == nir_instr_type_tex) - progress |= lower_sampler(nir_instr_as_tex(instr), - shader_program, stage, &b); + progress |= lower_sampler(&b, nir_instr_as_tex(instr), + shader_program); } } @@ -159,8 +160,7 @@ gl_nir_lower_samplers(nir_shader *shader, nir_foreach_function(function, shader) { if (function->impl) - progress |= lower_impl(function->impl, shader_program, - shader->info.stage); + progress |= lower_impl(function->impl, shader_program); } return progress; |