GPUOpen-Tools / compressonator

Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASTC encoding assumes RGBA input, regardless of input format

carlschissler opened this issue · comments

The ASTC compression codec does not respect the source buffer format, and instead always assumes RGBA input, reading directly from the source pixel data. This leads to out-of-bounds memory access and scrambled output when one tries to encode other formatted images into ASTC, such as RGB-888 or any other format that is not RGBA-8888.

The bug is in CCodec_ASTC::Compress(), starting below the comment that beings "Loop through the original input image...". This block of code should either use the codec input buffer to read the image data, or provide a special case for 1, 2, 3, and 4 channels (this worked for me).

I get the feeling that no one has ever tested the RGB code paths...

Thanks for the bug report, but the ASTC codec is no longer officially supported by Compressonator