From: Jason Ekstrand Date: Wed, 15 Jul 2020 18:32:10 +0000 (-0500) Subject: nir/lower_io: Choose to set access based on intrinsic metadata X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3a2975db987a6267e6938da6fe9f6628f2516ece;p=mesa.git nir/lower_io: Choose to set access based on intrinsic metadata This should be far more reliable than trying to keep opcode lists up-to-date. Reviewed-by: Jesse Natalie Reviewed-by: Eric Anholt Part-of: --- diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index c27646d7166..90bfe8a3dac 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -873,7 +873,7 @@ build_explicit_io_load(nir_builder *b, nir_intrinsic_instr *intrin, load->src[1] = nir_src_for_ssa(addr_to_offset(b, addr, addr_format)); } - if (mode == nir_var_mem_ssbo || mode == nir_var_mem_global || mode == nir_var_mem_ubo) + if (nir_intrinsic_infos[op].index_map[NIR_INTRINSIC_ACCESS] > 0) nir_intrinsic_set_access(load, nir_intrinsic_access(intrin)); unsigned bit_size = intrin->dest.ssa.bit_size; @@ -989,7 +989,7 @@ build_explicit_io_store(nir_builder *b, nir_intrinsic_instr *intrin, nir_intrinsic_set_write_mask(store, write_mask); - if (mode == nir_var_mem_ssbo || mode == nir_var_mem_global) + if (nir_intrinsic_infos[op].index_map[NIR_INTRINSIC_ACCESS] > 0) nir_intrinsic_set_access(store, nir_intrinsic_access(intrin)); /* TODO: We should try and provide a better alignment. For OpenCL, we need @@ -1062,7 +1062,7 @@ build_explicit_io_atomic(nir_builder *b, nir_intrinsic_instr *intrin, /* Global atomics don't have access flags because they assume that the * address may be non-uniform. */ - if (!addr_format_is_global(addr_format) && mode != nir_var_mem_shared) + if (nir_intrinsic_infos[op].index_map[NIR_INTRINSIC_ACCESS] > 0) nir_intrinsic_set_access(atomic, nir_intrinsic_access(intrin)); assert(intrin->dest.ssa.num_components == 1);