|
4 | 4 | #include <cmath> |
5 | 5 | #include <cstdlib> |
6 | 6 | #include <cstdio> |
7 | | -#if defined(USE_LIBSQUISH) && !defined(HEADLESS) |
8 | | - #include "lib/squish/squish.h" |
9 | | - #include "lib/rg-etc1/rg_etc1.h" |
10 | | -#endif |
11 | 7 |
|
12 | 8 | #include "SMFGroundTextures.h" |
13 | 9 | #include "SMFFormat.h" |
@@ -167,16 +163,11 @@ void CSMFGroundTextures::LoadTiles(CSMFMapFile& file) |
167 | 163 | swabDWordInPlace(tileMap[i]); |
168 | 164 | } |
169 | 165 |
|
170 | | -#if defined(USE_LIBSQUISH) && !defined(HEADLESS) && defined(GLEW_ARB_ES3_compatibility) |
171 | | - if (RecompressTilesIfNeeded()) { |
172 | | - // Not all FOSS drivers support S3TC, use ETC1 for those if possible |
173 | | - // ETC2 is backward compatible with ETC1! GLEW doesn't have the ETC1 extension :< |
174 | | - tileTexFormat = GL_COMPRESSED_RGB8_ETC2; |
175 | | - } else |
176 | | -#endif |
177 | | - { |
178 | | - tileTexFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; |
179 | | - } |
| 166 | + // ETCx is nicer than S3TC (when in hardware) although it lacks alpha support, |
| 167 | + // but recompressing the DXT tiles has little benefit since FOSS drivers also |
| 168 | + // implement S3TC now |
| 169 | + // (recompression quality would have to be low anyway for performance reasons) |
| 170 | + tileTexFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; |
180 | 171 | } |
181 | 172 |
|
182 | 173 | void CSMFGroundTextures::LoadSquareTextures(const int mipLevel) |
@@ -258,38 +249,6 @@ void CSMFGroundTextures::ConvolveHeightMap(const int mapWidth, const int mipLeve |
258 | 249 | } |
259 | 250 | } |
260 | 251 |
|
261 | | -#if defined(USE_LIBSQUISH) && !defined(HEADLESS) && defined(GLEW_ARB_ES3_compatibility) |
262 | | -// Not all FOSS drivers support S3TC, use ETC1 for those if possible |
263 | | -bool CSMFGroundTextures::RecompressTilesIfNeeded() |
264 | | -{ |
265 | | - // if DXT1 is supported, we don't need to recompress |
266 | | - if (GLEW_EXT_texture_compression_s3tc || GLEW_EXT_texture_compression_dxt1) |
267 | | - return false; |
268 | | - |
269 | | - // check if ETC1/2 is supported |
270 | | - if (!GLEW_ARB_ES3_compatibility) |
271 | | - return false; |
272 | | - |
273 | | - // note 1: Mesa should support this |
274 | | - // note 2: Nvidia supports ETC but preprocesses the texture (on the CPU) each upload = slow -> makes no sense to add it as another map compression format |
275 | | - // note 3: for both DXT1 & ETC1/2 blocksize is 8 bytes per 4x4 pixel block -> perfect for us :) |
276 | | - |
277 | | - loadscreen->SetLoadMessage("Recompressing Map Tiles with ETC1"); |
278 | | - Watchdog::ClearTimer(WDT_MAIN); |
279 | | - |
280 | | - rg_etc1::pack_etc1_block_init(); |
281 | | - rg_etc1::etc1_pack_params pack_params; |
282 | | - pack_params.m_quality = rg_etc1::cLowQuality; // must be low, all others take _ages_ to process |
283 | | - |
284 | | - for_mt(0, tiles.size() / 8, [&](const int i) { |
285 | | - squish::u8 rgba[64]; // 4x4 pixels * 4 * 1byte channels = 64byte |
286 | | - squish::Decompress(rgba, &tiles[i * 8], squish::kDxt1); |
287 | | - rg_etc1::pack_etc1_block(&tiles[i * 8], (const unsigned int*)rgba, pack_params); |
288 | | - }); |
289 | | - |
290 | | - return true; |
291 | | -} |
292 | | -#endif |
293 | 252 |
|
294 | 253 | inline bool CSMFGroundTextures::TexSquareInView(int btx, int bty) const |
295 | 254 | { |
|
0 commit comments