From d16d1367341540074432a6561f383f4392e1523e Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Tue, 7 Jul 2020 15:06:08 +1200 Subject: [PATCH] panfrost: Stop keying on rt format when using native loads 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 Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 13 +++++++++++++ src/panfrost/util/pan_lower_framebuffer.c | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 27e2c35..56706a5 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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; } diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c index 6fdb969..22ad237 100644 --- a/src/panfrost/util/pan_lower_framebuffer.c +++ b/src/panfrost/util/pan_lower_framebuffer.c @@ -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]); -- 2.7.4