pan/bi: Make psiz variants

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15793>
This commit is contained in:
Alyssa Rosenzweig 2022-03-13 11:29:23 -04:00 committed by Marge Bot
parent 9497a6a3c9
commit f487c09045
2 changed files with 31 additions and 0 deletions

View file

@ -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);
}

View file

@ -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;