Closed cdwfs closed 5 years ago
@cdwfs This issue is been fixed, the following codec formats have the same problem.
CMP_FORMAT_BC1, CMP_FORMAT_DXT1. CMP_FORMAT_BC2, CMP_FORMAT_DXT3. CMP_FORMAT_BC3, CMP_FORMAT_DXT5. CMP_FORMAT_BC4, CMP_FORMAT_ATI1N, CMP_FORMAT_ATI2N. CMP_FORMAT_BC5, CMP_FORMAT_ATI2N_XY, CMP_FORMAT_ATI2N_DXT5. CMP_FORMAT_ATC_RGB, CMP_FORMAT_ATC_RGBA_Explicit, CMP_FORMAT_ATC_RGBA_Interpolated.
These are checked by a call to bool NeedSwizzle(CMP_FORMAT destformat) in compress.cpp which returns true for formats requiring swizzle.
The SDK contains multi channel swapping code "void CMP_Map_Bytes(...)" in Compressonator.cpp that is under the compile directive #ifndef USE_OLD_SWIZZLE, which is been developed for the fix.
"if it's CMP_FORMATRGBA*, shouldn't m_bSwizzleChannels automatically default to true instead of false?" yes this should, this bug will be fixed.
Thank you for the prompt response! Now that I know the issue, I'd be happy to work on a pull request if that would get a fix in faster. Just let me know which you'd prefer.
We welcome and encourage all pull requests. Thanks for your support.
This issue affects the release CLI and GUI as well, right?
I'm running some 32-bit RGBA texture data through the Compressonator library using the high-level
CMP_ConvertTexture()
API, and I noticed that while the output looks correct if I chooseCMP_FORMAT_BC7
as the output format, choosingCMP_FORMAT_BC1
orCMP_FORMAT_BC3
results in the red and blue channels swapped in the output, using otherwise identical input data and compression settings.I dug around a bit and found an
m_bSwizzleChannels
variable that controls whether the input data is treated as BGRA (the default) or RGBA. I see no corresponding option inCMP_CompressOptions
to change this value, aside from using the (largely undocumented)CmdSet
array to set "SwizzleChannels" to a non-zero value. But, shouldn't the default be determined based on the src texture format -- if it'sCMP_FORMAT_RGBA_*
, shouldn'tm_bSwizzleChannels
automatically default to true instead of false?