diff options
| author | 2019-04-30 21:45:49 -0400 | |
|---|---|---|
| committer | 2019-04-30 23:02:31 -0400 | |
| commit | 95261639fb4ed67ecf1cb84dd7a8e380788bd420 (patch) | |
| tree | 0232f10959c0cbff0a6fc15e4256068ea1d9b3a0 /src/video_core/textures/astc.cpp | |
| parent | Merge pull request #2406 from FearlessTobi/port-3839 (diff) | |
| download | yuzu-95261639fb4ed67ecf1cb84dd7a8e380788bd420.tar.gz yuzu-95261639fb4ed67ecf1cb84dd7a8e380788bd420.tar.xz yuzu-95261639fb4ed67ecf1cb84dd7a8e380788bd420.zip | |
Fix Layered ASTC Textures
By adding the missing layer offset in ASTC compression.
Diffstat (limited to 'src/video_core/textures/astc.cpp')
| -rw-r--r-- | src/video_core/textures/astc.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index b508d64e9..eafb6b73a 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -1616,6 +1616,7 @@ namespace Tegra::Texture::ASTC { | |||
| 1616 | std::vector<uint8_t> Decompress(const uint8_t* data, uint32_t width, uint32_t height, | 1616 | std::vector<uint8_t> Decompress(const uint8_t* data, uint32_t width, uint32_t height, |
| 1617 | uint32_t depth, uint32_t block_width, uint32_t block_height) { | 1617 | uint32_t depth, uint32_t block_width, uint32_t block_height) { |
| 1618 | uint32_t blockIdx = 0; | 1618 | uint32_t blockIdx = 0; |
| 1619 | std::size_t depth_offset = 0; | ||
| 1619 | std::vector<uint8_t> outData(height * width * depth * 4); | 1620 | std::vector<uint8_t> outData(height * width * depth * 4); |
| 1620 | for (uint32_t k = 0; k < depth; k++) { | 1621 | for (uint32_t k = 0; k < depth; k++) { |
| 1621 | for (uint32_t j = 0; j < height; j += block_height) { | 1622 | for (uint32_t j = 0; j < height; j += block_height) { |
| @@ -1630,7 +1631,7 @@ std::vector<uint8_t> Decompress(const uint8_t* data, uint32_t width, uint32_t he | |||
| 1630 | uint32_t decompWidth = std::min(block_width, width - i); | 1631 | uint32_t decompWidth = std::min(block_width, width - i); |
| 1631 | uint32_t decompHeight = std::min(block_height, height - j); | 1632 | uint32_t decompHeight = std::min(block_height, height - j); |
| 1632 | 1633 | ||
| 1633 | uint8_t* outRow = outData.data() + (j * width + i) * 4; | 1634 | uint8_t* outRow = depth_offset + outData.data() + (j * width + i) * 4; |
| 1634 | for (uint32_t jj = 0; jj < decompHeight; jj++) { | 1635 | for (uint32_t jj = 0; jj < decompHeight; jj++) { |
| 1635 | memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4); | 1636 | memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4); |
| 1636 | } | 1637 | } |
| @@ -1638,6 +1639,7 @@ std::vector<uint8_t> Decompress(const uint8_t* data, uint32_t width, uint32_t he | |||
| 1638 | blockIdx++; | 1639 | blockIdx++; |
| 1639 | } | 1640 | } |
| 1640 | } | 1641 | } |
| 1642 | depth_offset += height * width * 4; | ||
| 1641 | } | 1643 | } |
| 1642 | 1644 | ||
| 1643 | return outData; | 1645 | return outData; |