aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-09-16 19:39:40 -0400
committerMarek Olšák <[email protected]>2019-09-30 14:21:42 -0400
commita1545af0797358bd77a115005c8ca05950efb297 (patch)
treebd390c1cb5da95108454515fa7850ac82e275525
parent0cc233e3dc36b569eabdfada6e42000185f00ac3 (diff)
ac/nir: fix GLSL imageSamples()
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 781f9ae1258..ea7bf91b79b 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2778,29 +2778,11 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx,
}
static LLVMValueRef visit_image_samples(struct ac_nir_context *ctx,
- const nir_intrinsic_instr *instr,
- bool bindless)
+ const nir_intrinsic_instr *instr)
{
- enum glsl_sampler_dim dim;
- bool is_array;
- if (bindless) {
- dim = nir_intrinsic_image_dim(instr);
- is_array = nir_intrinsic_image_array(instr);
- } else {
- const struct glsl_type *type = get_image_deref(instr)->type;
- dim = glsl_get_sampler_dim(type);
- is_array = glsl_sampler_type_is_array(type);
- }
+ LLVMValueRef rsrc = get_image_descriptor(ctx, instr, AC_DESC_IMAGE, false);
- struct ac_image_args args = { 0 };
- args.dim = ac_get_sampler_dim(ctx->ac.chip_class, dim, is_array);
- args.dmask = 0xf;
- args.resource = get_image_descriptor(ctx, instr, AC_DESC_IMAGE, false);
- args.opcode = ac_image_get_resinfo;
- args.lod = ctx->ac.i32_0;
- args.attributes = AC_FUNC_ATTR_READNONE;
-
- return ac_build_image_opcode(&ctx->ac, &args);
+ return ac_build_image_get_sample_count(&ctx->ac, rsrc);
}
static LLVMValueRef visit_image_size(struct ac_nir_context *ctx,
@@ -3446,10 +3428,8 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
visit_store_shared(ctx, instr);
break;
case nir_intrinsic_bindless_image_samples:
- result = visit_image_samples(ctx, instr, true);
- break;
case nir_intrinsic_image_deref_samples:
- result = visit_image_samples(ctx, instr, false);
+ result = visit_image_samples(ctx, instr);
break;
case nir_intrinsic_bindless_image_load:
result = visit_image_load(ctx, instr, true);