From 6a430f2a14082a0edc479936d7f4795de87aebcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 17 Mar 2023 00:02:01 +0100 Subject: [PATCH] ReplacedTexture: Some initialization. For UASTC, seems we need to clear the transcoder state. --- GPU/Common/ReplacedTexture.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GPU/Common/ReplacedTexture.cpp b/GPU/Common/ReplacedTexture.cpp index e964d2a4e8..7aab3f9cb1 100644 --- a/GPU/Common/ReplacedTexture.cpp +++ b/GPU/Common/ReplacedTexture.cpp @@ -480,7 +480,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference return LoadLevelResult::LOAD_ERROR; } - int blockSize; + int blockSize = 0; bool bc = Draw::DataFormatIsBlockCompressed(*pixelFormat, &blockSize); _dbg_assert_(bc || *pixelFormat == Draw::DataFormat::R8G8B8A8_UNORM); @@ -492,7 +492,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference for (int i = 0; i < numMips; i++) { std::vector &out = data_[mipLevel + i]; - basist::ktx2_image_level_info levelInfo; + basist::ktx2_image_level_info levelInfo{}; bool result = transcoder.get_image_level_info(levelInfo, i, 0, 0); _dbg_assert_(result); @@ -507,6 +507,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference } data_[i].resize(dataSizeBytes); + transcodeState.clear(); transcoder.transcode_image_level(i, 0, 0, &out[0], (uint32_t)outputSize, transcoderFormat, 0, (uint32_t)outputPitch, level.h, -1, -1, &transcodeState); level.w = levelInfo.m_orig_width; level.h = levelInfo.m_orig_height; @@ -555,6 +556,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference } cleanup(); return LoadLevelResult::DONE; // don't read more levels + } else if (imageType == ReplacedImageType::ZIM) { std::unique_ptr zim(new uint8_t[fileSize]);