[Mesa-dev] [PATCH 06/42] panfrost/midgard: Rewrite to use new blend intrinsic
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Mon Jul 8 14:08:19 UTC 2019
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
.../drivers/panfrost/midgard/midgard_compile.c | 11 +++++++++++
.../panfrost/midgard/nir_lower_framebuffer.c | 15 ++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 2c304d9066e..39b8d9c1005 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -1416,6 +1416,17 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
break;
+ /* Special case of store_output for lowered blend shaders */
+ case nir_intrinsic_store_blended_output:
+ assert (ctx->stage == MESA_SHADER_FRAGMENT);
+ reg = nir_src_index(ctx, &instr->src[0]);
+
+ midgard_instruction move = v_mov(reg, blank_alu_src, SSA_FIXED_REGISTER(0));
+ emit_mir_instruction(ctx, move);
+ ctx->fragment_output = reg;
+
+ break;
+
case nir_intrinsic_load_alpha_ref_float:
assert(instr->dest.is_ssa);
diff --git a/src/gallium/drivers/panfrost/midgard/nir_lower_framebuffer.c b/src/gallium/drivers/panfrost/midgard/nir_lower_framebuffer.c
index 115fe5f09dd..202b3658a28 100644
--- a/src/gallium/drivers/panfrost/midgard/nir_lower_framebuffer.c
+++ b/src/gallium/drivers/panfrost/midgard/nir_lower_framebuffer.c
@@ -87,9 +87,18 @@ nir_lower_framebuffer(nir_shader *shader)
/* Format convert */
nir_ssa_def *converted = nir_float_to_native(&b, c_nir);
- /* Write out the converted color instead of the input */
- nir_instr_rewrite_src(instr, &intr->src[1],
- nir_src_for_ssa(converted));
+ /* Rewrite to use a native store by creating a new intrinsic */
+ nir_intrinsic_instr *new =
+ nir_intrinsic_instr_create(shader, nir_intrinsic_store_blended_output);
+ new->src[0] = nir_src_for_ssa(converted);
+
+ /* TODO: What about non-RGBA? Is that different? */
+ new->num_components = 4;
+
+ nir_builder_instr_insert(&b, &new->instr);
+
+ /* (And finally removing the old) */
+ nir_instr_remove(instr);
} else {
/* TODO loads */
}
--
2.20.1
More information about the mesa-dev
mailing list