mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 06:50:11 +01:00
mesa/st: implement fallback for s3tc
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Acked-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18180>
This commit is contained in:
parent
ac87b8a1eb
commit
be70018a23
2 changed files with 14 additions and 0 deletions
|
|
@ -46,6 +46,7 @@
|
||||||
#include "main/texcompress_astc.h"
|
#include "main/texcompress_astc.h"
|
||||||
#include "main/texcompress_bptc.h"
|
#include "main/texcompress_bptc.h"
|
||||||
#include "main/texcompress_etc.h"
|
#include "main/texcompress_etc.h"
|
||||||
|
#include "main/texcompress_s3tc.h"
|
||||||
#include "main/texgetimage.h"
|
#include "main/texgetimage.h"
|
||||||
#include "main/teximage.h"
|
#include "main/teximage.h"
|
||||||
#include "main/texobj.h"
|
#include "main/texobj.h"
|
||||||
|
|
@ -439,6 +440,8 @@ st_compressed_format_fallback(struct st_context *st, mesa_format format)
|
||||||
return !st->has_etc1;
|
return !st->has_etc1;
|
||||||
case MESA_FORMAT_LAYOUT_ETC2:
|
case MESA_FORMAT_LAYOUT_ETC2:
|
||||||
return !st->has_etc2;
|
return !st->has_etc2;
|
||||||
|
case MESA_FORMAT_LAYOUT_S3TC:
|
||||||
|
return !st->has_s3tc;
|
||||||
case MESA_FORMAT_LAYOUT_BPTC:
|
case MESA_FORMAT_LAYOUT_BPTC:
|
||||||
return !st->has_bptc;
|
return !st->has_bptc;
|
||||||
case MESA_FORMAT_LAYOUT_ASTC:
|
case MESA_FORMAT_LAYOUT_ASTC:
|
||||||
|
|
@ -635,6 +638,12 @@ st_UnmapTextureImage(struct gl_context *ctx,
|
||||||
itransfer->temp_stride,
|
itransfer->temp_stride,
|
||||||
transfer->box.width, transfer->box.height,
|
transfer->box.width, transfer->box.height,
|
||||||
texImage->TexFormat);
|
texImage->TexFormat);
|
||||||
|
} else if (_mesa_is_format_s3tc(texImage->TexFormat)) {
|
||||||
|
_mesa_unpack_s3tc(map, transfer->stride,
|
||||||
|
itransfer->temp_data,
|
||||||
|
itransfer->temp_stride,
|
||||||
|
transfer->box.width, transfer->box.height,
|
||||||
|
texImage->TexFormat);
|
||||||
} else if (_mesa_is_format_bptc(texImage->TexFormat)) {
|
} else if (_mesa_is_format_bptc(texImage->TexFormat)) {
|
||||||
_mesa_unpack_bptc(map, transfer->stride,
|
_mesa_unpack_bptc(map, transfer->stride,
|
||||||
itransfer->temp_data,
|
itransfer->temp_data,
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,11 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_mesa_is_format_s3tc(mesaFormat) && !st->has_s3tc) {
|
||||||
|
return _mesa_is_format_srgb(mesaFormat) ? PIPE_FORMAT_R8G8B8A8_SRGB :
|
||||||
|
PIPE_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
}
|
||||||
|
|
||||||
if (_mesa_is_format_bptc(mesaFormat) && !st->has_bptc) {
|
if (_mesa_is_format_bptc(mesaFormat) && !st->has_bptc) {
|
||||||
switch (mesaFormat) {
|
switch (mesaFormat) {
|
||||||
case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:
|
case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue