ir3: disallow .sat on SEL instructions

Saturation is unsupported on SEL instructions.

Fixes main menu rendering in Genshin Impact.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9666>
This commit is contained in:
Danylo Piliaiev 2021-03-17 21:39:47 +02:00 committed by Marge Bot
parent 6cff8ec5a6
commit 9efec45b0c
2 changed files with 22 additions and 5 deletions

View File

@ -1040,6 +1040,26 @@ static inline bool instr_sat(instr_t *instr)
}
}
static inline bool is_sat_compatible(opc_t opc)
{
/* TODO probably opc_cat==4 is ok too */
if (opc_cat(opc) != 2 && opc_cat(opc) != 3)
return false;
switch (opc) {
case OPC_BARY_F:
case OPC_SEL_B16:
case OPC_SEL_B32:
case OPC_SEL_S16:
case OPC_SEL_S32:
case OPC_SEL_F16:
case OPC_SEL_F32:
return false;
default:
return true;
}
}
/* We can probably drop the gpu_id arg, but keeping it for now so we can
* assert if we see something we think should be new encoding on an older
* gpu.

View File

@ -433,13 +433,10 @@ emit_alu(struct ir3_context *ctx, nir_alu_instr *alu)
* NOTE: a3xx definitely seen not working with flat bary.f. Same test
* uses ldlv on a4xx+, so not definitive. Seems rare enough to apply
* everywhere.
*
* TODO probably opc_cat==4 is ok too
*/
if (alu->src[0].src.is_ssa &&
src[0]->opc != OPC_BARY_F &&
(list_length(&alu->src[0].src.ssa->uses) == 1) &&
((opc_cat(src[0]->opc) == 2) || (opc_cat(src[0]->opc) == 3))) {
is_sat_compatible(src[0]->opc) &&
(list_length(&alu->src[0].src.ssa->uses) == 1)) {
src[0]->flags |= IR3_INSTR_SAT;
dst[0] = ir3_MOV(b, src[0], dst_type);
} else {