From: Marek Olšák Date: Tue, 13 Feb 2018 03:19:05 +0000 (+0100) Subject: st/mesa: use st_compressed_format_fallback more X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d7e4311bffe87125b40e95d6a77343e098ca9d4;p=mesa.git st/mesa: use st_compressed_format_fallback more Tested-by: Mike Lothian Tested-By: Gert Wollny Tested-by: Dieter Nützel Reviewed-By: Gert Wollny --- diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 9ae796eca9e..45513e8683e 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -52,6 +52,7 @@ #include "st_cb_texture.h" #include "st_context.h" #include "st_format.h" +#include "st_texture.h" /** @@ -1046,10 +1047,7 @@ test_format_conversion(struct st_context *st) for (i = 1; i < MESA_FORMAT_COUNT; i++) { enum pipe_format pf; - /* ETC formats are translated differently, skip them. */ - if (_mesa_is_format_etc2(i)) - continue; - if (i == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1) + if (st_compressed_format_fallback(st, i)) continue; pf = st_mesa_format_to_pipe_format(st, i); @@ -1061,12 +1059,8 @@ test_format_conversion(struct st_context *st) /* Test all Gallium formats */ for (i = 1; i < PIPE_FORMAT_COUNT; i++) { - /* ETC formats are translated differently, skip them. */ - if (i == PIPE_FORMAT_ETC1_RGB8 && !st->has_etc1) - continue; - mesa_format mf = st_pipe_format_to_mesa_format(i); - if (_mesa_is_format_etc2(mf) && !st->has_etc2) + if (st_compressed_format_fallback(st, mf)) continue; if (mf != MESA_FORMAT_NONE) { @@ -2347,10 +2341,8 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target, } if (pFormat == PIPE_FORMAT_NONE) { - /* lie about using etc1/etc2 natively if we do decoding tricks */ mFormat = _mesa_glenum_to_compressed_format(internalFormat); - if ((mFormat == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1) || - (_mesa_is_format_etc2(mFormat) && !st->has_etc2)) + if (st_compressed_format_fallback(st, mFormat)) return mFormat; /* no luck at all */