diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-05 04:07:53 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-08-01 03:26:42 +0200 |
commit | 15c0c213b1efb63f1d6f4900409fca8c8984e973 (patch) | |
tree | 94c6cdd4450f5a6b732241b756afad21ccc38b09 /src/video_core/textures/astc.h | |
parent | Merge pull request #6788 from Morph1984/hle_api_12.1.0 (diff) | |
download | yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.tar yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.tar.gz yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.tar.bz2 yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.tar.lz yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.tar.xz yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.tar.zst yuzu-15c0c213b1efb63f1d6f4900409fca8c8984e973.zip |
Diffstat (limited to 'src/video_core/textures/astc.h')
-rw-r--r-- | src/video_core/textures/astc.h | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/video_core/textures/astc.h b/src/video_core/textures/astc.h index 0229ae122..9e148afc4 100644 --- a/src/video_core/textures/astc.h +++ b/src/video_core/textures/astc.h @@ -79,47 +79,6 @@ constexpr std::array<IntegerEncodedValue, 256> MakeEncodedValues() { constexpr std::array<IntegerEncodedValue, 256> ASTC_ENCODINGS_VALUES = MakeEncodedValues(); -// Replicates low num_bits such that [(to_bit - 1):(to_bit - 1 - from_bit)] -// is the same as [(num_bits - 1):0] and repeats all the way down. -template <typename IntType> -constexpr IntType Replicate(IntType val, u32 num_bits, u32 to_bit) { - if (num_bits == 0 || to_bit == 0) { - return 0; - } - const IntType v = val & static_cast<IntType>((1 << num_bits) - 1); - IntType res = v; - u32 reslen = num_bits; - while (reslen < to_bit) { - u32 comp = 0; - if (num_bits > to_bit - reslen) { - u32 newshift = to_bit - reslen; - comp = num_bits - newshift; - num_bits = newshift; - } - res = static_cast<IntType>(res << num_bits); - res = static_cast<IntType>(res | (v >> comp)); - reslen += num_bits; - } - return res; -} - -constexpr std::size_t NumReplicateEntries(u32 num_bits) { - return std::size_t(1) << num_bits; -} - -template <typename IntType, u32 num_bits, u32 to_bit> -constexpr auto MakeReplicateTable() { - std::array<IntType, NumReplicateEntries(num_bits)> table{}; - for (IntType value = 0; value < static_cast<IntType>(std::size(table)); ++value) { - table[value] = Replicate(value, num_bits, to_bit); - } - return table; -} - -constexpr auto REPLICATE_6_BIT_TO_8_TABLE = MakeReplicateTable<u32, 6, 8>(); -constexpr auto REPLICATE_7_BIT_TO_8_TABLE = MakeReplicateTable<u32, 7, 8>(); -constexpr auto REPLICATE_8_BIT_TO_8_TABLE = MakeReplicateTable<u32, 8, 8>(); - void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, uint32_t depth, uint32_t block_width, uint32_t block_height, std::span<uint8_t> output); |