Fix Mio0 Encoding In Compressed Texture Factory

This commit is contained in:
inspectredc
2024-11-28 09:18:51 -06:00
committed by Lywx
parent c7d12dadb5
commit a0b671d590
+3 -1
View File
@@ -118,10 +118,12 @@ ExportResult CompressedTextureCodeExporter::Export(std::ostream &write, std::sha
// Allocate worse case size
uint8_t* compressedData;
size_t compressedSize;
size_t worstSize;
switch (texture->mCompressionType) {
case CompressionType::MIO0:
compressedData = static_cast<uint8_t*>(malloc(MIO0_HEADER_LENGTH + ((data.size()+7)/8) + data.size()));
worstSize = MIO0_HEADER_LENGTH + ((data.size()+7)/8) + data.size();
compressedData = static_cast<uint8_t*>(std::calloc(worstSize, sizeof(uint8_t)));
compressedSize = mio0_encode(data.data(), data.size(), compressedData);
break;
default: