diff options
author | Samuel Pitoiset <[email protected]> | 2019-03-26 23:06:53 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-03-27 09:57:27 +0100 |
commit | 4d0b03c83df4ed1bf3477ae6855eed51ebf87524 (patch) | |
tree | e097b4d806cf95a0a3b1fa23d74e42c1931c4c52 /src/compiler | |
parent | d163780f819b406679bf5b86b6c4286940c00415 (diff) |
nir: add nir_{load,store}_deref_with_access() helpers
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: <Jason Ekstrand [email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_builder.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index bcf03957bc7..01622fbb154 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -1044,7 +1044,8 @@ nir_load_reg(nir_builder *build, nir_register *reg) } static inline nir_ssa_def * -nir_load_deref(nir_builder *build, nir_deref_instr *deref) +nir_load_deref_with_access(nir_builder *build, nir_deref_instr *deref, + enum gl_access_qualifier access) { nir_intrinsic_instr *load = nir_intrinsic_instr_create(build->shader, nir_intrinsic_load_deref); @@ -1052,13 +1053,21 @@ nir_load_deref(nir_builder *build, nir_deref_instr *deref) load->src[0] = nir_src_for_ssa(&deref->dest.ssa); nir_ssa_dest_init(&load->instr, &load->dest, load->num_components, glsl_get_bit_size(deref->type), NULL); + nir_intrinsic_set_access(load, access); nir_builder_instr_insert(build, &load->instr); return &load->dest.ssa; } +static inline nir_ssa_def * +nir_load_deref(nir_builder *build, nir_deref_instr *deref) +{ + return nir_load_deref_with_access(build, deref, (enum gl_access_qualifier)0); +} + static inline void -nir_store_deref(nir_builder *build, nir_deref_instr *deref, - nir_ssa_def *value, unsigned writemask) +nir_store_deref_with_access(nir_builder *build, nir_deref_instr *deref, + nir_ssa_def *value, unsigned writemask, + enum gl_access_qualifier access) { nir_intrinsic_instr *store = nir_intrinsic_instr_create(build->shader, nir_intrinsic_store_deref); @@ -1067,10 +1076,19 @@ nir_store_deref(nir_builder *build, nir_deref_instr *deref, store->src[1] = nir_src_for_ssa(value); nir_intrinsic_set_write_mask(store, writemask & ((1 << store->num_components) - 1)); + nir_intrinsic_set_access(store, access); nir_builder_instr_insert(build, &store->instr); } static inline void +nir_store_deref(nir_builder *build, nir_deref_instr *deref, + nir_ssa_def *value, unsigned writemask) +{ + nir_store_deref_with_access(build, deref, value, writemask, + (enum gl_access_qualifier)0); +} + +static inline void nir_copy_deref(nir_builder *build, nir_deref_instr *dest, nir_deref_instr *src) { nir_intrinsic_instr *copy = |