panfrost: Assert that blend shaders are nontrivial
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 1 Aug 2022 22:57:55 +0000 (18:57 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sun, 21 Aug 2022 19:37:10 +0000 (19:37 +0000)
Even if the driver doesn't *use* trivial blend shaders, building and compiling
blend shaders is expensive. We shouldn't be building blend shaders that should
never be used.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17841>

src/panfrost/lib/pan_blend.c

index 11d3b7e..811b22e 100644 (file)
@@ -799,6 +799,10 @@ GENX(pan_blend_get_shader_locked)(const struct panfrost_device *dev,
                 .equation = state->rts[rt].equation,
         };
 
+        /* Blend shaders should only be used for blending on Bifrost onwards */
+        assert(dev->arch <= 5 || !pan_blend_is_opaque(state->rts[rt].equation));
+        assert(state->rts[rt].equation.color_mask != 0);
+
         struct hash_entry *he = _mesa_hash_table_search(dev->blend_shaders.shaders, &key);
         struct pan_blend_shader *shader = he ? he->data : NULL;