#include "main/pbo.h"
#include "main/pixeltransfer.h"
#include "main/texcompress.h"
+#include "main/texcompress_astc.h"
#include "main/texcompress_etc.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
if (_mesa_is_format_etc2(format))
return !st->has_etc2;
+ if (_mesa_is_format_astc_2d(format))
+ return !st->has_astc_2d_ldr;
+
return false;
}
itransfer->temp_data,
itransfer->temp_stride,
transfer->box.width, transfer->box.height);
- }
- else {
+ } else if (_mesa_is_format_etc2(texImage->TexFormat)) {
bool bgra = stImage->pt->format == PIPE_FORMAT_B8G8R8A8_SRGB;
_mesa_unpack_etc2_format(itransfer->map, transfer->stride,
itransfer->temp_data, itransfer->temp_stride,
transfer->box.width, transfer->box.height,
texImage->TexFormat,
bgra);
+ } else if (_mesa_is_format_astc_2d(texImage->TexFormat)) {
+ _mesa_unpack_astc_2d_ldr(itransfer->map, transfer->stride,
+ itransfer->temp_data, itransfer->temp_stride,
+ transfer->box.width, transfer->box.height,
+ texImage->TexFormat);
+ } else {
+ unreachable("unexpected format for a compressed format fallback");
}
}
dst_level = texImage->TexObject->MinLevel + texImage->Level;
assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
+ !_mesa_is_format_astc_2d(texImage->TexFormat) &&
texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
if (!dst)
boolean done = FALSE;
assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
+ !_mesa_is_format_astc_2d(texImage->TexFormat) &&
texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
+ !_mesa_is_format_astc_2d(texImage->TexFormat) &&
texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
if (!strb || !strb->surface || !stImage->pt) {
has_bgra_srgb ? PIPE_FORMAT_B8G8R8A8_SRGB : PIPE_FORMAT_R8G8B8A8_SRGB;
case MESA_FORMAT_RGBA_ASTC_4x4:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_4x4;
case MESA_FORMAT_RGBA_ASTC_5x4:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_5x4;
case MESA_FORMAT_RGBA_ASTC_5x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_5x5;
case MESA_FORMAT_RGBA_ASTC_6x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_6x5;
case MESA_FORMAT_RGBA_ASTC_6x6:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_6x6;
case MESA_FORMAT_RGBA_ASTC_8x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_8x5;
case MESA_FORMAT_RGBA_ASTC_8x6:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_8x6;
case MESA_FORMAT_RGBA_ASTC_8x8:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_8x8;
case MESA_FORMAT_RGBA_ASTC_10x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_10x5;
case MESA_FORMAT_RGBA_ASTC_10x6:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_10x6;
case MESA_FORMAT_RGBA_ASTC_10x8:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_10x8;
case MESA_FORMAT_RGBA_ASTC_10x10:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_10x10;
case MESA_FORMAT_RGBA_ASTC_12x10:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_12x10;
case MESA_FORMAT_RGBA_ASTC_12x12:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_UNORM;
return PIPE_FORMAT_ASTC_12x12;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_4x4_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_5x4_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_5x5_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_6x5_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_6x6_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_8x5_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_8x6_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_8x8_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_10x5_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_10x6_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_10x8_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_10x10_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_12x10_SRGB;
case MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12:
+ if (!st->has_astc_2d_ldr)
+ return PIPE_FORMAT_R8G8B8A8_SRGB;
return PIPE_FORMAT_ASTC_12x12_SRGB;
default: