# Corrupt ETC1 textures

**URL:** <https://forums.imgtec.com/t/corrupt-etc1-textures/1454>\
**Category:** PowerVR Insider\
**Created:** [June 27, 2012, 8:41pm UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454 "2012-06-27T20:41:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![christiancoder-2](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@christiancoder-2](https://forums.imgtec.com/u/christiancoder-2)\
**Post date:** [June 27, 2012, 8:41pm UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/1 "2012-06-27T20:41:44Z")

</div>

In an effort to target android markets that don’t support apk filtering based on GL extensions, specifically texture compression extensions, I have modified our engine to use ETC1 compression supported by all OGLES 2.0 devices. At first this appeared to work fine, but after closer inspection I have noticed that some small&nbsp;  
  
rectangular&nbsp;npot textures are corrupted exclusively on PowerVR hardware (the textures in question render fine on tegra, adreno, and mali devices). You can witness the issue by downloading the current version (1.4.6) of the following game off of the google play market:&nbsp;  
  
[https://play.google.com/store/apps/details?id=com.hotheadgames.google.free.bigwinsoccer&feature=nav\_result#?t=W251bGwsMSwyLDNd](https://play.google.com/store/apps/details?id=com.hotheadgames.google.free.bigwinsoccer&feature=nav_result#?t=W251bGwsMSwyLDNd)&nbsp;, follow the tutorial flow and once you are watching a match notice the advertising banners at the edge of the pitch are corrupted. Is this a known issue?

---

<div class="post-metadata">

**Author:** ![christiancoder-2](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@christiancoder-2](https://forums.imgtec.com/u/christiancoder-2)\
**Post date:** [June 28, 2012, 10:32pm UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/2 "2012-06-28T22:32:23Z")

</div>

So I have confirmed that the issue is related to texture dimensions. I resized one of the corrupted textures to 128x128 and it renders fine so it looks like a bug in the driver… Now I just need to know what dimensions cause the problem…

---

<div class="post-metadata">

**Author:** ![uyoung-liu-2](https://avatars.discourse-cdn.com/v4/letter/u/ecc23a/32.png) [@uyoung-liu-2](https://forums.imgtec.com/u/uyoung-liu-2)\
**Post date:** [June 29, 2012, 2:41am UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/3 "2012-06-29T02:41:04Z")

</div>

i’ve met the same issue,

it seems the driver only support etc image which width&height is power of 2 (16,32,64,…)

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [June 29, 2012, 8:02am UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/4 "2012-06-29T08:02:04Z")

</div>

Hi,  
  
NPOT support is not a core part of OpenGL ES, so just to make sure, are you checking for the extension “GL\_OES\_texture\_npot”? Without this extension, Non-power of two textures will not work properly.  
  
Also, can I ask which devices are you seeing this issue on?  
  
Thanks,  
  
Tobias

---

<div class="post-metadata">

**Author:** ![uyoung-liu-2](https://avatars.discourse-cdn.com/v4/letter/u/ecc23a/32.png) [@uyoung-liu-2](https://forums.imgtec.com/u/uyoung-liu-2)\
**Post date:** [July 2, 2012, 4:20am UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/5 "2012-07-02T04:20:20Z")

</div>

the device: Samsung GalaxyTab PT1010 (Android2.2)  
  
I think the worst part is:  
there is no error(glGetError) after glTexImage2D/glCompressedTexImage2D,  
but when use the texture,   
program crashed.

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [July 3, 2012, 1:16pm UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/6 "2012-07-03T13:16:42Z")

</div>

I believe there’s a known issue with that error check that was fixed in later drivers, I’ll double check this though. So that I can get to the answer quicker, do you know if the NPOT extension is present on that device?

---

<div class="post-metadata">

**Author:** ![christiancoder-2](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@christiancoder-2](https://forums.imgtec.com/u/christiancoder-2)\
**Post date:** [July 3, 2012, 4:59pm UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/7 "2012-07-03T16:59:53Z")

</div>

From the OGLES 2.0 specification:

  

OpenGL ES 2.0 supports non-power of two 2D textures, and cubemaps, with the caveat that mipmapping

and texture wrap modes other than clamp to edge are not supported. Mip-mapping and all OpenGL

ES 2.0 texture wrap modes are supported for power of two 2D textures, and cubemaps.

The OES texture npot extension allows implementations to support mip-mapping and REPEAT and

MIRRORED REPEAT texture wrap modes for non-power of two 2D textures, cubemaps, and also for 3D

textures, if OES texture 3D extension is supported.

  

So the only time you should have to check the npot extension is if you are planning on mipmapping or wrapping a npot, aside from that they should render fine regardless of the texture compression.

---

<div class="post-metadata">

**Author:** ![christiancoder-2](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@christiancoder-2](https://forums.imgtec.com/u/christiancoder-2)\
**Post date:** [July 3, 2012, 7:42pm UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/8 "2012-07-03T19:42:20Z")

</div>

Oh and it is happening on all of our PowerVR test devices (all SGX based, running android 2.2 - 4.0.4)

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [July 4, 2012, 8:04am UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/9 "2012-07-04T08:04:28Z")

</div>

Ah you’re right, sorry! I mis-read your original post and thought you’d mentioned smaller MIP Levels rather than smaller exclusive textures. There was an issue we had previously on some really old devices with lower MIP-Maps for ETC, which is probably why I thought that. I will investigate this further and get back to you.  
  
Thanks,  
  
Tobias

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [July 4, 2012, 9:01am UTC](https://forums.imgtec.com/t/corrupt-etc1-textures/1454/10 "2012-07-04T09:01:54Z")

</div>

Unfortunately it turns out that we don't support NPOT ETC1 - the original spec was written with only POT textures in mind, as it was written against OpenGL ES 1.x. Subsequently our current hardware only supports POT ETC. The fact that you're not getting any sort of error is a bug however, so I will submit a bug report to our driver team to investigate+fix this.  
  
So I'm afraid that on our hardware you'll have to workaround it by using POT textures exclusively for ETC. It's not all bad news though - POT textures generally perform better on most hardware, so it's an optimisation that should give you a performance boost across all devices. It should be noted that you shouldn't need to use square textures, rectangular is fine as long as the individual dimensions are POT.  
  
Thanks,  
  
Tobias  
  
  
Tobias2012-07-04 12:30:29
