compressonator
compressonator copied to clipboard
Mip 1x1 for non-square texture
Using v4.0.4855 I'm using CMP_LoadTexture to load 2048x1024 TGA image. For some reason m_nMaxMipLevels gets set to 11. Then I call CMP_GenerateMIPLevels(&srcMipSet, 0). The last mip level 1x1 is not generated. srcMipSet.m_pMipLevelTable[11] doesn't even exist, so I get a crash.
@dmaluev Thanks for this issue report. Definitely a bug that needs to be fixed.
Same thing happens in 4.1.5083
@dmaluev the issue has been reproduced and fix is pending. Are you using pre-build sdk libs or builds from github master branch?
OK, thank you. I prefer to use pre-build libs from Releases.
Most of our textures are square power-of-two images. But there is tiny amount of non-square images. I have custom code for normal map mipmap generation, so I cannot just use another BC7 compressor for compressing plain image files.
Looks like this is still not fixed in 4.2.5185. Only square textures are supported by compressonator.
@dmaluev A fix is scheduled for v4.3 release which has changes to how mipmaps are generated.
Is there any update on when 4.3 will come out ? I'm facing that bug as well and I had to use another, less convenient, library for the time being.
I can confirm that the bug is still present in V4.2.5185
@vergol @Froyok @dmaluev Please try latest release v4.3.206, there has been some updates on how mip maps are processed
Using v4.3.206, linking against framework and opening a 128x512 png using CMP_LoadTexture the MipSet has m_nMaxMipLevels set to 8 instead of the expected 10 and no 1x1 mipmap is generated by CMP_GenerateMIPLevels.
The bug is still present in 4.3.206
@dmaluev The none square mipmap issue will be worked on for the next release.
Current (8 levels): (128x512) (64x256) (32x128) (16x64) (8x32) (4x16) (2x8) (1x4) To fix : Add code to generate: (1x2) (1x1)
The CMP_GenerateMIPLevels calls into CMP_GenerateMIPLevelsEx which loops through each level and breaks when width or height = 1. The fix is to break when both width and height = 1. Code will also need to do additional checks in the loop for mip level data generation set prior to the call in the minsize parameter.
I believe this is a duplicate of #112
@dmaluev @Froyok @seragh This was fixed in the latest release.
The issue has been resolved in current release v4.4