u_box_2d_zslice(src_x, src_y, src_z, src_width, src_height, &box);
- if ((src_image && st_etc_fallback(st, src_image)) ||
- (dst_image && st_etc_fallback(st, dst_image))) {
+ if ((src_image && st_compressed_format_fallback(st, src_image->TexFormat)) ||
+ (dst_image && st_compressed_format_fallback(st, dst_image->TexFormat))) {
fallback_copy_image(st, dst_image, dst_res, dst_x, dst_y, orig_dst_z,
src_image, src_res, src_x, src_y, orig_src_z,
src_width, src_height);
}
bool
-st_etc_fallback(struct st_context *st, struct gl_texture_image *texImage)
+st_compressed_format_fallback(struct st_context *st, mesa_format format)
{
- return (_mesa_is_format_etc2(texImage->TexFormat) && !st->has_etc2) ||
- (texImage->TexFormat == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1);
+ if (format == MESA_FORMAT_ETC1_RGB8)
+ return !st->has_etc1;
+
+ if (_mesa_is_format_etc2(format))
+ return !st->has_etc2;
+
+ return false;
}
static void
{
struct gl_texture_image *texImage = &stImage->base;
- if (!st_etc_fallback(st, texImage))
+ if (!st_compressed_format_fallback(st, texImage->TexFormat))
return;
if (stImage->etc_data)
map = st_texture_image_map(st, stImage, transfer_flags, x, y, slice, w, h, 1,
&transfer);
if (map) {
- if (st_etc_fallback(st, texImage)) {
+ if (st_compressed_format_fallback(st, texImage->TexFormat)) {
/* ETC isn't supported by all gallium drivers, where it's represented
* by uncompressed formats. We store the compressed data (as it's
* needed for image copies in OES_copy_image), and decompress as
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
- if (st_etc_fallback(st, texImage)) {
- /* Decompress the ETC texture to the mapped one. */
+ if (st_compressed_format_fallback(st, texImage->TexFormat)) {
+ /* Decompress the compressed image on upload if the driver doesn't
+ * support the compressed format. */
unsigned z = slice + stImage->base.Face;
struct st_texture_image_transfer *itransfer = &stImage->transfer[z];
struct pipe_transfer *transfer = itransfer->transfer;
if (!_mesa_is_bufferobj(ctx->Unpack.BufferObj))
goto fallback;
- if (st_etc_fallback(st, texImage)) {
- /* ETC isn't supported and is represented by uncompressed formats. */
+ if (st_compressed_format_fallback(st, texImage->TexFormat))
goto fallback;
- }
if (!dst) {
goto fallback;