summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-07-07 23:46:28 -0400
committerIlia Mirkin <[email protected]>2016-07-11 21:17:30 -0400
commit00d4315d37ec736fccfee50a402fa2a929054bde (patch)
tree9f0d1d2abdc9a0842e07073e9f24f484da111c0f
parent8ee3cdde049d30095451f44080a9cd2d6e949459 (diff)
st/mesa: return appropriate mesa format for ETC texture formats
Even when the backend driver does not support ETC formats, we handle the decoding into an uncompressed backing texture. However as far as core mesa is concerned, it's an ETC texture and we should return the relevant ETC mesa format. This condition can get hit when using glTexStorage to create the texture object. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Cc: "11.2 12.0" <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_format.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index acb7725ab69..99527b74bab 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -37,6 +37,7 @@
#include "main/enums.h"
#include "main/formats.h"
#include "main/glformats.h"
+#include "main/texcompress.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
#include "main/texstore.h"
@@ -2284,6 +2285,12 @@ 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))
+ return mFormat;
+
/* no luck at all */
return MESA_FORMAT_NONE;
}