pan/bi: Fix CONVERT component counting
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 22:35:50 +0000 (18:35 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>

src/panfrost/bifrost/bir.c

index 5cdbda89bb88caa885897ca6cde9875f548df4ea..3ca57f66f0efde5a939f8049eea96e633f000520 100644 (file)
@@ -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;