glTF-Sample-Environments icon indicating copy to clipboard operation
glTF-Sample-Environments copied to clipboard

KTX2 files fail validation

Open JonCohen3D opened this issue 10 months ago • 2 comments

I'm trying to extract individual images from the sample environment KTX2 files, but they all fail validation checks:

KTX-Software-main/build/ktx info glTF-Sample-Environments-main/field/lambertian/diffuse.ktx2 
Validation failed

error-6001: Mismatching dfdTotalSize and dfdByteLength. dfdTotalSize must match dfdByteLength.
    dfdTotalSize is 28 but dfdByteLength is 0 and they must match.
error-6015: Invalid colorModel in basic DFD block for RGB VkFormat.
    DFD block #1 colorModel in basic DFD block is KHR_DF_MODEL_UNSPECIFIED but for VkFormat VK_FORMAT_R16G16B16A16_SFLOAT it must be KHR_DF_MODEL_RGBSDA.
error-6025: Invalid sample count in basic DFD block. The sample count must match the expected sample count of the VkFormat.
    DFD block #1 sample count in basic DFD block is 0 but for VkFormat VK_FORMAT_R16G16B16A16_SFLOAT it must be 4.
error-6021: Invalid bytesPlanes in basic DFD block. The values do not match the expected values.
    DFD block #1 bytesPlanes in basic DFD block are 0 0 0 0 0 0 0 0 but for VK_FORMAT_R16G16B16A16_SFLOAT textures these must be 8 0 0 0 0 0 0 0.

I assume this is because the ktx tool is much more recent than the ktx2 files. I tried checking out a much older version of the KTX-Software, but the older versions don't seem to have a tool for image extraction from ktx2. Any advice on how to make this work?

JonCohen3D avatar Mar 13 '25 15:03 JonCohen3D

The full output is actually:

Validation failed

error-6001: Mismatching dfdTotalSize and dfdByteLength. dfdTotalSize must match dfdByteLength. dfdTotalSize is 28 but dfdByteLength is 0 and they must match. error-6015: Invalid colorModel in basic DFD block for RGB VkFormat. DFD block #1 colorModel in basic DFD block is KHR_DF_MODEL_UNSPECIFIED but for VkFormat VK_FORMAT_R16G16B16A16_SFLOAT it must be KHR_DF_MODEL_RGBSDA. error-6025: Invalid sample count in basic DFD block. The sample count must match the expected sample count of the VkFormat. DFD block #1 sample count in basic DFD block is 0 but for VkFormat VK_FORMAT_R16G16B16A16_SFLOAT it must be 4. error-6021: Invalid bytesPlanes in basic DFD block. The values do not match the expected values. DFD block #1 bytesPlanes in basic DFD block are 0 0 0 0 0 0 0 0 but for VK_FORMAT_R16G16B16A16_SFLOAT textures these must be 8 0 0 0 0 0 0 0.

Header

identifier: «KTX 20»\r\n\x1A\n vkFormat: VK_FORMAT_R16G16B16A16_SFLOAT typeSize: 2 pixelWidth: 1024 pixelHeight: 1024 pixelDepth: 0 layerCount: 0 faceCount: 6 levelCount: 1 supercompressionScheme: KTX_SS_NONE dataFormatDescriptor.byteOffset: 0x68 dataFormatDescriptor.byteLength: 28 keyValueData.byteOffset: 0x84 keyValueData.byteLength: 36 supercompressionGlobalData.byteOffset: 0 supercompressionGlobalData.byteLength: 0

Level Index

Level0.byteOffset: 0xa8 Level0.byteLength: 50331648 Level0.uncompressedByteLength: 50331648

Data Format Descriptor

JonCohen3D avatar Mar 13 '25 15:03 JonCohen3D

There is a pending PR that is probably related (and might fix the underlying issue): https://github.com/KhronosGroup/glTF-Sample-Environments/pull/11 - how to get that merged is not totally clear for me.

javagl avatar Mar 13 '25 20:03 javagl