Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions EtcLib/Etc/Etc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ namespace Etc

mipWidth >>= 1;
mipHeight >>= 1;

// Get out of the loop if both shifted dimensions are zero
if ((mipWidth==0) && (mipHeight==0))
break;

// Make sure to generate mipmap chain down to 1x1 for iOS
if (mipWidth==0) mipWidth = 1;
if (mipHeight==0) mipHeight = 1;
}

*a_piEncodingTime_ms = totalEncodingTime;
Expand Down
3 changes: 2 additions & 1 deletion EtcTool/EtcTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ int main(int argc, const char * argv[])

// Calculate the maximum number of possible mipmaps
{
int dim = (uiSourceWidth < uiSourceHeight)?uiSourceWidth:uiSourceHeight;
// Use maximum dimension to make sure to go down to 1x1 for iOS
int dim = (uiSourceWidth > uiSourceHeight)?uiSourceWidth:uiSourceHeight;
int maxMips = 0;
while(dim >= 1)
{
Expand Down