diff options
| author | 2018-07-17 23:46:30 -0400 | |
|---|---|---|
| committer | 2018-07-17 23:58:14 -0400 | |
| commit | 0f148548f3edfc62bcdd62ed42d6797380f6ab57 (patch) | |
| tree | 90c91a527a8ebc90fb42fb3620a6870d4e858328 /src | |
| parent | astc: const-correctness changes where applicable (diff) | |
| download | yuzu-0f148548f3edfc62bcdd62ed42d6797380f6ab57.tar.gz yuzu-0f148548f3edfc62bcdd62ed42d6797380f6ab57.tar.xz yuzu-0f148548f3edfc62bcdd62ed42d6797380f6ab57.zip | |
astc: Mark functions as internally linked where applicable
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/textures/astc.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index 1f2eca787..6dfcadc6a 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -406,7 +406,7 @@ struct TexelWeightParams { | |||
| 406 | } | 406 | } |
| 407 | }; | 407 | }; |
| 408 | 408 | ||
| 409 | TexelWeightParams DecodeBlockInfo(BitStream& strm) { | 409 | static TexelWeightParams DecodeBlockInfo(BitStream& strm) { |
| 410 | TexelWeightParams params; | 410 | TexelWeightParams params; |
| 411 | 411 | ||
| 412 | // Read the entire block mode all at once | 412 | // Read the entire block mode all at once |
| @@ -605,8 +605,8 @@ TexelWeightParams DecodeBlockInfo(BitStream& strm) { | |||
| 605 | return params; | 605 | return params; |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | void FillVoidExtentLDR(BitStream& strm, uint32_t* const outBuf, uint32_t blockWidth, | 608 | static void FillVoidExtentLDR(BitStream& strm, uint32_t* const outBuf, uint32_t blockWidth, |
| 609 | uint32_t blockHeight) { | 609 | uint32_t blockHeight) { |
| 610 | // Don't actually care about the void extent, just read the bits... | 610 | // Don't actually care about the void extent, just read the bits... |
| 611 | for (int i = 0; i < 4; ++i) { | 611 | for (int i = 0; i < 4; ++i) { |
| 612 | strm.ReadBits(13); | 612 | strm.ReadBits(13); |
| @@ -621,23 +621,25 @@ void FillVoidExtentLDR(BitStream& strm, uint32_t* const outBuf, uint32_t blockWi | |||
| 621 | uint32_t rgba = (r >> 8) | (g & 0xFF00) | (static_cast<uint32_t>(b) & 0xFF00) << 8 | | 621 | uint32_t rgba = (r >> 8) | (g & 0xFF00) | (static_cast<uint32_t>(b) & 0xFF00) << 8 | |
| 622 | (static_cast<uint32_t>(a) & 0xFF00) << 16; | 622 | (static_cast<uint32_t>(a) & 0xFF00) << 16; |
| 623 | 623 | ||
| 624 | for (uint32_t j = 0; j < blockHeight; j++) | 624 | for (uint32_t j = 0; j < blockHeight; j++) { |
| 625 | for (uint32_t i = 0; i < blockWidth; i++) { | 625 | for (uint32_t i = 0; i < blockWidth; i++) { |
| 626 | outBuf[j * blockWidth + i] = rgba; | 626 | outBuf[j * blockWidth + i] = rgba; |
| 627 | } | 627 | } |
| 628 | } | ||
| 628 | } | 629 | } |
| 629 | 630 | ||
| 630 | void FillError(uint32_t* outBuf, uint32_t blockWidth, uint32_t blockHeight) { | 631 | static void FillError(uint32_t* outBuf, uint32_t blockWidth, uint32_t blockHeight) { |
| 631 | for (uint32_t j = 0; j < blockHeight; j++) | 632 | for (uint32_t j = 0; j < blockHeight; j++) { |
| 632 | for (uint32_t i = 0; i < blockWidth; i++) { | 633 | for (uint32_t i = 0; i < blockWidth; i++) { |
| 633 | outBuf[j * blockWidth + i] = 0xFFFF00FF; | 634 | outBuf[j * blockWidth + i] = 0xFFFF00FF; |
| 634 | } | 635 | } |
| 636 | } | ||
| 635 | } | 637 | } |
| 636 | 638 | ||
| 637 | // Replicates low numBits such that [(toBit - 1):(toBit - 1 - fromBit)] | 639 | // Replicates low numBits such that [(toBit - 1):(toBit - 1 - fromBit)] |
| 638 | // is the same as [(numBits - 1):0] and repeats all the way down. | 640 | // is the same as [(numBits - 1):0] and repeats all the way down. |
| 639 | template <typename IntType> | 641 | template <typename IntType> |
| 640 | IntType Replicate(const IntType& val, uint32_t numBits, uint32_t toBit) { | 642 | static IntType Replicate(const IntType& val, uint32_t numBits, uint32_t toBit) { |
| 641 | if (numBits == 0) | 643 | if (numBits == 0) |
| 642 | return 0; | 644 | return 0; |
| 643 | if (toBit == 0) | 645 | if (toBit == 0) |
| @@ -788,8 +790,8 @@ public: | |||
| 788 | } | 790 | } |
| 789 | }; | 791 | }; |
| 790 | 792 | ||
| 791 | void DecodeColorValues(uint32_t* out, uint8_t* data, const uint32_t* modes, | 793 | static void DecodeColorValues(uint32_t* out, uint8_t* data, const uint32_t* modes, |
| 792 | const uint32_t nPartitions, const uint32_t nBitsForColorData) { | 794 | const uint32_t nPartitions, const uint32_t nBitsForColorData) { |
| 793 | // First figure out how many color values we have | 795 | // First figure out how many color values we have |
| 794 | uint32_t nValues = 0; | 796 | uint32_t nValues = 0; |
| 795 | for (uint32_t i = 0; i < nPartitions; i++) { | 797 | for (uint32_t i = 0; i < nPartitions; i++) { |
| @@ -958,7 +960,7 @@ void DecodeColorValues(uint32_t* out, uint8_t* data, const uint32_t* modes, | |||
| 958 | } | 960 | } |
| 959 | } | 961 | } |
| 960 | 962 | ||
| 961 | uint32_t UnquantizeTexelWeight(const IntegerEncodedValue& val) { | 963 | static uint32_t UnquantizeTexelWeight(const IntegerEncodedValue& val) { |
| 962 | uint32_t bitval = val.GetBitValue(); | 964 | uint32_t bitval = val.GetBitValue(); |
| 963 | uint32_t bitlen = val.BaseBitLength(); | 965 | uint32_t bitlen = val.BaseBitLength(); |
| 964 | 966 | ||
| @@ -1047,9 +1049,10 @@ uint32_t UnquantizeTexelWeight(const IntegerEncodedValue& val) { | |||
| 1047 | return result; | 1049 | return result; |
| 1048 | } | 1050 | } |
| 1049 | 1051 | ||
| 1050 | void UnquantizeTexelWeights(uint32_t out[2][144], const std::vector<IntegerEncodedValue>& weights, | 1052 | static void UnquantizeTexelWeights(uint32_t out[2][144], |
| 1051 | const TexelWeightParams& params, const uint32_t blockWidth, | 1053 | const std::vector<IntegerEncodedValue>& weights, |
| 1052 | const uint32_t blockHeight) { | 1054 | const TexelWeightParams& params, const uint32_t blockWidth, |
| 1055 | const uint32_t blockHeight) { | ||
| 1053 | uint32_t weightIdx = 0; | 1056 | uint32_t weightIdx = 0; |
| 1054 | uint32_t unquantized[2][144]; | 1057 | uint32_t unquantized[2][144]; |
| 1055 | 1058 | ||
| @@ -1241,8 +1244,8 @@ static inline uint32_t Select2DPartition(int32_t seed, int32_t x, int32_t y, int | |||
| 1241 | } | 1244 | } |
| 1242 | 1245 | ||
| 1243 | // Section C.2.14 | 1246 | // Section C.2.14 |
| 1244 | void ComputeEndpoints(Pixel& ep1, Pixel& ep2, const uint32_t*& colorValues, | 1247 | static void ComputeEndpoints(Pixel& ep1, Pixel& ep2, const uint32_t*& colorValues, |
| 1245 | uint32_t colorEndpointMode) { | 1248 | uint32_t colorEndpointMode) { |
| 1246 | #define READ_UINT_VALUES(N) \ | 1249 | #define READ_UINT_VALUES(N) \ |
| 1247 | uint32_t v[N]; \ | 1250 | uint32_t v[N]; \ |
| 1248 | for (uint32_t i = 0; i < N; i++) { \ | 1251 | for (uint32_t i = 0; i < N; i++) { \ |
| @@ -1362,8 +1365,8 @@ void ComputeEndpoints(Pixel& ep1, Pixel& ep2, const uint32_t*& colorValues, | |||
| 1362 | #undef READ_INT_VALUES | 1365 | #undef READ_INT_VALUES |
| 1363 | } | 1366 | } |
| 1364 | 1367 | ||
| 1365 | void DecompressBlock(uint8_t inBuf[16], const uint32_t blockWidth, const uint32_t blockHeight, | 1368 | static void DecompressBlock(uint8_t inBuf[16], const uint32_t blockWidth, |
| 1366 | uint32_t* outBuf) { | 1369 | const uint32_t blockHeight, uint32_t* outBuf) { |
| 1367 | BitStream strm(inBuf); | 1370 | BitStream strm(inBuf); |
| 1368 | TexelWeightParams weightParams = DecodeBlockInfo(strm); | 1371 | TexelWeightParams weightParams = DecodeBlockInfo(strm); |
| 1369 | 1372 | ||