panfrost: Stop keying on rt format when using native loads
authorIcecream95 <ixn@keemail.me>
Tue, 7 Jul 2020 03:06:08 +0000 (15:06 +1200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jul 2020 13:35:11 +0000 (13:35 +0000)
Native loads are the same for any format, so we can use the same
shader variant for all framebuffer formats with a native load.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

src/gallium/drivers/panfrost/pan_context.c
src/panfrost/util/pan_lower_framebuffer.c

index 27e2c35c61103086e119d5e1d706df5e98f0f3e6..56706a5fe46cd4e6a16d4b035d9bd6c3343b08d5 100644 (file)
@@ -54,6 +54,7 @@
 #include "pan_cmdstream.h"
 #include "pan_util.h"
 #include "pandecode/decode.h"
+#include "util/pan_lower_framebuffer.h"
 
 struct midgard_tiler_descriptor
 panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
@@ -681,6 +682,12 @@ panfrost_variant_matches(
                         if ((fb->nr_cbufs > i) && fb->cbufs[i])
                                 fmt = fb->cbufs[i]->format;
 
+                        const struct util_format_description *desc =
+                                util_format_description(fmt);
+
+                        if (pan_format_class_load(desc, dev->quirks) == PAN_FORMAT_NATIVE)
+                                fmt = PIPE_FORMAT_NONE;
+
                         if (variant->rt_formats[i] != fmt)
                                 return false;
                 }
@@ -806,6 +813,12 @@ panfrost_bind_shader_state(
                                 if ((fb->nr_cbufs > i) && fb->cbufs[i])
                                         fmt = fb->cbufs[i]->format;
 
+                                const struct util_format_description *desc =
+                                        util_format_description(fmt);
+
+                                if (pan_format_class_load(desc, dev->quirks) == PAN_FORMAT_NATIVE)
+                                        fmt = PIPE_FORMAT_NONE;
+
                                 v->rt_formats[i] = fmt;
                         }
 
index 6fdb9695b371481c050ac76574072bc3c7aefd02..22ad2379a3645f0bb60c0bd0e3042b894f0dd448 100644 (file)
@@ -726,6 +726,9 @@ pan_lower_framebuffer(nir_shader *shader, enum pipe_format *rt_fmts,
                                 else
                                         continue;
 
+                                if (rt_fmts[rt] == PIPE_FORMAT_NONE)
+                                        continue;
+
                                 const struct util_format_description *desc =
                                    util_format_description(rt_fmts[rt]);