pan/bi: Flesh out st_vary IR
[mesa.git] / src / panfrost / bifrost / bir.c
index 5de9d30fe30fa91e22078ba75ed56a0384afa5aa..c385cfe7587c71f3fe2c515e6a2165068b2aea06 100644 (file)
@@ -93,10 +93,10 @@ bi_from_bytemask(uint16_t bytemask, unsigned bytes)
 }
 
 unsigned
-bi_get_component_count(bi_instruction *ins)
+bi_get_component_count(bi_instruction *ins, unsigned src)
 {
         if (bi_class_props[ins->type] & BI_VECTOR) {
-                return 4;
+                return (src == 0) ? 4 : 1;
         } else {
                 /* Stores imply VECTOR */
                 assert(ins->dest_type);
@@ -119,10 +119,10 @@ uint16_t
 bi_bytemask_of_read_components(bi_instruction *ins, unsigned node)
 {
         uint16_t mask = 0x0;
-        unsigned component_count = bi_get_component_count(ins);
 
         bi_foreach_src(ins, s) {
                 if (ins->src[s] != node) continue;
+                unsigned component_count = bi_get_component_count(ins, s);
                 nir_alu_type T = ins->src_types[s];
                 unsigned size = nir_alu_type_get_type_size(T);
                 unsigned bytes = (MAX2(size, 8) / 8);