compressonator
compressonator copied to clipboard
Incorrect DDS file generated when compressing BC6H cubemap [4.2.5185]
When compressing a an RGBA16F cubemap, the resulting files has 36 faces for each mip level instead of 6.
Input and output files attached: grace_cross_mmp_ABGR16F.zip
Command line and output:
Source Texture size = 0 Bytes, width = 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px height = 8 px
Destination Texture size = 64 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px height = 8 px
Destination Texture size = 64 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px height = 8 px
Destination Texture size = 64 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px height = 8 px
Destination Texture size = 64 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px height = 8 px
Destination Texture size = 64 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px height = 8 px
Destination Texture size = 64 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px height = 4 px
Destination Texture size = 16 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px height = 4 px
Destination Texture size = 16 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px height = 4 px
Destination Texture size = 16 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px height = 4 px
Destination Texture size = 16 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px height = 4 px
Destination Texture size = 16 Bytes Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px height = 4 px
Destination Texture size = 16 Bytes Resulting compression ratio = 0.00:1
Compressed to BC6H with 42 iteration(s) in 2.245 seconds
Total time taken (includes file I/O): 2.246 seconds
Done Processing
Processed in 2.28 seconds```
I'm not sure what the issue is here. The input image has 7 mipmap levels per cubemap face, and from the output here Compressonator processed 42 images (6 faces * 7 mipmap levels). I even tried to test myself using both older and newer versions of Compressonator, but it all looked correct to me.
Since this was reported quite a while ago we might just want to close this issue. Unless @sherief happens to remember more details about the issue.
Loading the output file from the attached .zip in Renderdoc shows the following:
Under the "Slice/Face" combo box there's six instances of six faces each. The input file only shows one instance of six faces:
In the former file, all cubemap faces other than the first six show as black.
@sherief Thanks for the update! It looks like the extra cubemap faces only show up in RenderDoc, not in Compressonator. We will look into this further.
I think the error comes from the fact that arraySize is required to store number of cubes, not faces: https://learn.microsoft.com/en-us/windows/win32/direct3ddds/dds-header-dxt10#members
I came across the same issue when implementing my own DDS importer. Don't remember which "ground truth" tool I used to compare against, but I think either the legacy NVidia Texture Tools or the NVTT Exporter should be capable of producing correct DXT10 cubemaps.
The line here https://github.com/GPUOpen-Tools/compressonator/blob/0bea29d5ab01c688c8408edf50a8f13dfe7a915b/applications/_plugins/cimage/dds/dds_dx10.cpp#L414 thus should say 1 instead of 6. Similar changes will be needed for cube map arrays as well in case Compressonator supports them.
@mosra Thanks for the suggestion! We'll see about implementing this fix in the near future.