Mesa (master): freedreno/ir3: Fix incorrect optimization of usage of 16-bit constbuf vals.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 16 22:33:03 UTC 2020


Module: Mesa
Branch: master
Commit: 17db969f7a39c128bf02238a7a6f1243d78476f1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=17db969f7a39c128bf02238a7a6f1243d78476f1

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Nov 11 12:44:04 2020 -0800

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>

---

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



More information about the mesa-commit mailing list