freedreno/ir3: Fix incorrect optimization of usage of 16-bit constbuf vals.

If you're loading a 32b word from the const file and doing a cov.u32u16
split to two 16bit values, we can't turn that into a reference of a 16-bit
float value directly from the constbuf, because the
CONSTANT_DEMOTION_ENABLE results in a f2f16 operation on the 32-bit value
that we didn't want.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5810>
This commit is contained in:
Eric Anholt
2020-11-11 12:44:04 -08:00
parent 386998cfbf
commit 17db969f7a

View File

@@ -393,6 +393,13 @@ reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr,
return false;
if (!is_cat2_float(instr->opc) && !is_cat3_float(instr->opc))
return false;
} else if (src->cat1.dst_type == TYPE_U16) {
/* Since we set CONSTANT_DEMOTION_ENABLE, a float reference of
* what was a U16 value read from the constbuf would incorrectly
* do 32f->16f conversion, when we want to read a 16f value.
*/
if (is_cat2_float(instr->opc) || is_cat3_float(instr->opc))
return false;
}
src_reg = ir3_reg_clone(instr->block->shader, src_reg);