summaryrefslogtreecommitdiff
path: root/thirdparty/etcpak/patches/llvm-c++11-narrowing-errors.patch
blob: ab0d1e63a2b76e09c3289202765b7a32d847ed21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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++ )