Skip to content

Commit

Permalink
Fix Mio0 Encoding In Compressed Texture Factory
Browse files Browse the repository at this point in the history
  • Loading branch information
inspectredc authored and KiritoDv committed Nov 28, 2024
1 parent c7d12da commit a0b671d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/factories/CompressedTextureFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a0b671d

Please sign in to comment.