Mesa (main): agx: Implement load_output
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 10 03:38:02 UTC 2021
Module: Mesa
Branch: main
Commit: d0f566a90d8ca1a116f728525a2ab01d705bff31
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0f566a90d8ca1a116f728525a2ab01d705bff31
Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date: Tue May 4 23:00:55 2021 -0400
agx: Implement load_output
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10720>
---
src/asahi/compiler/agx_compile.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index f4b6d059524..b347e6c2129 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -184,6 +184,28 @@ agx_emit_fragment_out(agx_builder *b, nir_intrinsic_instr *instr)
b->shader->key->fs.tib_formats[rt]);
}
+static agx_instr *
+agx_emit_load_tile(agx_builder *b, nir_intrinsic_instr *instr)
+{
+ const nir_variable *var =
+ nir_find_variable_with_driver_location(b->shader->nir,
+ nir_var_shader_out, nir_intrinsic_base(instr));
+ assert(var);
+
+ unsigned loc = var->data.location;
+ assert(var->data.index == 0 && "todo: dual-source blending");
+ assert(loc == FRAG_RESULT_DATA0 && "todo: MRT");
+ unsigned rt = (loc - FRAG_RESULT_DATA0);
+
+ /* TODO: Reverse-engineer interactions with MRT */
+ agx_writeout(b, 0xC200);
+ agx_writeout(b, 0x0008);
+ b->shader->did_writeout = true;
+
+ return agx_ld_tile_to(b, agx_dest_index(&instr->dest),
+ b->shader->key->fs.tib_formats[rt]);
+}
+
static enum agx_format
agx_format_for_bits(unsigned bits)
{
@@ -280,6 +302,10 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr)
else
unreachable("Unsupported shader stage");
+ case nir_intrinsic_load_output:
+ assert(stage == MESA_SHADER_FRAGMENT);
+ return agx_emit_load_tile(b, instr);
+
case nir_intrinsic_load_ubo:
case nir_intrinsic_load_kernel_input:
return agx_emit_load_ubo(b, instr);
More information about the mesa-commit
mailing list