From 36676e29eb1ba7dded56260bc75259e991a80692 Mon Sep 17 00:00:00 2001 From: richgel999 Date: Thu, 19 Sep 2019 13:42:40 -0700 Subject: [PATCH] When BASISD_SUPPORT_BC7 is defined and set to 0, we disable all the BC7 modes so the WebAssembly/Javascript transcoder doesn't get bloated. I'm going to disable BC7 mode 6 by default in the next minor update. --- transcoder/basisu_transcoder.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/transcoder/basisu_transcoder.cpp b/transcoder/basisu_transcoder.cpp index 0883c4f..56e892b 100644 --- a/transcoder/basisu_transcoder.cpp +++ b/transcoder/basisu_transcoder.cpp @@ -33,6 +33,16 @@ #define BASISD_SUPPORT_DXT5A 1 #endif +// Disable all BC7 transcoders if necessary (useful when cross compiling to Javascript) +#if defined(BASISD_SUPPORT_BC7) && !BASISD_SUPPORT_BC7 + #ifndef BASISD_SUPPORT_BC7_MODE6_OPAQUE_ONLY + #define BASISD_SUPPORT_BC7_MODE6_OPAQUE_ONLY 0 + #endif + #ifndef BASISD_SUPPORT_BC7_MODE5 + #define BASISD_SUPPORT_BC7_MODE5 0 + #endif +#endif // !BASISD_SUPPORT_BC7 + // BC7 mode 6 opaque only is the highest quality (compared to ETC1), but the tables are massive. // For web/mobile use you probably should disable this. #ifndef BASISD_SUPPORT_BC7_MODE6_OPAQUE_ONLY