summaryrefslogtreecommitdiff
path: root/thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch')
-rw-r--r--thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch b/thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch
new file mode 100644
index 0000000000..ab0d1e63a2
--- /dev/null
+++ b/thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch
@@ -0,0 +1,64 @@
+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++ )