GPUOpen-Tools / compressonator

Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs
1.3k stars 197 forks source link

DDS output dwPitchOrLinearSize borked #305

Open tamlin-mike opened 9 months ago

tamlin-mike commented 9 months ago

DDS file output produces invalid DDS_HEADER.dwPitchOrLinearSize (a.k.a. DDSURFACEDESC2.dwLinearSize).

For a mipmapped compressed DDS (BC7, but should apply to all compressed DDS formats) of size 1024x1024, compressonatorcli generates dwLinearSize 4096.

That's... not entirely correct. (hint: sqrt(4096) != 1024) :-)

It should be 1MB (in this case, with a 4:1 compression).

While I have not looked at the src emitting this incorrect value, the binary representations of these two values could suggest an erroneous big-/little-endian conversion. 4K = 00 10 00 00 1M = 00 00 10 00