summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhys Perry <pendingchaos02@gmail.com>2019-11-28 15:29:40 +0000
committerDylan Baker <dylan@pnwbakers.com>2019-12-03 10:23:51 -0800
commitf4a4cce590480d6fec31d12c2b7a18a177649405 (patch)
tree08310fba24815945059d2c6e9438e52188b00353
parent4f026b2a05d41e3b91792729e0b8bf10f430943d (diff)
aco: propagate p_wqm on an image_sample's coordinate p_create_vector
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2156 Fixes: 93c8ebfa780 ('aco: Initial commit of independent AMD compiler') Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> (cherry picked from commit ff70ccad16a2efb3be1fbc4ca03453d38721a267)
-rw-r--r--src/amd/compiler/aco_instruction_selection.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index ed6ece3e6f2..d3a0d3b17bb 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -6572,11 +6572,6 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
}
}
- if (!(has_ddx && has_ddy) && !has_lod && !level_zero &&
- instr->sampler_dim != GLSL_SAMPLER_DIM_MS &&
- instr->sampler_dim != GLSL_SAMPLER_DIM_SUBPASS_MS)
- coords = emit_wqm(ctx, coords, bld.tmp(coords.regClass()), true);
-
std::vector<Operand> args;
if (has_offset)
args.emplace_back(Operand(offset));
@@ -6592,7 +6587,7 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
if (has_lod)
args.emplace_back(lod);
- Operand arg;
+ Temp arg;
if (args.size() > 1) {
aco_ptr<Pseudo_instruction> vec{create_instruction<Pseudo_instruction>(aco_opcode::p_create_vector, Format::PSEUDO, args.size(), 1)};
unsigned size = 0;
@@ -6604,12 +6599,20 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
Temp tmp = bld.tmp(rc);
vec->definitions[0] = Definition(tmp);
ctx->block->instructions.emplace_back(std::move(vec));
- arg = Operand(tmp);
+ arg = tmp;
} else {
assert(args[0].isTemp());
- arg = Operand(as_vgpr(ctx, args[0].getTemp()));
+ arg = as_vgpr(ctx, args[0].getTemp());
}
+ /* we don't need the bias, sample index, compare value or offset to be
+ * computed in WQM but if the p_create_vector copies the coordinates, then it
+ * needs to be in WQM */
+ if (!(has_ddx && has_ddy) && !has_lod && !level_zero &&
+ instr->sampler_dim != GLSL_SAMPLER_DIM_MS &&
+ instr->sampler_dim != GLSL_SAMPLER_DIM_SUBPASS_MS)
+ arg = emit_wqm(ctx, arg, bld.tmp(arg.regClass()), true);
+
if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF) {
//FIXME: if (ctx->abi->gfx9_stride_size_workaround) return ac_build_buffer_load_format_gfx9_safe()
@@ -6741,7 +6744,7 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
}
tex.reset(create_instruction<MIMG_instruction>(opcode, Format::MIMG, 3, 1));
- tex->operands[0] = arg;
+ tex->operands[0] = Operand(arg);
tex->operands[1] = Operand(resource);
tex->operands[2] = Operand(sampler);
tex->dim = dim;