summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhys Perry <pendingchaos02@gmail.com>2022-11-16 15:08:34 +0000
committerEric Engestrom <eric@engestrom.ch>2022-11-23 19:11:59 +0000
commitc0c581ec3449b865e2d1e5dd080d7c88ca30f8fe (patch)
tree11744cc868fd711e7be5973e53a0d19ea4df6732
parent1a60fb52be9ffdc629b022ceb807122b8c468711 (diff)
downloadmesa-c0c581ec3449b865e2d1e5dd080d7c88ca30f8fe.tar.gz
aco: ensure MRT0 is written with dual source blending
Fixes crucible test func.shader.dualsrc_mrt0_undef on polaris10. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Cc: 22.3 mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19806> (cherry picked from commit 3061bc792d3d0252854a38bff956c15c51b06643)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/compiler/aco_instruction_selection.cpp13
2 files changed, 14 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 050cc3f91e8..99f7bf212bf 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -904,7 +904,7 @@
"description": "aco: ensure MRT0 is written with dual source blending",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index ae2fd975a43..c1acde8599d 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -11496,6 +11496,19 @@ create_fs_exports(isel_context* ctx)
struct aco_export_mrt mrts[8];
unsigned compacted_mrt_index = 0;
+ /* MRT compaction doesn't work with dual-source blending. Dual-source blending seems to
+ * require MRT0 to be written. Just copy MRT1 into MRT0. Skipping MRT1 exports seems to be
+ * fine.
+ */
+ if (ctx->options->key.ps.mrt0_is_dual_src && !ctx->outputs.mask[FRAG_RESULT_DATA0] &&
+ ctx->outputs.mask[FRAG_RESULT_DATA1]) {
+ u_foreach_bit (j, ctx->outputs.mask[FRAG_RESULT_DATA1]) {
+ ctx->outputs.temps[FRAG_RESULT_DATA0 * 4u + j] =
+ ctx->outputs.temps[FRAG_RESULT_DATA1 * 4u + j];
+ }
+ ctx->outputs.mask[FRAG_RESULT_DATA0] = ctx->outputs.mask[FRAG_RESULT_DATA1];
+ }
+
/* Export all color render targets. */
for (unsigned i = FRAG_RESULT_DATA0; i < FRAG_RESULT_DATA7 + 1; ++i) {
unsigned idx = i - FRAG_RESULT_DATA0;