Khronos Public Bugzilla
Bug 720 - Writing with compressed textures will always fail due to invalid parameters
Summary: Writing with compressed textures will always fail due to invalid parameters
Status: NEW
Alias: None
Product: KTX
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: PC Windows
: P3 normal
Target Milestone: ---
Assignee: Mark Callow
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
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