diff options
author | Jason Ekstrand <[email protected]> | 2018-03-26 14:35:05 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:54:00 -0700 |
commit | 85f4149f8a1f0fac3ec4dd4d97fd3d07f1654a8a (patch) | |
tree | e7f78fea97304db4ddd4fa7353b3b0d747a2f829 /src/compiler | |
parent | 3573570afef9f8f7c08643e01f64b0f75093c06b (diff) |
nir/builder: Use deref instructions for load/store/copy_var
Acked-by: Rob Clark <[email protected]>
Acked-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_builder.h | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 6a40e84c55f..189a4414e9b 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -761,16 +761,7 @@ nir_copy_deref(nir_builder *build, nir_deref_instr *dest, nir_deref_instr *src) static inline nir_ssa_def * nir_load_var(nir_builder *build, nir_variable *var) { - const unsigned num_components = glsl_get_vector_elements(var->type); - - nir_intrinsic_instr *load = - nir_intrinsic_instr_create(build->shader, nir_intrinsic_load_var); - load->num_components = num_components; - load->variables[0] = nir_deref_var_create(load, var); - nir_ssa_dest_init(&load->instr, &load->dest, num_components, - glsl_get_bit_size(var->type), NULL); - nir_builder_instr_insert(build, &load->instr); - return &load->dest.ssa; + return nir_load_deref(build, nir_build_deref_var(build, var)); } static inline nir_ssa_def * @@ -793,15 +784,7 @@ static inline void nir_store_var(nir_builder *build, nir_variable *var, nir_ssa_def *value, unsigned writemask) { - const unsigned num_components = glsl_get_vector_elements(var->type); - - nir_intrinsic_instr *store = - nir_intrinsic_instr_create(build->shader, nir_intrinsic_store_var); - store->num_components = num_components; - nir_intrinsic_set_write_mask(store, writemask); - store->variables[0] = nir_deref_var_create(store, var); - store->src[0] = nir_src_for_ssa(value); - nir_builder_instr_insert(build, &store->instr); + nir_store_deref(build, nir_build_deref_var(build, var), value, writemask); } static inline void @@ -836,11 +819,8 @@ nir_copy_deref_var(nir_builder *build, nir_deref_var *dest, nir_deref_var *src) static inline void nir_copy_var(nir_builder *build, nir_variable *dest, nir_variable *src) { - nir_intrinsic_instr *copy = - nir_intrinsic_instr_create(build->shader, nir_intrinsic_copy_var); - copy->variables[0] = nir_deref_var_create(copy, dest); - copy->variables[1] = nir_deref_var_create(copy, src); - nir_builder_instr_insert(build, ©->instr); + nir_copy_deref(build, nir_build_deref_var(build, dest), + nir_build_deref_var(build, src)); } static inline nir_ssa_def * |