map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1,
&transfer);
if (map) {
- if (_mesa_is_format_etc2(texImage->TexFormat) ||
+ if ((_mesa_is_format_etc2(texImage->TexFormat) && !st->has_etc2) ||
(texImage->TexFormat == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1)) {
/* ETC isn't supported by gallium and it's represented
* by uncompressed formats. Only write transfers with precompressed
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
- if (_mesa_is_format_etc2(texImage->TexFormat) ||
+ if ((_mesa_is_format_etc2(texImage->TexFormat) && !st->has_etc2) ||
(texImage->TexFormat == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1)) {
/* Decompress the ETC texture to the mapped one. */
unsigned z = slice + stImage->base.Face;
* The destination formats mustn't be changed, because they are also
* destination formats of the unpack/decompression function. */
case MESA_FORMAT_ETC2_RGB8:
- case MESA_FORMAT_ETC2_RGBA8_EAC:
- case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1:
- return PIPE_FORMAT_R8G8B8A8_UNORM;
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_RGB8 : PIPE_FORMAT_R8G8B8A8_UNORM;
case MESA_FORMAT_ETC2_SRGB8:
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_SRGB8 : PIPE_FORMAT_B8G8R8A8_SRGB;
+ case MESA_FORMAT_ETC2_RGBA8_EAC:
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_RGBA8 : PIPE_FORMAT_R8G8B8A8_UNORM;
case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
- case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
- return PIPE_FORMAT_B8G8R8A8_SRGB;
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_SRGBA8 : PIPE_FORMAT_B8G8R8A8_SRGB;
case MESA_FORMAT_ETC2_R11_EAC:
- return PIPE_FORMAT_R16_UNORM;
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_R11_UNORM : PIPE_FORMAT_R16_UNORM;
case MESA_FORMAT_ETC2_RG11_EAC:
- return PIPE_FORMAT_R16G16_UNORM;
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_RG11_UNORM : PIPE_FORMAT_R16G16_UNORM;
case MESA_FORMAT_ETC2_SIGNED_R11_EAC:
- return PIPE_FORMAT_R16_SNORM;
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_R11_SNORM : PIPE_FORMAT_R16_SNORM;
case MESA_FORMAT_ETC2_SIGNED_RG11_EAC:
- return PIPE_FORMAT_R16G16_SNORM;
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_RG11_SNORM : PIPE_FORMAT_R16G16_SNORM;
+ case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1:
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_RGB8A1 : PIPE_FORMAT_R8G8B8A8_UNORM;
+ case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
+ return st->has_etc2 ? PIPE_FORMAT_ETC2_SRGB8A1 : PIPE_FORMAT_B8G8R8A8_SRGB;
default:
return PIPE_FORMAT_NONE;
case PIPE_FORMAT_XRGB8888_SRGB:
return MESA_FORMAT_X8R8G8B8_SRGB;
+ case PIPE_FORMAT_ETC2_RGB8:
+ return MESA_FORMAT_ETC2_RGB8;
+ case PIPE_FORMAT_ETC2_SRGB8:
+ return MESA_FORMAT_ETC2_SRGB8;
+ case PIPE_FORMAT_ETC2_RGB8A1:
+ return MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
+ case PIPE_FORMAT_ETC2_SRGB8A1:
+ return MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1;
+ case PIPE_FORMAT_ETC2_RGBA8:
+ return MESA_FORMAT_ETC2_RGBA8_EAC;
+ case PIPE_FORMAT_ETC2_SRGBA8:
+ return MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC;
+ case PIPE_FORMAT_ETC2_R11_UNORM:
+ return MESA_FORMAT_ETC2_R11_EAC;
+ case PIPE_FORMAT_ETC2_R11_SNORM:
+ return MESA_FORMAT_ETC2_SIGNED_R11_EAC;
+ case PIPE_FORMAT_ETC2_RG11_UNORM:
+ return MESA_FORMAT_ETC2_RG11_EAC;
+ case PIPE_FORMAT_ETC2_RG11_SNORM:
+ return MESA_FORMAT_ETC2_SIGNED_RG11_EAC;
+
default:
return MESA_FORMAT_NONE;
}