mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
nir: Report progress from lower_vec_to_movs().
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
(cherry picked from commit 9f5e7ae9d8)
[Emil Velikov] Correctly derive nir_shader from vec_to_movs_state
Signed-off-by: Emil Velikov <emil.velikov@collabora.co.uk>
Conflicts:
src/glsl/nir/nir.h
src/glsl/nir/nir_lower_vec_to_movs.c
This commit is contained in:
parent
2cc4e97396
commit
ef4e862396
2 changed files with 23 additions and 7 deletions
|
|
@ -1653,7 +1653,7 @@ void nir_lower_vars_to_ssa(nir_shader *shader);
|
|||
|
||||
void nir_remove_dead_variables(nir_shader *shader);
|
||||
|
||||
void nir_lower_vec_to_movs(nir_shader *shader);
|
||||
bool nir_lower_vec_to_movs(nir_shader *shader);
|
||||
void nir_lower_alu_to_scalar(nir_shader *shader);
|
||||
void nir_lower_load_const_to_scalar(nir_shader *shader);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@
|
|||
* moves with partial writes.
|
||||
*/
|
||||
|
||||
struct vec_to_movs_state {
|
||||
nir_function_impl *impl;
|
||||
bool progress;
|
||||
};
|
||||
|
||||
static bool
|
||||
src_matches_dest_reg(nir_dest *dest, nir_src *src)
|
||||
{
|
||||
|
|
@ -84,8 +89,12 @@ insert_mov(nir_alu_instr *vec, unsigned start_channel,
|
|||
}
|
||||
|
||||
static bool
|
||||
lower_vec_to_movs_block(nir_block *block, void *shader)
|
||||
lower_vec_to_movs_block(nir_block *block, void *void_state)
|
||||
{
|
||||
struct vec_to_movs_state *state = void_state;
|
||||
nir_function_impl *impl = state->impl;
|
||||
nir_shader *shader = impl->overload->function->shader;
|
||||
|
||||
nir_foreach_instr_safe(block, instr) {
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
|
@ -134,24 +143,31 @@ lower_vec_to_movs_block(nir_block *block, void *shader)
|
|||
|
||||
nir_instr_remove(&vec->instr);
|
||||
ralloc_free(vec);
|
||||
state->progress = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
nir_lower_vec_to_movs_impl(nir_function_impl *impl)
|
||||
{
|
||||
nir_shader *shader = impl->overload->function->shader;
|
||||
struct vec_to_movs_state state = { impl, false };
|
||||
|
||||
nir_foreach_block(impl, lower_vec_to_movs_block, shader);
|
||||
nir_foreach_block(impl, lower_vec_to_movs_block, &state);
|
||||
|
||||
return state.progress;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nir_lower_vec_to_movs(nir_shader *shader)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
nir_foreach_overload(shader, overload) {
|
||||
if (overload->impl)
|
||||
nir_lower_vec_to_movs_impl(overload->impl);
|
||||
progress = nir_lower_vec_to_movs_impl(overload->impl) || progress;
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue