diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/dds/texture_loader_dds.cpp | 2 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.cpp | 19 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.h | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index da895a6d69..71593ebfa9 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -76,8 +76,6 @@ static const DDSFormatInfo dds_format_info[DDS_MAX] = { { "DXT1", true, false, 4, 8, Image::FORMAT_DXT1 }, { "DXT3", true, false, 4, 16, Image::FORMAT_DXT3 }, { "DXT5", true, false, 4, 16, Image::FORMAT_DXT5 }, - { "ATI1", true, false, 4, 8, Image::FORMAT_LATC_L }, - { "ATI2", true, false, 4, 16, Image::FORMAT_LATC_LA }, { "BGRA8", false, false, 1, 4, Image::FORMAT_RGBA8 }, { "BGR8", false, false, 1, 3, Image::FORMAT_RGB8 }, { "RGBA8", false, false, 1, 4, Image::FORMAT_RGBA8 }, diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 2427dac8a7..efed0b8665 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -59,9 +59,9 @@ void image_decompress_squish(Image *p_image) { squish_flags = squish::kDxt3; } else if (p_image->get_format() == Image::FORMAT_DXT5) { squish_flags = squish::kDxt5; - } else if (p_image->get_format() == Image::FORMAT_LATC_L || p_image->get_format() == Image::FORMAT_RGTC_R) { + } else if (p_image->get_format() == Image::FORMAT_RGTC_R) { squish_flags = squish::kBc4; - } else if (p_image->get_format() == Image::FORMAT_LATC_LA || p_image->get_format() == Image::FORMAT_RGTC_RG) { + } else if (p_image->get_format() == Image::FORMAT_RGTC_RG) { squish_flags = squish::kBc5; } else { ERR_FAIL_COND(true); @@ -79,7 +79,7 @@ void image_decompress_squish(Image *p_image) { p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } -void image_compress_squish(Image *p_image) { +void image_compress_squish(Image *p_image, bool p_srgb) { if (p_image->get_format() >= Image::FORMAT_DXT1) return; //do not compress, already compressed @@ -96,16 +96,21 @@ void image_compress_squish(Image *p_image) { p_image->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert + if (p_srgb && (dc == Image::DETECTED_R || dc == Image::DETECTED_RG)) { + //R and RG do not support SRGB + dc = Image::DETECTED_RGB; + } + switch (dc) { case Image::DETECTED_L: { - target_format = Image::FORMAT_LATC_L; - squish_comp |= squish::kBc4; + target_format = Image::FORMAT_DXT1; + squish_comp |= squish::kDxt1; } break; case Image::DETECTED_LA: { - target_format = Image::FORMAT_LATC_LA; - squish_comp |= squish::kBc5; + target_format = Image::FORMAT_DXT5; + squish_comp |= squish::kDxt5; } break; case Image::DETECTED_R: { diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h index 519e3537ef..8d859b8e0b 100644 --- a/modules/squish/image_compress_squish.h +++ b/modules/squish/image_compress_squish.h @@ -32,7 +32,7 @@ #include "image.h" -void image_compress_squish(Image *p_image); +void image_compress_squish(Image *p_image, bool p_srgb); void image_decompress_squish(Image *p_image); #endif // IMAGE_COMPRESS_SQUISH_H |