From e764192f4015a1c77863a1f9390f5f80f55bd67c Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Sun, 19 Jul 2020 22:31:26 +1200 Subject: [PATCH] pan/mdg: Use the blend RT for blend shader framebuffer fetches Fixes piglit test fbo-drawbuffers-blend-add when fixed-function blending is disabled in panfrost_get_blend_for_context. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/midgard_compile.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 5a7afec4008..bd5377b4a39 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1684,10 +1684,13 @@ mir_get_branch_cond(nir_src *src, bool *invert) } static uint8_t -output_load_rt_addr(nir_shader *nir, nir_intrinsic_instr *instr) +output_load_rt_addr(compiler_context *ctx, nir_intrinsic_instr *instr) { + if (ctx->is_blend) + return ctx->blend_rt; + const nir_variable *var; - var = search_var(&nir->outputs, nir_intrinsic_base(instr)); + var = search_var(&ctx->nir->outputs, nir_intrinsic_base(instr)); assert(var); unsigned loc = var->data.location; @@ -1820,7 +1823,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr) midgard_instruction ld = m_ld_color_buffer_32u(reg, 0); - ld.load_store.arg_2 = output_load_rt_addr(ctx->nir, instr); + ld.load_store.arg_2 = output_load_rt_addr(ctx, instr); if (nir_src_is_const(instr->src[0])) { ld.load_store.arg_1 = nir_src_as_uint(instr->src[0]); @@ -1851,7 +1854,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr) else ld = m_ld_color_buffer_as_fp32(reg, 0); - ld.load_store.arg_2 = output_load_rt_addr(ctx->nir, instr); + ld.load_store.arg_2 = output_load_rt_addr(ctx, instr); for (unsigned c = 4; c < 16; ++c) ld.swizzle[0][c] = 0; -- 2.30.2