diff options
| author | 2019-11-08 17:08:07 -0300 | |
|---|---|---|
| committer | 2019-11-08 22:48:50 +0000 | |
| commit | 096f339a2a817054c9e2dfef188a5e2470126236 (patch) | |
| tree | 83b293c8ca82a1b6052c6d20063550fd92f10c61 /src/video_core/textures/astc.cpp | |
| parent | microprofile: Silence conversion warnings (diff) | |
| download | yuzu-096f339a2a817054c9e2dfef188a5e2470126236.tar.gz yuzu-096f339a2a817054c9e2dfef188a5e2470126236.tar.xz yuzu-096f339a2a817054c9e2dfef188a5e2470126236.zip | |
video_core: Silence implicit conversion warnings
Diffstat (limited to 'src/video_core/textures/astc.cpp')
| -rw-r--r-- | src/video_core/textures/astc.cpp | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index 58b608a36..33bd31865 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -92,11 +92,11 @@ private: | |||
| 92 | const unsigned int mask = 1 << m_NextBit++; | 92 | const unsigned int mask = 1 << m_NextBit++; |
| 93 | 93 | ||
| 94 | // clear the bit | 94 | // clear the bit |
| 95 | *m_CurByte &= ~mask; | 95 | *m_CurByte &= static_cast<unsigned char>(~mask); |
| 96 | 96 | ||
| 97 | // Write the bit, if necessary | 97 | // Write the bit, if necessary |
| 98 | if (b) | 98 | if (b) |
| 99 | *m_CurByte |= mask; | 99 | *m_CurByte |= static_cast<unsigned char>(mask); |
| 100 | 100 | ||
| 101 | // Next byte? | 101 | // Next byte? |
| 102 | if (m_NextBit >= 8) { | 102 | if (m_NextBit >= 8) { |
| @@ -137,7 +137,7 @@ public: | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | uint64_t mask = (1 << (end - start + 1)) - 1; | 139 | uint64_t mask = (1 << (end - start + 1)) - 1; |
| 140 | return (m_Bits >> start) & mask; | 140 | return (m_Bits >> start) & static_cast<IntType>(mask); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | private: | 143 | private: |
| @@ -656,7 +656,7 @@ static IntType Replicate(const IntType& val, uint32_t numBits, uint32_t toBit) { | |||
| 656 | return 0; | 656 | return 0; |
| 657 | if (toBit == 0) | 657 | if (toBit == 0) |
| 658 | return 0; | 658 | return 0; |
| 659 | IntType v = val & ((1 << numBits) - 1); | 659 | IntType v = val & static_cast<IntType>((1 << numBits) - 1); |
| 660 | IntType res = v; | 660 | IntType res = v; |
| 661 | uint32_t reslen = numBits; | 661 | uint32_t reslen = numBits; |
| 662 | while (reslen < toBit) { | 662 | while (reslen < toBit) { |
| @@ -666,8 +666,8 @@ static IntType Replicate(const IntType& val, uint32_t numBits, uint32_t toBit) { | |||
| 666 | comp = numBits - newshift; | 666 | comp = numBits - newshift; |
| 667 | numBits = newshift; | 667 | numBits = newshift; |
| 668 | } | 668 | } |
| 669 | res <<= numBits; | 669 | res = static_cast<IntType>(res << numBits); |
| 670 | res |= v >> comp; | 670 | res = static_cast<IntType>(res | (v >> comp)); |
| 671 | reslen += numBits; | 671 | reslen += numBits; |
| 672 | } | 672 | } |
| 673 | return res; | 673 | return res; |
| @@ -714,7 +714,7 @@ public: | |||
| 714 | // Do nothing | 714 | // Do nothing |
| 715 | return val; | 715 | return val; |
| 716 | } else if (oldDepth == 0 && newDepth != 0) { | 716 | } else if (oldDepth == 0 && newDepth != 0) { |
| 717 | return (1 << newDepth) - 1; | 717 | return static_cast<ChannelType>((1 << newDepth) - 1); |
| 718 | } else if (newDepth > oldDepth) { | 718 | } else if (newDepth > oldDepth) { |
| 719 | return Replicate(val, oldDepth, newDepth); | 719 | return Replicate(val, oldDepth, newDepth); |
| 720 | } else { | 720 | } else { |
| @@ -722,10 +722,11 @@ public: | |||
| 722 | if (newDepth == 0) { | 722 | if (newDepth == 0) { |
| 723 | return 0xFF; | 723 | return 0xFF; |
| 724 | } else { | 724 | } else { |
| 725 | uint8_t bitsWasted = oldDepth - newDepth; | 725 | uint8_t bitsWasted = static_cast<uint8_t>(oldDepth - newDepth); |
| 726 | uint16_t v = static_cast<uint16_t>(val); | 726 | uint16_t v = static_cast<uint16_t>(val); |
| 727 | v = (v + (1 << (bitsWasted - 1))) >> bitsWasted; | 727 | v = static_cast<uint16_t>((v + (1 << (bitsWasted - 1))) >> bitsWasted); |
| 728 | v = ::std::min<uint16_t>(::std::max<uint16_t>(0, v), (1 << newDepth) - 1); | 728 | v = ::std::min<uint16_t>(::std::max<uint16_t>(0, v), |
| 729 | static_cast<uint16_t>((1 << newDepth) - 1)); | ||
| 729 | return static_cast<uint8_t>(v); | 730 | return static_cast<uint8_t>(v); |
| 730 | } | 731 | } |
| 731 | } | 732 | } |
| @@ -1191,18 +1192,18 @@ static uint32_t SelectPartition(int32_t seed, int32_t x, int32_t y, int32_t z, | |||
| 1191 | uint8_t seed11 = static_cast<uint8_t>((rnum >> 26) & 0xF); | 1192 | uint8_t seed11 = static_cast<uint8_t>((rnum >> 26) & 0xF); |
| 1192 | uint8_t seed12 = static_cast<uint8_t>(((rnum >> 30) | (rnum << 2)) & 0xF); | 1193 | uint8_t seed12 = static_cast<uint8_t>(((rnum >> 30) | (rnum << 2)) & 0xF); |
| 1193 | 1194 | ||
| 1194 | seed1 *= seed1; | 1195 | seed1 = static_cast<uint8_t>(seed1 * seed1); |
| 1195 | seed2 *= seed2; | 1196 | seed2 = static_cast<uint8_t>(seed2 * seed2); |
| 1196 | seed3 *= seed3; | 1197 | seed3 = static_cast<uint8_t>(seed3 * seed3); |
| 1197 | seed4 *= seed4; | 1198 | seed4 = static_cast<uint8_t>(seed4 * seed4); |
| 1198 | seed5 *= seed5; | 1199 | seed5 = static_cast<uint8_t>(seed5 * seed5); |
| 1199 | seed6 *= seed6; | 1200 | seed6 = static_cast<uint8_t>(seed6 * seed6); |
| 1200 | seed7 *= seed7; | 1201 | seed7 = static_cast<uint8_t>(seed7 * seed7); |
| 1201 | seed8 *= seed8; | 1202 | seed8 = static_cast<uint8_t>(seed8 * seed8); |
| 1202 | seed9 *= seed9; | 1203 | seed9 = static_cast<uint8_t>(seed9 * seed9); |
| 1203 | seed10 *= seed10; | 1204 | seed10 = static_cast<uint8_t>(seed10 * seed10); |
| 1204 | seed11 *= seed11; | 1205 | seed11 = static_cast<uint8_t>(seed11 * seed11); |
| 1205 | seed12 *= seed12; | 1206 | seed12 = static_cast<uint8_t>(seed12 * seed12); |
| 1206 | 1207 | ||
| 1207 | int32_t sh1, sh2, sh3; | 1208 | int32_t sh1, sh2, sh3; |
| 1208 | if (seed & 1) { | 1209 | if (seed & 1) { |
| @@ -1214,18 +1215,18 @@ static uint32_t SelectPartition(int32_t seed, int32_t x, int32_t y, int32_t z, | |||
| 1214 | } | 1215 | } |
| 1215 | sh3 = (seed & 0x10) ? sh1 : sh2; | 1216 | sh3 = (seed & 0x10) ? sh1 : sh2; |
| 1216 | 1217 | ||
| 1217 | seed1 >>= sh1; | 1218 | seed1 = static_cast<uint8_t>(seed1 >> sh1); |
| 1218 | seed2 >>= sh2; | 1219 | seed2 = static_cast<uint8_t>(seed2 >> sh2); |
| 1219 | seed3 >>= sh1; | 1220 | seed3 = static_cast<uint8_t>(seed3 >> sh1); |
| 1220 | seed4 >>= sh2; | 1221 | seed4 = static_cast<uint8_t>(seed4 >> sh2); |
| 1221 | seed5 >>= sh1; | 1222 | seed5 = static_cast<uint8_t>(seed5 >> sh1); |
| 1222 | seed6 >>= sh2; | 1223 | seed6 = static_cast<uint8_t>(seed6 >> sh2); |
| 1223 | seed7 >>= sh1; | 1224 | seed7 = static_cast<uint8_t>(seed7 >> sh1); |
| 1224 | seed8 >>= sh2; | 1225 | seed8 = static_cast<uint8_t>(seed8 >> sh2); |
| 1225 | seed9 >>= sh3; | 1226 | seed9 = static_cast<uint8_t>(seed9 >> sh3); |
| 1226 | seed10 >>= sh3; | 1227 | seed10 = static_cast<uint8_t>(seed10 >> sh3); |
| 1227 | seed11 >>= sh3; | 1228 | seed11 = static_cast<uint8_t>(seed11 >> sh3); |
| 1228 | seed12 >>= sh3; | 1229 | seed12 = static_cast<uint8_t>(seed12 >> sh3); |
| 1229 | 1230 | ||
| 1230 | int32_t a = seed1 * x + seed2 * y + seed11 * z + (rnum >> 14); | 1231 | int32_t a = seed1 * x + seed2 * y + seed11 * z + (rnum >> 14); |
| 1231 | int32_t b = seed3 * x + seed4 * y + seed12 * z + (rnum >> 10); | 1232 | int32_t b = seed3 * x + seed4 * y + seed12 * z + (rnum >> 10); |
| @@ -1558,7 +1559,9 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth, | |||
| 1558 | 1559 | ||
| 1559 | // Make sure that higher non-texel bits are set to zero | 1560 | // Make sure that higher non-texel bits are set to zero |
| 1560 | const uint32_t clearByteStart = (weightParams.GetPackedBitSize() >> 3) + 1; | 1561 | const uint32_t clearByteStart = (weightParams.GetPackedBitSize() >> 3) + 1; |
| 1561 | texelWeightData[clearByteStart - 1] &= (1 << (weightParams.GetPackedBitSize() % 8)) - 1; | 1562 | texelWeightData[clearByteStart - 1] = |
| 1563 | texelWeightData[clearByteStart - 1] & | ||
| 1564 | static_cast<uint8_t>((1 << (weightParams.GetPackedBitSize() % 8)) - 1); | ||
| 1562 | memset(texelWeightData + clearByteStart, 0, 16 - clearByteStart); | 1565 | memset(texelWeightData + clearByteStart, 0, 16 - clearByteStart); |
| 1563 | 1566 | ||
| 1564 | std::vector<IntegerEncodedValue> texelWeightValues; | 1567 | std::vector<IntegerEncodedValue> texelWeightValues; |