From 1cdd55a81ea14df39608ef38bd6acb77369f9de1 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 27 May 2020 18:35:50 -0400 Subject: [PATCH] pan/bi: Fix CONVERT component counting Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bir.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c index 5cdbda89bb8..3ca57f66f0e 100644 --- a/src/panfrost/bifrost/bir.c +++ b/src/panfrost/bifrost/bir.c @@ -105,7 +105,16 @@ bi_get_component_count(bi_instruction *ins, signed src) assert(ins->vector_channels); return (src <= 0) ? ins->vector_channels : 1; } else { - unsigned bytes = nir_alu_type_get_type_size(src < 0 ? ins->dest_type : ins->src_types[src]); + unsigned dest_bytes = nir_alu_type_get_type_size(ins->dest_type); + unsigned src_bytes = nir_alu_type_get_type_size(ins->src_types[src]); + + /* If there's either f32 on either end, it's only a single + * component, etc. */ + + unsigned bytes = src < 0 ? dest_bytes : src_bytes; + + if (ins->type == BI_CONVERT) + bytes = MAX2(dest_bytes, src_bytes); if (ins->type == BI_ATEST || ins->type == BI_SELECT) return 1; -- 2.30.2