llvm-c++11-narrowing-errors.patch 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. diff --git a/thirdparty/etcpak/BlockData.cpp b/thirdparty/etcpak/BlockData.cpp
  2. index bd738085f3..395b55246b 100644
  3. --- a/thirdparty/etcpak/BlockData.cpp
  4. +++ b/thirdparty/etcpak/BlockData.cpp
  5. @@ -334,10 +334,10 @@ static etcpak_force_inline void DecodeT( uint64_t block, uint32_t* dst, uint32_t
  6. const auto c3b = clampu8( cb1 - table59T58H[codeword] );
  7. const uint32_t col_tab[4] = {
  8. - cr0 | ( cg0 << 8 ) | ( cb0 << 16 ) | 0xFF000000,
  9. - c2r | ( c2g << 8 ) | ( c2b << 16 ) | 0xFF000000,
  10. - cr1 | ( cg1 << 8 ) | ( cb1 << 16 ) | 0xFF000000,
  11. - c3r | ( c3g << 8 ) | ( c3b << 16 ) | 0xFF000000
  12. + uint32_t(cr0 | ( cg0 << 8 ) | ( cb0 << 16 ) | 0xFF000000),
  13. + uint32_t(c2r | ( c2g << 8 ) | ( c2b << 16 ) | 0xFF000000),
  14. + uint32_t(cr1 | ( cg1 << 8 ) | ( cb1 << 16 ) | 0xFF000000),
  15. + uint32_t(c3r | ( c3g << 8 ) | ( c3b << 16 ) | 0xFF000000)
  16. };
  17. const uint32_t indexes = ( block >> 32 ) & 0xFFFFFFFF;
  18. @@ -389,10 +389,10 @@ static etcpak_force_inline void DecodeTAlpha( uint64_t block, uint64_t alpha, ui
  19. const auto c3b = clampu8( cb1 - table59T58H[codeword] );
  20. const uint32_t col_tab[4] = {
  21. - cr0 | ( cg0 << 8 ) | ( cb0 << 16 ),
  22. - c2r | ( c2g << 8 ) | ( c2b << 16 ),
  23. - cr1 | ( cg1 << 8 ) | ( cb1 << 16 ),
  24. - c3r | ( c3g << 8 ) | ( c3b << 16 )
  25. + uint32_t(cr0 | ( cg0 << 8 ) | ( cb0 << 16 )),
  26. + uint32_t(c2r | ( c2g << 8 ) | ( c2b << 16 )),
  27. + uint32_t(cr1 | ( cg1 << 8 ) | ( cb1 << 16 )),
  28. + uint32_t(c3r | ( c3g << 8 ) | ( c3b << 16 ))
  29. };
  30. const uint32_t indexes = ( block >> 32 ) & 0xFFFFFFFF;
  31. @@ -436,10 +436,10 @@ static etcpak_force_inline void DecodeH( uint64_t block, uint32_t* dst, uint32_t
  32. const auto codeword = codeword_hi | codeword_lo;
  33. const uint32_t col_tab[] = {
  34. - clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 ),
  35. - clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 ),
  36. - clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 ),
  37. - clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 )
  38. + uint32_t(clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 )),
  39. + uint32_t(clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 )),
  40. + uint32_t(clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 )),
  41. + uint32_t(clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 ))
  42. };
  43. for( uint8_t j = 0; j < 4; j++ )
  44. @@ -483,10 +483,10 @@ static etcpak_force_inline void DecodeHAlpha( uint64_t block, uint64_t alpha, ui
  45. const auto tbl = g_alpha[(alpha >> 48) & 0xF];
  46. const uint32_t col_tab[] = {
  47. - clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 ),
  48. - clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 ),
  49. - clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 ),
  50. - clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 )
  51. + uint32_t(clampu8( r0 + table59T58H[codeword] ) | ( clampu8( g0 + table59T58H[codeword] ) << 8 ) | ( clampu8( b0 + table59T58H[codeword] ) << 16 )),
  52. + uint32_t(clampu8( r0 - table59T58H[codeword] ) | ( clampu8( g0 - table59T58H[codeword] ) << 8 ) | ( clampu8( b0 - table59T58H[codeword] ) << 16 )),
  53. + uint32_t(clampu8( r1 + table59T58H[codeword] ) | ( clampu8( g1 + table59T58H[codeword] ) << 8 ) | ( clampu8( b1 + table59T58H[codeword] ) << 16 )),
  54. + uint32_t(clampu8( r1 - table59T58H[codeword] ) | ( clampu8( g1 - table59T58H[codeword] ) << 8 ) | ( clampu8( b1 - table59T58H[codeword] ) << 16 ))
  55. };
  56. for( uint8_t j = 0; j < 4; j++ )