compressonator icon indicating copy to clipboard operation
compressonator copied to clipboard

Mip 1x1 for non-square texture

Open dmaluev opened this issue 5 years ago • 7 comments

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 avatar Jul 27 '20 23:07 dmaluev

@dmaluev Thanks for this issue report. Definitely a bug that needs to be fixed.

NPCompress avatar Jul 28 '20 19:07 NPCompress

Same thing happens in 4.1.5083

dmaluev avatar Nov 25 '20 16:11 dmaluev

@dmaluev the issue has been reproduced and fix is pending. Are you using pre-build sdk libs or builds from github master branch?

NPCompress avatar Nov 25 '20 17:11 NPCompress

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.

dmaluev avatar Nov 28 '20 09:11 dmaluev

Looks like this is still not fixed in 4.2.5185. Only square textures are supported by compressonator.

dmaluev avatar Aug 03 '21 19:08 dmaluev

@dmaluev A fix is scheduled for v4.3 release which has changes to how mipmaps are generated.

NPCompress avatar Aug 04 '21 17:08 NPCompress

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.

Froyok avatar Sep 03 '22 01:09 Froyok

I can confirm that the bug is still present in V4.2.5185

dmitri-fm avatar Dec 04 '22 18:12 dmitri-fm

@vergol @Froyok @dmaluev Please try latest release v4.3.206, there has been some updates on how mip maps are processed

NPCompress avatar Feb 16 '23 18:02 NPCompress

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.

seragh avatar Feb 17 '23 16:02 seragh

The bug is still present in 4.3.206

dmaluev avatar Mar 17 '23 15:03 dmaluev

@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.

NPCompress avatar Mar 17 '23 15:03 NPCompress

I believe this is a duplicate of #112

@dmaluev @Froyok @seragh This was fixed in the latest release.

denislevesqueAMD avatar Jul 18 '23 18:07 denislevesqueAMD

The issue has been resolved in current release v4.4

NPCompress avatar Jul 19 '23 19:07 NPCompress