From f487c0904594c2b9cc8bed7545c22ac1d0b30c4f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 13 Mar 2022 11:29:23 -0400 Subject: [PATCH] pan/bi: Make psiz variants Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 21 +++++++++++++++++++++ src/panfrost/util/pan_ir.h | 10 ++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 32a3691..a8beacc 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -4705,6 +4705,27 @@ bi_compile_variant(nir_shader *nir, info->work_reg_count = ctx->info.work_reg_count; } + if (idvs == BI_IDVS_POSITION && + nir->info.outputs_written & BITFIELD_BIT(VARYING_SLOT_PSIZ)) { + /* Find the psiz write */ + bi_instr *write = NULL; + + bi_foreach_instr_global(ctx, I) { + if (I->op == BI_OPCODE_STORE_I16 && I->seg == BI_SEG_POS) { + write = I; + break; + } + } + + assert(write != NULL); + + /* Remove it, TODO: DCE */ + bi_remove_instruction(write); + + info->vs.no_psiz_offset = binary->size; + bi_pack_valhall(ctx, binary); + } + ralloc_free(ctx); } diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index ffd1d85..5b5a001 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -278,6 +278,16 @@ struct pan_shader_info { struct { bool writes_point_size; + /* If the primary shader writes point size, the Valhall + * driver may need a variant that does not write point + * size. Offset to such a shader in the program binary. + * + * Zero if no such variant is required. + * + * Only used with IDVS on Valhall. + */ + unsigned no_psiz_offset; + /* Set if Index-Driven Vertex Shading is in use */ bool idvs; -- 2.7.4