Khronos Public Bugzilla
Bug 720 - Writing with compressed textures will always fail due to invalid parameters
Writing with compressed textures will always fail due to invalid parameters
Status: NEW
Product: KTX
Classification: Unclassified
Component: library
unspecified
PC Windows
: P3 normal
: ---
Assigned To: callow.mark
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-24 11:47 PDT by svlad
Modified: 2012-09-24 11:47 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description svlad 2012-09-24 11:47:07 PDT
Writing a compressed texture to the KTX format with libktx 1.0.1 will always fail due to the following code in ktxWriteKTXF():

if (header.glTypeSize != sizeofGLtype(header.glType))
    return KTX_INVALID_VALUE;

According to the format standard a compressed texture shall have a glType value of 0 and a glTypeSize value of 1. The combination of values will always fail the test above.

Removing the check and replacing it with the following one *after* compression has been detected should do the trick:

if (!compressed && (header.glTypeSize != sizeofGLtype(header.glType)))
    return KTX_INVALID_VALUE;^M