diff options
author | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-30 03:46:09 +0100 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2018-11-02 00:22:12 +0100 |
commit | 60a184455c5aef7cce7e6232cab738f66cb0aac0 (patch) | |
tree | 7421f8289ad911124dd68ad5c8059ebc8ba3a017 /src/video_core/textures | |
parent | Fix ASTC formats (diff) | |
download | yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.gz yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.bz2 yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.lz yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.xz yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.zst yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.zip |
Diffstat (limited to 'src/video_core/textures')
-rw-r--r-- | src/video_core/textures/astc.cpp | 32 | ||||
-rw-r--r-- | src/video_core/textures/astc.h | 2 |
2 files changed, 18 insertions, 16 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index b1feacae9..bc50a4876 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp @@ -1598,27 +1598,29 @@ static void DecompressBlock(uint8_t inBuf[16], const uint32_t blockWidth, namespace Tegra::Texture::ASTC { std::vector<uint8_t> Decompress(std::vector<uint8_t>& data, uint32_t width, uint32_t height, - uint32_t block_width, uint32_t block_height) { + uint32_t depth, uint32_t block_width, uint32_t block_height) { uint32_t blockIdx = 0; - std::vector<uint8_t> outData(height * width * 4); - for (uint32_t j = 0; j < height; j += block_height) { - for (uint32_t i = 0; i < width; i += block_width) { + std::vector<uint8_t> outData(height * width * depth * 4); + for (uint32_t k = 0; k < depth; k++) { + for (uint32_t j = 0; j < height; j += block_height) { + for (uint32_t i = 0; i < width; i += block_width) { - uint8_t* blockPtr = data.data() + blockIdx * 16; + uint8_t* blockPtr = data.data() + blockIdx * 16; - // Blocks can be at most 12x12 - uint32_t uncompData[144]; - ASTCC::DecompressBlock(blockPtr, block_width, block_height, uncompData); + // Blocks can be at most 12x12 + uint32_t uncompData[144]; + ASTCC::DecompressBlock(blockPtr, block_width, block_height, uncompData); - uint32_t decompWidth = std::min(block_width, width - i); - uint32_t decompHeight = std::min(block_height, height - j); + uint32_t decompWidth = std::min(block_width, width - i); + uint32_t decompHeight = std::min(block_height, height - j); - uint8_t* outRow = outData.data() + (j * width + i) * 4; - for (uint32_t jj = 0; jj < decompHeight; jj++) { - memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4); - } + uint8_t* outRow = outData.data() + (j * width + i) * 4; + for (uint32_t jj = 0; jj < decompHeight; jj++) { + memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4); + } - blockIdx++; + blockIdx++; + } } } diff --git a/src/video_core/textures/astc.h b/src/video_core/textures/astc.h index f0d7c0e56..d419dd025 100644 --- a/src/video_core/textures/astc.h +++ b/src/video_core/textures/astc.h @@ -10,6 +10,6 @@ namespace Tegra::Texture::ASTC { std::vector<uint8_t> Decompress(std::vector<uint8_t>& data, uint32_t width, uint32_t height, - uint32_t block_width, uint32_t block_height); + uint32_t depth, uint32_t block_width, uint32_t block_height); } // namespace Tegra::Texture::ASTC |