From 17db969f7a39c128bf02238a7a6f1243d78476f1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 11 Nov 2020 12:44:04 -0800 Subject: [PATCH] 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: --- src/freedreno/ir3/ir3_cp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c index 12c0433cca3..841de864bea 100644 --- a/src/freedreno/ir3/ir3_cp.c +++ b/src/freedreno/ir3/ir3_cp.c @@ -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);