Imagination PowerVR SDK Blog

Pre-multiplied Alpha Limbo?


#1

Hello!

Unless I am missing

something I appear to be caught in somewhat of a limbo situation on a

particular issue with regards to uploading pre-multiplied alpha pvr

textures into my texture system.

I’m targeting the iOS platform & using the OpenGL ES 2.0 API, & specifically for this issue, loading uncompressed formats that I can embed mipmap levels into (e.g. pvr texture header version 2’s OGL_RGBA_4444, OGL_RGB_565, OGL_RGBA_8888, etc.).

It appears that either:

  • The pvr texture version 3 header, which has the premultiplied flag











    PVRTEX3_PREMULTIPLIED of the flags 











    u32Flags field, doesn’t support the pixel formats I need (it appears to only support compression formats currently).
  • Alternatively using the pvr texture version 2 header (which has the desired OpenGL texture formats I need), it doesn’t appear to have a way to access (in code) whether the texture being loaded has pre-mulitplied alpha or not. 

How long until uncomressed formats will be added into pvr texture version 3 header’s pixel formats or am I overlooking where they are in the spec/docs?

&/or is there a way to do it using the pvr texture version 2 header?

Thank you.




#2

Hi Codey,

The PVR3 header doesn’t define enums for uncompressed formats but actually supports a huge range of uncompressed formats through a dynamic system. There are macros in PVRTTexture.h called PVRTGENPIXELIDn (n=1 to 4). These macros will generate an uncompressed pixel identifier for you from up to 4 channel names (lower case, r,g,b,a,l,i or x) and an equivalent number of bits per channel. (e.g. PVRTGENPIXELID4(‘r’,‘g’,‘b’,‘a’,8,8,8,8)).

This will generate a 64-bit identifier that is API independent. I’d suggest looking through our OpenGL ES tools code or reading up further on the PVR3 file format here:https://www.imgtec.com/powervr/insider/docs/PVR%20File%20Format.Specification.1.0.11.External.pdf

Thanks,

Tobias