diff options
author | Jason Ekstrand <[email protected]> | 2018-03-16 22:13:00 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:15:55 -0700 |
commit | 61b7bef3a347e8b64a1eb5811ab3cafcf75cf92c (patch) | |
tree | b28f92d8629f7bd8ff4043101590b570d3a5de17 | |
parent | 1285cc961623dd0d05894edca2d94dd085443402 (diff) |
nir: Support deref instructions in lower_system_values
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
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/nir/nir_lower_system_values.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index dc71a8c8d87..0f27d039d08 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -39,10 +39,15 @@ convert_block(nir_block *block, nir_builder *b) nir_intrinsic_instr *load_var = nir_instr_as_intrinsic(instr); - if (load_var->intrinsic != nir_intrinsic_load_var) - continue; + nir_variable *var; + 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) continue; @@ -203,13 +208,16 @@ nir_lower_system_values(nir_shader *shader) { bool progress = false; - nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs); - nir_foreach_function(function, shader) { if (function->impl) 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); return progress; |