compressonator icon indicating copy to clipboard operation
compressonator copied to clipboard

BC4 compression with R8 input results in a black texture

Open ttvertex opened this issue 5 years ago • 1 comments

Hello,

After updating the library to v3.2.4691, it seems the BC4/ATI1N compression is producing a black texture when provided a R8 texture as input. This can be reproduced in the GUI and also with the SDK API.

As far as I could trace, the bufferIn.m_bSwizzle flag is wrongly set to true for this input format, which results in in the CCodecBuffer_R8::ReadBlockB getting called, which returns always 0 for this channel. The commit that introduced this verification of this flag in the CCodec_ATI1N::Compress_Fast codec is: https://github.com/GPUOpen-Tools/compressonator/commit/92f888ff03c15984946048fa0d2a8a6b67106fd5#diff-fc1b13a6a8de118ff844e5041f950301L121 A workaround I managed to do is to add CBT_R8 to the switch here: https://github.com/GPUOpen-Tools/compressonator/blob/7d56f15fb2cdc00364221474f1b4c84a113f474f/Compressonator/CMP_CompressonatorLib/Compress.cpp#L542

Is this is a known issue? is there another fix/workaround that can be done from outside the library?

Thank you for the support!

ttvertex avatar Apr 23 '20 17:04 ttvertex

@tiiago11 "Is this is a known issue? " No, its the first time been reported. The patch you used is applied to the release that is scheduled for next week.

"is there another fix/workaround that can be done from outside the library?" You can use the low -level BC4 block encoder available in CMP_Core.

NPCompress avatar May 07 '20 14:05 NPCompress

@ttvertex CBT_R8 data type is added codecbuffer

NPCompress avatar Feb 13 '23 14:02 NPCompress