Commit a4ee0713 authored by Jason Ekstrand's avatar Jason Ekstrand
Browse files

preserve more metadata

parent 9662c2b2
Pipeline #41245 passed with stages
in 11 minutes and 47 seconds
......@@ -159,6 +159,15 @@ nir_remove_unused_io_vars(nir_shader *shader, struct exec_list *var_list,
if (progress)
nir_fixup_deref_modes(shader);
nir_foreach_function(function, shader) {
if (function->impl) {
nir_metadata_preserve(function->impl, progress,
nir_metadata_block_index |
nir_metadata_dominance |
nir_metadata_live_ssa_defs);
}
}
return progress;
}
......
......@@ -271,6 +271,7 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
nir_builder b;
nir_builder_init(&b, function->impl);
bool impl_progress = false;
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
......@@ -339,15 +340,23 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
case nir_intrinsic_interp_deref_at_offset:
case nir_intrinsic_load_deref:
case nir_intrinsic_store_deref:
if ((mask & nir_var_shader_in && mode == nir_var_shader_in) ||
(mask & nir_var_shader_out && mode == nir_var_shader_out))
if ((mask & nir_var_shader_in &&
mode == nir_var_shader_in) ||
(mask & nir_var_shader_out &&
mode == nir_var_shader_out)) {
lower_array(&b, intr, var, varyings);
impl_progress = true;
}
break;
default:
break;
}
}
}
nir_metadata_preserve(function->impl, impl_progress,
nir_metadata_block_index |
nir_metadata_dominance);
}
}
}
......
......@@ -103,6 +103,7 @@ nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask)
nir_builder b;
nir_builder_init(&b, function->impl);
bool impl_progress = false;
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
......@@ -115,18 +116,26 @@ nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask)
switch (intr->intrinsic) {
case nir_intrinsic_load_input:
if (mask & nir_var_shader_in)
if (mask & nir_var_shader_in) {
lower_load_input_to_scalar(&b, intr);
impl_progress = true;
}
break;
case nir_intrinsic_store_output:
if (mask & nir_var_shader_out)
if (mask & nir_var_shader_out) {
lower_store_output_to_scalar(&b, intr);
impl_progress = true;
}
break;
default:
break;
}
}
}
nir_metadata_preserve(function->impl, impl_progress,
nir_metadata_block_index |
nir_metadata_dominance);
}
}
}
......@@ -386,6 +395,14 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask)
free(entry->data);
}
nir_foreach_function(function, shader) {
if (function->impl) {
nir_metadata_preserve(function->impl, true,
nir_metadata_block_index |
nir_metadata_dominance);
}
}
_mesa_hash_table_destroy(split_inputs, NULL);
_mesa_hash_table_destroy(split_outputs, NULL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment