Skip to content

calculate serialized size and actually serialize in two separate calls #614

Answered by MarkCallow
AnonN10 asked this question in Q&A
Discussion options

You must be logged in to vote

There is no function for that but it would not be difficult to write one for libktx. There are a couple of wrinkles preventing it being easy outside the library. There isn't any way to get the supercompressionGlobalData byte length from a ktxTexture2 object (only needed for textures compressed with BasisLZ/ETC1S). The internal hashlist has to be traversed to calculated the length of the key-value data.

I'd happily accept a PR to add such a function to libktx.

An alternative is to add a variant of ktxTexture2_WriteToMemory that lets you provide a pointer to a memory allocator.

Which is better for your situation?

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@MarkCallow
Comment options

@AnonN10
Comment options

@MarkCallow
Comment options

@AnonN10
Comment options

@MarkCallow
Comment options

Answer selected by AnonN10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants