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

KTX roundng #29

Open
andy-thomason opened this issue Apr 6, 2017 · 2 comments
Open

KTX roundng #29

andy-thomason opened this issue Apr 6, 2017 · 2 comments

Comments

@andy-thomason
Copy link

Thanks for an excellent tool. I am using it in the cubemap examples for my Vulkan helper library, Vookoo.

I have seen a potential bug in the KTX write code when rounding is following
GL_UNPACK_ALIGNMENT

The image size does not seem to take account of the change in row pitch due to rounding and reports a smaller value that required. This may just be a misunderstanding of the KTX format, so please ignore
this if it is an incorrect assumption.

@dariomanesku
Copy link
Owner

Have a look at imageSaveKtx():

bool imageSaveKtx(const char* _fileName, const Image& _image)

Unpack alignment is taken into account when writing data:

const uint32_t pitchRounding = (KTX_UNPACK_ALIGNMENT-1)-((pitch + KTX_UNPACK_ALIGNMENT-1)&(KTX_UNPACK_ALIGNMENT-1));

but faceSize is not affected by that:

write = fwrite(&faceSize, sizeof(uint32_t), 1, fp);

Try recalculating faceSize with rounding and see if that solves the problem.

@andy-thomason
Copy link
Author

andy-thomason commented Apr 11, 2017 via email

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

2 participants