This was missing.

Signed-off-by: Samuel Pitoiset <[email protected]>
---
 src/amd/common/ac_nir_to_llvm.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 736b726beb..eaf400e2fe 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2334,9 +2334,12 @@ static LLVMValueRef visit_image_load(struct 
ac_nir_context *ctx,
        LLVMValueRef res;
        const nir_variable *var = get_image_variable(instr);
        const struct glsl_type *type = var->type;
+       struct ac_image_args args = {};
 
        type = glsl_without_array(type);
 
+       args.cache_policy = get_cache_policy(ctx, var->data.image.access, 
false);
+
        const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);
        if (dim == GLSL_SAMPLER_DIM_BUF) {
                unsigned mask = nir_ssa_def_components_read(&instr->dest.ssa);
@@ -2347,16 +2350,16 @@ static LLVMValueRef visit_image_load(struct 
ac_nir_context *ctx,
                vindex = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, 
instr->src[1]),
                                                 ctx->ac.i32_0, "");
 
-               /* TODO: set "glc" and "can_speculate" when OpenGL needs it. */
+               /* TODO: set "can_speculate" when OpenGL needs it. */
                res = ac_build_buffer_load_format(&ctx->ac, rsrc, vindex,
                                                  ctx->ac.i32_0, num_channels,
-                                                 false, false);
+                                                 !!(args.cache_policy & 
ac_glc),
+                                                 false);
                res = ac_build_expand_to_vec4(&ctx->ac, res, num_channels);
 
                res = ac_trim_vector(&ctx->ac, res, 
instr->dest.ssa.num_components);
                res = ac_to_integer(&ctx->ac, res);
        } else {
-               struct ac_image_args args = {};
                args.opcode = ac_image_load;
                get_image_coords(ctx, instr, &args);
                args.resource = get_image_descriptor(ctx, instr, AC_DESC_IMAGE, 
false);
@@ -2364,8 +2367,6 @@ static LLVMValueRef visit_image_load(struct 
ac_nir_context *ctx,
                                            glsl_sampler_type_is_array(type));
                args.dmask = 15;
                args.attributes = AC_FUNC_ATTR_READONLY;
-               args.cache_policy =
-                       get_cache_policy(ctx, var->data.image.access, false);
 
                res = ac_build_image_opcode(&ctx->ac, &args);
        }
@@ -2379,10 +2380,9 @@ static void visit_image_store(struct ac_nir_context *ctx,
        const nir_variable *var = get_image_variable(instr);
        const struct glsl_type *type = glsl_without_array(var->type);
        const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);
-       LLVMValueRef glc = ctx->ac.i1false;
-       bool force_glc = ctx->ac.chip_class == SI;
-       if (force_glc)
-               glc = ctx->ac.i1true;
+       struct ac_image_args args = {};
+
+       args.cache_policy = get_cache_policy(ctx, var->data.image.access, true);
 
        if (dim == GLSL_SAMPLER_DIM_BUF) {
                LLVMValueRef rsrc = get_image_buffer_descriptor(ctx, instr, 
true);
@@ -2392,12 +2392,11 @@ static void visit_image_store(struct ac_nir_context 
*ctx,
                params[2] = LLVMBuildExtractElement(ctx->ac.builder, 
get_src(ctx, instr->src[1]),
                                                    ctx->ac.i32_0, ""); /* 
vindex */
                params[3] = ctx->ac.i32_0; /* voffset */
-               params[4] = glc;  /* glc */
+               params[4] = LLVMConstInt(ctx->ac.i1, !!(args.cache_policy & 
ac_glc), 0);
                params[5] = ctx->ac.i1false;  /* slc */
                ac_build_intrinsic(&ctx->ac, 
"llvm.amdgcn.buffer.store.format.v4f32", ctx->ac.voidt,
                                   params, 6, 0);
        } else {
-               struct ac_image_args args = {};
                args.opcode = ac_image_store;
                args.data[0] = ac_to_float(&ctx->ac, get_src(ctx, 
instr->src[3]));
                get_image_coords(ctx, instr, &args);
@@ -2405,8 +2404,6 @@ static void visit_image_store(struct ac_nir_context *ctx,
                args.dim = get_ac_image_dim(&ctx->ac, 
glsl_get_sampler_dim(type),
                                            glsl_sampler_type_is_array(type));
                args.dmask = 15;
-               args.cache_policy =
-                       get_cache_policy(ctx, var->data.image.access, true);
 
                ac_build_image_opcode(&ctx->ac, &args);
        }
-- 
2.19.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to