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);
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);
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);
}
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) {
char name[48];
if (HAVE_LLVM >= 0x800) {
params[4] = ctx->ac.i32_0; /* soffset */
- params[5] = glc ? ctx->ac.i32_1 : ctx->ac.i32_0;
+ params[5] = (args.cache_policy & ac_glc) ? ctx->ac.i32_1 : ctx->ac.i32_0;
} else {
- 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, name, 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);
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);
}