From 059dd171759bb89d915c049de1ca1c93865c21d3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Jan 2017 16:13:30 +1000 Subject: [PATCH] radv/ac: fix multisample subpass image. We weren't adding the fragment position properly. Reviewed-by: Bas Nieuwenhuizen Cc: "17.0" Signed-off-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index dedea656892..b90148ee8aa 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2247,7 +2247,7 @@ static int image_type_to_components_count(enum glsl_sampler_dim dim, bool array) } static LLVMValueRef get_image_coords(struct nir_to_llvm_context *ctx, - nir_intrinsic_instr *instr, bool add_frag_pos) + nir_intrinsic_instr *instr) { const struct glsl_type *type = instr->variables[0]->var->type; if(instr->variables[0]->deref.child) @@ -2262,6 +2262,8 @@ static LLVMValueRef get_image_coords(struct nir_to_llvm_context *ctx, LLVMValueRef res; int count; enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); + bool add_frag_pos = (dim == GLSL_SAMPLER_DIM_SUBPASS || + dim == GLSL_SAMPLER_DIM_SUBPASS_MS); bool is_ms = (dim == GLSL_SAMPLER_DIM_MS || dim == GLSL_SAMPLER_DIM_SUBPASS_MS); @@ -2387,12 +2389,11 @@ static LLVMValueRef visit_image_load(struct nir_to_llvm_context *ctx, } else { bool is_da = glsl_sampler_type_is_array(type) || glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE; - bool add_frag_pos = glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_SUBPASS; LLVMValueRef da = is_da ? ctx->i32one : ctx->i32zero; LLVMValueRef glc = LLVMConstInt(ctx->i1, 0, false); LLVMValueRef slc = LLVMConstInt(ctx->i1, 0, false); - params[0] = get_image_coords(ctx, instr, add_frag_pos); + params[0] = get_image_coords(ctx, instr); params[1] = get_sampler_desc(ctx, instr->variables[0], DESC_IMAGE); params[2] = LLVMConstInt(ctx->i32, 15, false); /* dmask */ if (HAVE_LLVM <= 0x0309) { @@ -2451,7 +2452,7 @@ static void visit_image_store(struct nir_to_llvm_context *ctx, LLVMValueRef slc = i1false; params[0] = to_float(ctx, get_src(ctx, instr->src[2])); - params[1] = get_image_coords(ctx, instr, false); /* coords */ + params[1] = get_image_coords(ctx, instr); /* coords */ params[2] = get_sampler_desc(ctx, instr->variables[0], DESC_IMAGE); params[3] = LLVMConstInt(ctx->i32, 15, false); /* dmask */ if (HAVE_LLVM <= 0x0309) { @@ -2511,7 +2512,7 @@ static LLVMValueRef visit_image_atomic(struct nir_to_llvm_context *ctx, bool da = glsl_sampler_type_is_array(type) || glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE; - coords = params[param_count++] = get_image_coords(ctx, instr, false); + coords = params[param_count++] = get_image_coords(ctx, instr); params[param_count++] = get_sampler_desc(ctx, instr->variables[0], DESC_IMAGE); params[param_count++] = i1false; /* r128 */ params[param_count++] = da ? i1true : i1false; /* da */ -- 2.30.2