pan/mdg: Implement condense_writemask for 8-bit
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 14 May 2020 17:29:54 +0000 (13:29 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 May 2020 17:49:14 +0000 (17:49 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5151>

src/panfrost/midgard/disassemble.c

index e97cee163a2719ddea400747c870f5931dd5d777..9758904fb6ec927c9c38bdf046bc9030d6ac14b9 100644 (file)
@@ -56,8 +56,17 @@ static inline unsigned
 condense_writemask(unsigned expanded_mask,
                    unsigned bits_per_component)
 {
-        if (bits_per_component == 8)
-                unreachable("XXX TODO: sort out how 8-bit constant encoding works");
+        if (bits_per_component == 8) {
+                /* Duplicate every bit to go from 8 to 16-channel wrmask */
+                unsigned omask = 0;
+
+                for (unsigned i = 0; i < 8; ++i) {
+                        if (expanded_mask & (1 << i))
+                                omask |= (3 << (2 * i));
+                }
+
+                return omask;
+        }
 
         unsigned slots_per_component = bits_per_component / 16;
         unsigned max_comp = (16 * 8) / bits_per_component;