mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 00:30:13 +01:00
nir: Support deref instructions in lower_system_values
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Acked-by: Rob Clark <robdclark@gmail.com> Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Acked-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
1285cc9616
commit
61b7bef3a3
1 changed files with 13 additions and 5 deletions
|
|
@ -39,10 +39,15 @@ convert_block(nir_block *block, nir_builder *b)
|
||||||
|
|
||||||
nir_intrinsic_instr *load_var = nir_instr_as_intrinsic(instr);
|
nir_intrinsic_instr *load_var = nir_instr_as_intrinsic(instr);
|
||||||
|
|
||||||
if (load_var->intrinsic != nir_intrinsic_load_var)
|
nir_variable *var;
|
||||||
continue;
|
if (load_var->intrinsic == nir_intrinsic_load_var) {
|
||||||
|
var = load_var->variables[0]->var;
|
||||||
|
} else if (load_var->intrinsic == nir_intrinsic_load_deref) {
|
||||||
|
var = nir_deref_instr_get_variable(nir_src_as_deref(load_var->src[0]));
|
||||||
|
} else {
|
||||||
|
continue; /* Not a load instruction */
|
||||||
|
}
|
||||||
|
|
||||||
nir_variable *var = load_var->variables[0]->var;
|
|
||||||
if (var->data.mode != nir_var_system_value)
|
if (var->data.mode != nir_var_system_value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -203,13 +208,16 @@ nir_lower_system_values(nir_shader *shader)
|
||||||
{
|
{
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
|
|
||||||
nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
|
|
||||||
|
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function(function, shader) {
|
||||||
if (function->impl)
|
if (function->impl)
|
||||||
progress = convert_impl(function->impl) || progress;
|
progress = convert_impl(function->impl) || progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We're going to delete the variables so we need to clean up all those
|
||||||
|
* derefs we left lying around.
|
||||||
|
*/
|
||||||
|
nir_remove_dead_derefs(shader);
|
||||||
|
|
||||||
exec_list_make_empty(&shader->system_values);
|
exec_list_make_empty(&shader->system_values);
|
||||||
|
|
||||||
return progress;
|
return progress;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue