diff options
| author | 2021-06-19 10:56:13 -0400 | |
|---|---|---|
| committer | 2021-06-19 10:56:13 -0400 | |
| commit | ace20ba4a4774ae3c42f2ef5566c7113f3b980b3 (patch) | |
| tree | 088a7d63269fcd65e84d465cc2c821662674cffc /src/video_core/textures | |
| parent | astc: Various robustness enhancements for the gpu decoder (diff) | |
| download | yuzu-ace20ba4a4774ae3c42f2ef5566c7113f3b980b3.tar.gz yuzu-ace20ba4a4774ae3c42f2ef5566c7113f3b980b3.tar.xz yuzu-ace20ba4a4774ae3c42f2ef5566c7113f3b980b3.zip | |
astc_decoder.comp: Remove unnecessary LUT SSBOs
We can move them to instead be compile time constants within the shader.
Diffstat (limited to 'src/video_core/textures')
| -rw-r--r-- | src/video_core/textures/astc.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/textures/astc.h | 9 |
2 files changed, 5 insertions, 12 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index b6e2022f2..7b756ba41 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -269,7 +269,7 @@ static void DecodeQuintBlock(InputBitStream& bits, IntegerEncodedVector& result, | |||
| 269 | static void DecodeIntegerSequence(IntegerEncodedVector& result, InputBitStream& bits, u32 maxRange, | 269 | static void DecodeIntegerSequence(IntegerEncodedVector& result, InputBitStream& bits, u32 maxRange, |
| 270 | u32 nValues) { | 270 | u32 nValues) { |
| 271 | // Determine encoding parameters | 271 | // Determine encoding parameters |
| 272 | IntegerEncodedValue val = EncodingsValues[maxRange]; | 272 | IntegerEncodedValue val = ASTC_ENCODINGS_VALUES[maxRange]; |
| 273 | 273 | ||
| 274 | // Start decoding | 274 | // Start decoding |
| 275 | u32 nValsDecoded = 0; | 275 | u32 nValsDecoded = 0; |
| @@ -310,7 +310,7 @@ struct TexelWeightParams { | |||
| 310 | nIdxs *= 2; | 310 | nIdxs *= 2; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | return EncodingsValues[m_MaxWeight].GetBitLength(nIdxs); | 313 | return ASTC_ENCODINGS_VALUES[m_MaxWeight].GetBitLength(nIdxs); |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | u32 GetNumWeightValues() const { | 316 | u32 GetNumWeightValues() const { |
| @@ -755,12 +755,12 @@ static void DecodeColorValues(u32* out, std::span<u8> data, const u32* modes, co | |||
| 755 | // figure out the max value for each of them... | 755 | // figure out the max value for each of them... |
| 756 | u32 range = 256; | 756 | u32 range = 256; |
| 757 | while (--range > 0) { | 757 | while (--range > 0) { |
| 758 | IntegerEncodedValue val = EncodingsValues[range]; | 758 | IntegerEncodedValue val = ASTC_ENCODINGS_VALUES[range]; |
| 759 | u32 bitLength = val.GetBitLength(nValues); | 759 | u32 bitLength = val.GetBitLength(nValues); |
| 760 | if (bitLength <= nBitsForColorData) { | 760 | if (bitLength <= nBitsForColorData) { |
| 761 | // Find the smallest possible range that matches the given encoding | 761 | // Find the smallest possible range that matches the given encoding |
| 762 | while (--range > 0) { | 762 | while (--range > 0) { |
| 763 | IntegerEncodedValue newval = EncodingsValues[range]; | 763 | IntegerEncodedValue newval = ASTC_ENCODINGS_VALUES[range]; |
| 764 | if (!newval.MatchesEncoding(val)) { | 764 | if (!newval.MatchesEncoding(val)) { |
| 765 | break; | 765 | break; |
| 766 | } | 766 | } |
diff --git a/src/video_core/textures/astc.h b/src/video_core/textures/astc.h index 441e8eb04..0229ae122 100644 --- a/src/video_core/textures/astc.h +++ b/src/video_core/textures/astc.h | |||
| @@ -77,7 +77,7 @@ constexpr std::array<IntegerEncodedValue, 256> MakeEncodedValues() { | |||
| 77 | return encodings; | 77 | return encodings; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | constexpr std::array<IntegerEncodedValue, 256> EncodingsValues = MakeEncodedValues(); | 80 | constexpr std::array<IntegerEncodedValue, 256> ASTC_ENCODINGS_VALUES = MakeEncodedValues(); |
| 81 | 81 | ||
| 82 | // Replicates low num_bits such that [(to_bit - 1):(to_bit - 1 - from_bit)] | 82 | // Replicates low num_bits such that [(to_bit - 1):(to_bit - 1 - from_bit)] |
| 83 | // is the same as [(num_bits - 1):0] and repeats all the way down. | 83 | // is the same as [(num_bits - 1):0] and repeats all the way down. |
| @@ -120,13 +120,6 @@ constexpr auto REPLICATE_6_BIT_TO_8_TABLE = MakeReplicateTable<u32, 6, 8>(); | |||
| 120 | constexpr auto REPLICATE_7_BIT_TO_8_TABLE = MakeReplicateTable<u32, 7, 8>(); | 120 | constexpr auto REPLICATE_7_BIT_TO_8_TABLE = MakeReplicateTable<u32, 7, 8>(); |
| 121 | constexpr auto REPLICATE_8_BIT_TO_8_TABLE = MakeReplicateTable<u32, 8, 8>(); | 121 | constexpr auto REPLICATE_8_BIT_TO_8_TABLE = MakeReplicateTable<u32, 8, 8>(); |
| 122 | 122 | ||
| 123 | struct AstcBufferData { | ||
| 124 | decltype(EncodingsValues) encoding_values = EncodingsValues; | ||
| 125 | decltype(REPLICATE_6_BIT_TO_8_TABLE) replicate_6_to_8 = REPLICATE_6_BIT_TO_8_TABLE; | ||
| 126 | decltype(REPLICATE_7_BIT_TO_8_TABLE) replicate_7_to_8 = REPLICATE_7_BIT_TO_8_TABLE; | ||
| 127 | decltype(REPLICATE_8_BIT_TO_8_TABLE) replicate_8_to_8 = REPLICATE_8_BIT_TO_8_TABLE; | ||
| 128 | } constexpr ASTC_BUFFER_DATA; | ||
| 129 | |||
| 130 | void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, uint32_t depth, | 123 | void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, uint32_t depth, |
| 131 | uint32_t block_width, uint32_t block_height, std::span<uint8_t> output); | 124 | uint32_t block_width, uint32_t block_height, std::span<uint8_t> output); |
| 132 | 125 | ||