summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-01-30 16:13:30 +1000
committerDave Airlie <[email protected]>2017-01-31 04:44:59 +1000
commit059dd171759bb89d915c049de1ca1c93865c21d3 (patch)
treea093ad798ca185266c3f98f274a4875e50d0df56
parenta1c1ba7d5649cca450ca81bf87be36c035a01db0 (diff)
radv/ac: fix multisample subpass image.
We weren't adding the fragment position properly. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Cc: "17.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c11
1 files 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 */