PVRTexTool bugged pvrt on Android [Solved]

I’m using PVRTexTool from SDK Build: 2.10@863921. On our iOS devices, there are no problem. PVR are correctly drawn but on our Android devices there are color problems. Is it a bug in android drivers or in tool ?





Previously, we used Apple tool TextureTool without problems.





thanks,





This a capture from Nexus 4.0.4. Same bug on Galaxy Tab 7 2.3.7.


http://imgur.com/YWRqn


ellis23232012-04-12 08:51:45

Hi ellis,

We’ve encountered this problem before whilst developing the latest tools but it should have been fixed before release… Would it be possible for you to send one of the broken pvr files to devtech@imgtec.com? I’ll have a look and try to find out where the problem lies.

Thanks,

Tobias



Hi Tobias,





Thanks for your response. I sent a mail with a screenshot, a png texture and the broken pvr.






Hi Ellis,

I haven't received your email yet (might be a problem with our mail filter, we're trying to fix it atm) , but I thought I would check a couple of things with you. Firstly - are you using our tools code to load the textures? If so is this also from the same SDK version or is it an earlier piece of code? If it's less recent (or if you're not sure) try downloading the latest package from our website and using the code from this.

Secondly - if this is up to date it might be worth doing the following:
Try adding the line "PVRTSIZEASSERT(PVRTextureHeaderV3,PVRTEX3_HEADERSIZE);" to PVRTTexture.h just after "#define PVRTEX3_HEADERSIZE 52" (around line 278).

During compilation, this will throw an exception if there is a problem with some of the code.

Thanks,

Tobias




Hi Tobias,





i sent mail a second time.


1. we don’t use your code


2. we are using the same code to load PVRs on iOS and Android.














Hi Ellis,

Yep, I’ve just received both your emails shortly after each other (which is weird) and I’ve had a look at it. The texture file itself is fine, so if you’re using your own texture loading code, my guess is that you’re hitting the same problems that I had when writing ours.

As the header is a struct, it’ll be packed differently on different platforms - are you reading the structure in one go? If so, are you using pragma packing to align the struct in memory to 4byte boundaries? If not, adding this should solve your problem. The same thing will be true if you’re using any meta data that is read/written as structs.

Essentially the problem is that the texture data is loaded from the wrong memory location. The other possibility is that you’re not reading past all the meta data (or reading too far) or incorrectly calculating some other offset before the texture data. If none of this works for you I’ll be happy to look over your loading code if you’d like?

Thanks,

Tobias



Thanks for your response.





You’re probably right. I’ll try to fix it tomorrow and confirm your gess.





Thanks

Hi tobias,





You’re right. I just changed my sizof(PVR…) into 52 and it works. You rocks!





Thanks for your help,