Mesa (master): ac/nir: consider an image load/store intrinsic's access

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 5 10:01:48 UTC 2020


Module: Mesa
Branch: master
Commit: 4640e7da04a253388e9214f4a88252e115bf84e6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4640e7da04a253388e9214f4a88252e115bf84e6

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Jul 30 11:14:55 2020 +0100

ac/nir: consider an image load/store intrinsic's access

ACCESS_COHERENT may be set for a specific load/store in the case of
atomic loads/stores.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6063>

---

 src/amd/llvm/ac_nir_to_llvm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index ef6ab7cea92..8c316e417e9 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -2803,18 +2803,17 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx,
 	LLVMValueRef res;
 
 	enum glsl_sampler_dim dim;
-	enum gl_access_qualifier access;
+	enum gl_access_qualifier access = nir_intrinsic_access(instr);
 	bool is_array;
 	if (bindless) {
 		dim = nir_intrinsic_image_dim(instr);
-		access = nir_intrinsic_access(instr);
 		is_array = nir_intrinsic_image_array(instr);
 	} else {
 		const nir_deref_instr *image_deref = get_image_deref(instr);
 		const struct glsl_type *type = image_deref->type;
 		const nir_variable *var = nir_deref_instr_get_variable(image_deref);
 		dim = glsl_get_sampler_dim(type);
-		access = var->data.access;
+		access |= var->data.access;
 		is_array = glsl_sampler_type_is_array(type);
 	}
 
@@ -2876,19 +2875,18 @@ static void visit_image_store(struct ac_nir_context *ctx,
         }
 
 	enum glsl_sampler_dim dim;
-	enum gl_access_qualifier access;
+	enum gl_access_qualifier access = nir_intrinsic_access(instr);
 	bool is_array;
 
 	if (bindless) {
 		dim = nir_intrinsic_image_dim(instr);
-		access = nir_intrinsic_access(instr);
 		is_array = nir_intrinsic_image_array(instr);
 	} else {
 		const nir_deref_instr *image_deref = get_image_deref(instr);
 		const struct glsl_type *type = image_deref->type;
 		const nir_variable *var = nir_deref_instr_get_variable(image_deref);
 		dim = glsl_get_sampler_dim(type);
-		access = var->data.access;
+		access |= var->data.access;
 		is_array = glsl_sampler_type_is_array(type);
 	}
 



More information about the mesa-commit mailing list