d840165a32
- `etc` module was renamed to `etcpak` and modified to use the new library. - PKM importer is removed in the process, it's obsolete. - Old library `etc2comp` is removed. - S3TC compression no longer done via `squish` (but decompression still is). - Slight modifications to etcpak sources for MinGW compatibility, to fix LLVM `-Wc++11-narrowing` errors, and to allow using vendored or system libpng. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
64 lines
4.4 KiB
Diff
64 lines
4.4 KiB
Diff
diff --git a/thirdparty/etcpak/BlockData.cpp b/thirdparty/etcpak/BlockData.cpp
|
|
index bd738085f3..395b55246b 100644
|
|
--- a/thirdparty/etcpak/BlockData.cpp
|
|
+++ b/thirdparty/etcpak/BlockData.cpp
|
|
@@ -334,10 +334,10 @@ static etcpak_force_inline void DecodeT( uint64_t block, uint32_t* dst, uint32_t
|
|
const auto c3b = clampu8( cb1 - table59T58H[codeword] );
|
|
|
|
const uint32_t col_tab[4] = {
|
|
- cr0 | ( cg0 << 8 ) | ( cb0 << 16 ) | 0xFF000000,
|
|
- c2r | ( c2g << 8 ) | ( c2b << 16 ) | 0xFF000000,
|
|
- cr1 | ( cg1 << 8 ) | ( cb1 << 16 ) | 0xFF000000,
|
|
- c3r | ( c3g << 8 ) | ( c3b << 16 ) | 0xFF000000
|
|
+ uint32_t(cr0 | ( cg0 << 8 ) | ( cb0 << 16 ) | 0xFF000000),
|
|
+ uint32_t(c2r | ( c2g << 8 ) | ( c2b << 16 ) | 0xFF000000),
|
|
+ uint32_t(cr1 | ( cg1 << 8 ) | ( cb1 << 16 ) | 0xFF000000),
|
|
+ uint32_t(c3r | ( c3g << 8 ) | ( c3b << 16 ) | 0xFF000000)
|
|
};
|
|
|
|
const uint32_t indexes = ( block >> 32 ) & 0xFFFFFFFF;
|
|
@@ -389,10 +389,10 @@ static etcpak_force_inline void DecodeTAlpha( uint64_t block, uint64_t alpha, ui
|
|
const auto c3b = clampu8( cb1 - table59T58H[codeword] );
|
|
|
|
const uint32_t col_tab[4] = {
|
|
- cr0 | ( cg0 << 8 ) | ( cb0 << 16 ),
|
|
- c2r | ( c2g << 8 ) | ( c2b << 16 ),
|
|
- cr1 | ( cg1 << 8 ) | ( cb1 << 16 ),
|
|
- c3r | ( c3g << 8 ) | ( c3b << 16 )
|
|
+ uint32_t(cr0 | ( cg0 << 8 ) | ( cb0 << 16 )),
|
|
+ uint32_t(c2r | ( c2g << 8 ) | ( c2b << 16 )),
|
|
+ uint32_t(cr1 | ( cg1 << 8 ) | ( cb1 << 16 )),
|
|
+ uint32_t(c3r | ( c3g << 8 ) | ( c3b << 16 ))
|
|
};
|
|
|
|
const uint32_t indexes = ( block >> 32 ) & 0xFFFFFFFF;
|
|
@@ -436,10 +436,10 @@ static etcpak_force_inline void DecodeH( uint64_t block, uint32_t* dst, uint32_t
|
|
const auto codeword = codeword_hi | codeword_lo;
|
|
|
|
const uint32_t col_tab[] = {
|
|
- clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 ),
|
|
- clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 ),
|
|
- clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 ),
|
|
- clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 )
|
|
+ uint32_t(clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 )),
|
|
+ uint32_t(clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 )),
|
|
+ uint32_t(clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 )),
|
|
+ uint32_t(clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 ))
|
|
};
|
|
|
|
for( uint8_t j = 0; j < 4; j++ )
|
|
@@ -483,10 +483,10 @@ static etcpak_force_inline void DecodeHAlpha( uint64_t block, uint64_t alpha, ui
|
|
const auto tbl = g_alpha[(alpha >> 48) & 0xF];
|
|
|
|
const uint32_t col_tab[] = {
|
|
- clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 ),
|
|
- clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 ),
|
|
- clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 ),
|
|
- clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 )
|
|
+ uint32_t(clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 )),
|
|
+ uint32_t(clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 )),
|
|
+ uint32_t(clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 )),
|
|
+ uint32_t(clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 ))
|
|
};
|
|
|
|
for( uint8_t j = 0; j < 4; j++ )
|