From 1b9b2f90464687f57d48395ac3af0a69d4311b5b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 9 May 2021 21:01:34 -0400 Subject: [PATCH] agx: Condition writeout ops on already being emitted There's a lot of r/e waiting here, but will be needed for ld_tile. Match the Metal blob. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 9 +++++++-- src/asahi/compiler/agx_compiler.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index b344ecce532..f4b6d059524 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -172,9 +172,14 @@ agx_emit_fragment_out(agx_builder *b, nir_intrinsic_instr *instr) unsigned rt = (loc - FRAG_RESULT_DATA0); /* TODO: Reverse-engineer interactions with MRT */ - agx_writeout(b, 0xC200); - agx_writeout(b, 0x000C); + if (b->shader->did_writeout) { + agx_writeout(b, 0x0004); + } else { + agx_writeout(b, 0xC200); + agx_writeout(b, 0x000C); + } + b->shader->did_writeout = true; return agx_st_tile(b, agx_src_index(&instr->src[0]), b->shader->key->fs.tib_formats[rt]); } diff --git a/src/asahi/compiler/agx_compiler.h b/src/asahi/compiler/agx_compiler.h index 030cb26585b..0c45c0e0b60 100644 --- a/src/asahi/compiler/agx_compiler.h +++ b/src/asahi/compiler/agx_compiler.h @@ -318,6 +318,9 @@ typedef struct { /* For creating temporaries */ unsigned alloc; + /* I don't really understand how writeout ops work yet */ + bool did_writeout; + /* Stats for shader-db */ unsigned loop_count; unsigned spills;