panfrost: Simplify format class selection
This was made way more complicated than it needs to be for a Midgard-only pass. The only caller doesn't care about the class, only if it's native or not. Simplify it appropriately. It really isn't that hard. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14724>
This commit is contained in:
committed by
Marge Bot
parent
da9d6a643a
commit
5a8d86f69e
@@ -87,49 +87,23 @@ pan_unpacked_type_for_format(const struct util_format_description *desc)
|
||||
}
|
||||
}
|
||||
|
||||
static enum pan_format_class
|
||||
pan_format_class_load(const struct util_format_description *desc, unsigned quirks)
|
||||
{
|
||||
/* Pure integers can be loaded via EXT_framebuffer_fetch and should be
|
||||
* handled as a raw load with a size conversion (it's cheap). Likewise,
|
||||
* since float framebuffers are internally implemented as raw (i.e.
|
||||
* integer) framebuffers with blend shaders to go back and forth, they
|
||||
* should be s/w as well */
|
||||
|
||||
if (util_format_is_pure_integer(desc->format) || util_format_is_float(desc->format))
|
||||
return PAN_FORMAT_SOFTWARE;
|
||||
|
||||
/* Check if we can do anything better than software architecturally */
|
||||
if (quirks & MIDGARD_NO_TYPED_BLEND_LOADS) {
|
||||
return (quirks & NO_BLEND_PACKS)
|
||||
? PAN_FORMAT_SOFTWARE : PAN_FORMAT_PACK;
|
||||
}
|
||||
|
||||
/* Some formats are missing as typed but have unpacks */
|
||||
switch (desc->format) {
|
||||
case PIPE_FORMAT_R11G11B10_FLOAT:
|
||||
return PAN_FORMAT_PACK;
|
||||
default:
|
||||
return PAN_FORMAT_NATIVE;
|
||||
}
|
||||
}
|
||||
|
||||
static enum pan_format_class
|
||||
pan_format_class_store(const struct util_format_description *desc, unsigned quirks)
|
||||
{
|
||||
return (quirks & NO_BLEND_PACKS) ? PAN_FORMAT_SOFTWARE :
|
||||
PAN_FORMAT_PACK;
|
||||
}
|
||||
|
||||
/* Convenience method */
|
||||
|
||||
static enum pan_format_class
|
||||
pan_format_class(const struct util_format_description *desc, unsigned quirks, bool is_store)
|
||||
static bool
|
||||
pan_is_format_native(const struct util_format_description *desc, unsigned quirks, bool is_store)
|
||||
{
|
||||
if (is_store)
|
||||
return pan_format_class_store(desc, quirks);
|
||||
else
|
||||
return pan_format_class_load(desc, quirks);
|
||||
return false;
|
||||
|
||||
if (util_format_is_pure_integer(desc->format) || util_format_is_float(desc->format))
|
||||
return false;
|
||||
|
||||
if (quirks & MIDGARD_NO_TYPED_BLEND_LOADS)
|
||||
return false;
|
||||
|
||||
/* Some formats are missing as typed but have unpacks */
|
||||
if (desc->format == PIPE_FORMAT_R11G11B10_FLOAT)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Software packs/unpacks, by format class. Packs take in the pixel value typed
|
||||
@@ -619,11 +593,8 @@ pan_lower_framebuffer(nir_shader *shader, const enum pipe_format *rt_fmts,
|
||||
const struct util_format_description *desc =
|
||||
util_format_description(rt_fmts[rt]);
|
||||
|
||||
enum pan_format_class fmt_class =
|
||||
pan_format_class(desc, quirks, is_store);
|
||||
|
||||
/* Don't lower */
|
||||
if (fmt_class == PAN_FORMAT_NATIVE)
|
||||
if (pan_is_format_native(desc, quirks, is_store))
|
||||
continue;
|
||||
|
||||
/* EXT_shader_framebuffer_fetch requires
|
||||
|
||||
@@ -30,15 +30,6 @@
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "util/format/u_format.h"
|
||||
|
||||
/* NATIVE formats can use a typed load/store. PACK formats cannot but can use a
|
||||
* typed pack/unpack instruction. SOFTWARE formats are lowered */
|
||||
|
||||
enum pan_format_class {
|
||||
PAN_FORMAT_NATIVE,
|
||||
PAN_FORMAT_PACK,
|
||||
PAN_FORMAT_SOFTWARE
|
||||
};
|
||||
|
||||
nir_alu_type pan_unpacked_type_for_format(const struct util_format_description *desc);
|
||||
|
||||
bool pan_lower_framebuffer(nir_shader *shader,
|
||||
|
||||
Reference in New Issue
Block a user