[Mesa-dev] [PATCH 3/7] st/mesa: use st_compressed_format_fallback more
Marek Olšák
maraeo at gmail.com
Mon Jul 23 23:52:03 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/state_tracker/st_format.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
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
@@ -45,20 +45,21 @@
#include "main/macros.h"
#include "main/formatquery.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
#include "util/u_format.h"
#include "st_cb_texture.h"
#include "st_context.h"
#include "st_format.h"
+#include "st_texture.h"
/**
* Translate Mesa format to Gallium format.
*/
enum pipe_format
st_mesa_format_to_pipe_format(const struct st_context *st,
mesa_format mesaFormat)
{
struct pipe_screen *screen = st->pipe->screen;
@@ -1039,41 +1040,34 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
*/
static void
test_format_conversion(struct st_context *st)
{
GLuint i;
/* test all Mesa formats */
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);
if (pf != PIPE_FORMAT_NONE) {
mesa_format MAYBE_UNUSED mf = st_pipe_format_to_mesa_format(pf);
assert(mf == i);
}
}
/* 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) {
enum pipe_format MAYBE_UNUSED pf =
st_mesa_format_to_pipe_format(st, mf);
assert(pf == i);
}
}
}
@@ -2340,24 +2334,22 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
pTarget, 0, bindings, GL_TRUE);
if (pFormat == PIPE_FORMAT_NONE && !is_renderbuffer) {
/* try choosing format again, this time without render target bindings */
pFormat = st_choose_format(st, internalFormat, format, type,
pTarget, 0, PIPE_BIND_SAMPLER_VIEW,
GL_TRUE);
}
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 */
return MESA_FORMAT_NONE;
}
mFormat = st_pipe_format_to_mesa_format(pFormat);
/* Debugging aid */
if (0) {
--
2.17.1
More information about the mesa-dev
mailing list