diff options
author | Nanley Chery <nanley.g.chery@intel.com> | 2015-05-27 10:08:50 -0700 |
---|---|---|
committer | Nanley Chery <nanley.g.chery@intel.com> | 2015-06-05 10:12:10 -0700 |
commit | 5dff760ef19d545e7e1b7ec227acba73b0a7f00c (patch) | |
tree | fce8f476a1b612bb5bdcfc95530d8f7b526bb6ee | |
parent | 14c6ca6078475fb23dced5cae75f419c197339fd (diff) |
Remove the alpha channel in HDR images
* 10x5 block size included alpha, preventing mipmap generation
* Set the entire ktx hdr block header for format and type
-rw-r--r-- | fix_mali_ktx.c | 14 | ||||
-rwxr-xr-x | make_ktxes.sh | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/fix_mali_ktx.c b/fix_mali_ktx.c index 6245c3a..d73e738 100644 --- a/fix_mali_ktx.c +++ b/fix_mali_ktx.c @@ -29,12 +29,16 @@ main(int argc, char* argv[]) #define GL_RGB16F 0x881B #define GL_SRGB8_ALPHA8 0x8C43 - uint32_t gl_rgb16f = GL_RGB16F; + uint32_t d_hdr[5] = {GL_HALF_FLOAT, + 2, + GL_RGB, + GL_RGB16F, + GL_RGB}; uint32_t d_linear[5] = {GL_HALF_FLOAT, 2, GL_RGBA, - GL_RGBA16F, + GL_RGBA16F, GL_RGBA}; uint32_t d_srgb[5] = {GL_UNSIGNED_BYTE, @@ -45,9 +49,9 @@ main(int argc, char* argv[]) uint32_t *packet = NULL; if (hdr) { - packet = &gl_rgb16f; - fseek(file, 7*sizeof(uint32_t), SEEK_SET); // glInternalFormat - fwrite(packet, sizeof(uint32_t), 1, file); + packet = d_hdr; + fseek(file, 4*sizeof(uint32_t), SEEK_SET); // glType + fwrite(packet, 5*sizeof(uint32_t), 1, file); puts("HDR"); } else if (unorm8s) { packet = d_srgb; diff --git a/make_ktxes.sh b/make_ktxes.sh index 7a22b76..a0942fd 100755 --- a/make_ktxes.sh +++ b/make_ktxes.sh @@ -172,8 +172,8 @@ for i in ${Fmt[@]}; do elif [ "$i" = "ldrl" ]; then switch="l" else - decopts+=" -hdra" - encopts+=" -hdra" + decopts+=" -hdr" + encopts+=" -hdr" fi # Generate all the block configurations. |