From 1a8f1a324a22bcd99b31482002d4b380ffb7cb34 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 23 Apr 2020 19:26:01 -0400 Subject: [PATCH] pan/bi: Passthrough blend types Signed-off-by: Alyssa Rosenzweig Signed-off-by: Tomeu Vizoso Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 5 +++++ src/panfrost/bifrost/compiler.h | 1 + src/panfrost/util/pan_ir.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index cdaf772709c..333172f1699 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -163,6 +163,10 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr) .writemask = 0xF }; + assert(blend.blend_location < 8); + assert(ctx->blend_types); + ctx->blend_types[blend.blend_location] = blend.src_types[0]; + bi_emit(ctx, blend); bi_schedule_barrier(ctx); } @@ -1074,6 +1078,7 @@ bifrost_compile_shader_nir(nir_shader *nir, panfrost_program *program, unsigned panfrost_nir_assign_sysvals(&ctx->sysvals, nir); program->sysval_count = ctx->sysvals.sysval_count; memcpy(program->sysvals, ctx->sysvals.sysvals, sizeof(ctx->sysvals.sysvals[0]) * ctx->sysvals.sysval_count); + ctx->blend_types = program->blend_types; nir_foreach_function(func, nir) { if (!func->impl) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 1cbb211b778..3fc819c8afc 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -387,6 +387,7 @@ typedef struct { bi_block *break_block; bi_block *continue_block; bool emitted_atest; + nir_alu_type *blend_types; /* For creating temporaries */ unsigned temp_alloc; diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index 16d2a2b2f67..2d416ffeb21 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -86,6 +86,9 @@ typedef struct { int work_register_count; int uniform_cutoff; + /* For Bifrost - output type for each RT */ + nir_alu_type blend_types[8]; + /* Prepended before uniforms, mapping to SYSVAL_ names for the * sysval */ -- 2.30.2