nir/lower_indirect: nir_variable_mode is now a bitfield
Acked-by: Eric Anholt <eric@anholt.net> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
parent
ffa0e12e15
commit
2caaf0ac5e
|
@ -2185,7 +2185,7 @@ void nir_lower_var_copies(nir_shader *shader);
|
||||||
|
|
||||||
bool nir_lower_global_vars_to_local(nir_shader *shader);
|
bool nir_lower_global_vars_to_local(nir_shader *shader);
|
||||||
|
|
||||||
bool nir_lower_indirect_derefs(nir_shader *shader, uint32_t mode_mask);
|
bool nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes);
|
||||||
|
|
||||||
bool nir_lower_locals_to_regs(nir_shader *shader);
|
bool nir_lower_locals_to_regs(nir_shader *shader);
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ deref_has_indirect(nir_deref_var *deref)
|
||||||
|
|
||||||
struct lower_indirect_state {
|
struct lower_indirect_state {
|
||||||
nir_builder builder;
|
nir_builder builder;
|
||||||
uint32_t mode_mask;
|
nir_variable_mode modes;
|
||||||
bool progress;
|
bool progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ lower_indirect_block(nir_block *block, void *void_state)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Only lower variables whose mode is in the mask */
|
/* Only lower variables whose mode is in the mask */
|
||||||
if (!(state->mode_mask & (1 << intrin->variables[0]->var->data.mode)))
|
if (!(state->modes & intrin->variables[0]->var->data.mode))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
state->builder.cursor = nir_before_instr(&intrin->instr);
|
state->builder.cursor = nir_before_instr(&intrin->instr);
|
||||||
|
@ -206,12 +206,12 @@ lower_indirect_block(nir_block *block, void *void_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
lower_indirects_impl(nir_function_impl *impl, uint32_t mode_mask)
|
lower_indirects_impl(nir_function_impl *impl, nir_variable_mode modes)
|
||||||
{
|
{
|
||||||
struct lower_indirect_state state;
|
struct lower_indirect_state state;
|
||||||
|
|
||||||
state.progress = false;
|
state.progress = false;
|
||||||
state.mode_mask = mode_mask;
|
state.modes = modes;
|
||||||
nir_builder_init(&state.builder, impl);
|
nir_builder_init(&state.builder, impl);
|
||||||
|
|
||||||
nir_foreach_block(impl, lower_indirect_block, &state);
|
nir_foreach_block(impl, lower_indirect_block, &state);
|
||||||
|
@ -228,13 +228,13 @@ lower_indirects_impl(nir_function_impl *impl, uint32_t mode_mask)
|
||||||
* that does a binary search on the array index.
|
* that does a binary search on the array index.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
nir_lower_indirect_derefs(nir_shader *shader, uint32_t mode_mask)
|
nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes)
|
||||||
{
|
{
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
|
|
||||||
nir_foreach_function(shader, function) {
|
nir_foreach_function(shader, function) {
|
||||||
if (function->impl)
|
if (function->impl)
|
||||||
progress = lower_indirects_impl(function->impl, mode_mask) || progress;
|
progress = lower_indirects_impl(function->impl, modes) || progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
return progress;
|
return progress;
|
||||||
|
|
Loading…
Reference in New Issue