From 0309386e1dd8f89db8febd308dc8663edef4cecc Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Mon, 15 Jun 2015 14:42:24 -0700 Subject: Improve cleanup of failed mipmap gen and add correct sRGBs --- fix_mali_ktx.c | 1 + make_ktxes.sh | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fix_mali_ktx.c b/fix_mali_ktx.c index 4fbb45d..812b8f6 100644 --- a/fix_mali_ktx.c +++ b/fix_mali_ktx.c @@ -28,6 +28,7 @@ main(int argc, char* argv[]) #define GL_RGBA16F 0x881A #define GL_RGB16F 0x881B #define GL_SRGB8_ALPHA8 0x8C43 +#define GL_SRGB8 0x8C41 uint32_t d_hdr[5] = {GL_HALF_FLOAT, 2, diff --git a/make_ktxes.sh b/make_ktxes.sh index c967d9a..da1f706 100755 --- a/make_ktxes.sh +++ b/make_ktxes.sh @@ -200,11 +200,6 @@ function create_ktx_for_fmt { break fi - # Mali-decompressed HDR ASTCs have the wrong glInternalFormat; correct this. - if [ "$i" = "hdr" ]; then - $ktx_fix $outFileK > /dev/null - fi - # Wrap the compressed ASTC in a KTX. $ktx_gen $outFileA $outFileCK ${ASTC_2D_Enum[($n + $astc_fmt_array_offset)]} > /dev/null if [ ! -e "$outFileCK" ]; then @@ -221,9 +216,21 @@ function create_ktx_for_fmt { # Generate a mipmap from all the miplevel KTXs. if [ $failed -eq 0 ]; then $mip_gen $outDirC/ ../${outFileHead}.ktx - $mip_gen $outDirD/ ../${outFileHead}.ktx if [ ! -e "$outDirC/../${outFileHead}.ktx" ]; then echo "$mip_gen $outDirC/ ${inFileHead}.ktx" + rm $outDirC/${outFileHead}.ktx + fi + + $mip_gen $outDirD/ ../${outFileHead}.ktx + if [ ! -e "$outDirD/../${outFileHead}.ktx" ]; then + echo "$mip_gen $outDirD/ ${inFileHead}.ktx" + rm $outDirD/${outFileHead}.ktx + fi + + # Mali-decompressed sRGB & HDR ASTCs have the wrong glInternalFormat; correct this. + if [ "$i" = "hdr" -o "$i" = "ldrs" ]; then + $ktx_fix $outDirD/../${outFileHead}.ktx > /dev/null + #echo "$ktx_fix $outDirD/../${outFileHead}.ktx" fi # Delete the miplevels KTXs. -- cgit v1.2.3