Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ktx2check bug: "ERROR: Size of image data in file does not match size calculated from levelIndex" with no key value data #395

Closed
richgel999 opened this issue Apr 12, 2021 · 2 comments

Comments

@richgel999
Copy link

richgel999 commented Apr 12, 2021

If the file is UASTC with no supercompression, and contains no key value fields at all, 12 mipPadding alignment bytes are required but the validator doesn't account for them. Here's an example file:

kodim18.zip

If key value fields are present I wasn't able to reproduce this after a few attempts, so it may only occur with no key value fields.

@richgel999
Copy link
Author

richgel999 commented Apr 12, 2021

If you look at encoder/basisu_comp.cpp, there are two new macros:

// Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all)
#define BASISU_DISABLE_KTX2_ALIGNMENT_WORKAROUND (0)

// Set to 1 to disable writing all KTX2 key values, triggering the validator bug.
#define BASISU_DISABLE_KTX2_KEY_VALUES (0)

If these are set to 1 and the command line tool is ran like this: "basisu -ktx2 -uastc -ktx2_no_zstandard kodim18.png" you'll reproduce the problematic KTX2 file that fails validation.

We want to be able to set BASISU_DISABLE_KTX2_ALIGNMENT_WORKAROUND to 1 in our repo, to disable the workaround, but can't. I am pretty sure this is a validator issue - we can read the file OK.

richg@richgX-PC:/mnt/j/dev/ktx2l2/KTX-Software/build/tools/ktx2check$ ./ktx2check /mnt/j/dev/bu_4_4_test2/basis_universal/bin/kodim18.ktx2
Issues in: /mnt/j/dev/bu_4_4_test2/basis_universal/bin/kodim18.ktx2
    ERROR: Size of image data in file does not match size calculated from
    levelIndex.

@richgel999
Copy link
Author

I'll remove the key value workaround on my end, and if it works then I'll push that to the Basis Universal repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant