Paletted Texture extension

I have a question regarding the use of the paletted texture :

 

in the PowerVR MBX Lite, using opengl ES , is the paletted texture hardware supported and accelerated (do we have a bandwidth benefit) or is it just converted by the driver to a RGBA texture ?

 

Thank you 

Paletted textures are not natively supported and will indeed be converted to RGB/RGBA. To minimise bandwidth usage please consider using PVRTC compressed textures where possible.





Regards,


Georg

Thank you, it is quite clear

 

Where can we find the converter for the pvrt format ? Is there any chance you do provide a library, source code or a dll so we can include the conversion process into our own toolchain ?

 

 

Yes, our PowerVR SDKs contain a utility called PVRTexTool which can generate PVRTC textures. There is also the PVRTexLib library which you can integrate into your own toolchain.





Regards,


Georg

thank you, but which compiler is needed for the windows version ? so far VC6 cannot compile the PVRTexlib :

c:clinkiphpvrtexlibglobals.h(149) : error C2556: ‘class pvrtexlib::float16 __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(149) : error C2371: ‘getMaximumValue’ : redefinition; different basic types
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(151) : error C2556: ‘unsigned int __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(153) : error C2556: ‘unsigned short __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(155) : error C2556: ‘unsigned char __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(157) : error C2556: ‘int __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(159) : error C2556: ‘short __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphpvrtexlibglobals.h(161) : error C2556: ‘signed char __cdecl pvrtexlib::getMaximumValue(void)’ : overloaded function differs only by return type from ‘float __cdecl pvrtexlib::getMaximumValue(void)’
c:clinkiphpvrtexlibglobals.h(147) : see declaration of 'getMaximumValue’
c:clinkiphcpvrtextureheader.h(210) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(210) : error C2252: ‘u32CURRENT_VERSION’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(243) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(243) : error C2252: ‘PVRTEX_MIPMAP’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(244) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(244) : error C2252: ‘PVRTEX_TWIDDLE’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(245) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(245) : error C2252: ‘PVRTEX_BUMPMAP’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(246) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(246) : error C2252: ‘PVRTEX_TILING’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(247) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(247) : error C2252: ‘PVRTEX_CUBEMAP’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(248) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(248) : error C2252: ‘PVRTEX_FALSEMIPCOL’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(249) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(249) : error C2252: ‘PVRTEX_VOLUME’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(250) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(250) : error C2252: ‘PVRTEX_ALPHA’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(253) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(253) : error C2252: ‘PVRTEX_IDENTIFIER’ : pure specifier can only be specified for functions
c:clinkiphcpvrtextureheader.h(254) : error C2258: illegal pure syntax, must be '= 0’
c:clinkiphcpvrtextureheader.h(254) : error C2252: ‘PVRTEX_PIXELTYPE’ : pure specifier can only be specified for functions
c:clinkiphcpvrtexture.h(176) : error C2039: ‘u32CURRENT_VERSION’ : is not a member of ‘CPVRTextureHeader’
c:clinkiphcpvrtextureheader.h(37) : see declaration of 'CPVRTextureHeader’
c:clinkiphcpvrtexture.h(176) : error C2065: ‘u32CURRENT_VERSION’ : undeclared identifier
c:clinkiphcpvrtexture.h(184) : error C2039: ‘u32CURRENT_VERSION’ : is not a member of ‘CPVRTextureHeader’
c:clinkiphcpvrtextureheader.h(37) : see declaration of 'CPVRTextureHeader’
c:clinkiphpvrtexlib.h(40) : warning C4275: non dll-interface class ‘singleton<class pvrtexlib::PVRTextureUtilities>’ used as base for dll-interface class ‘pvrtexlib::PVRTextureUtilities’
c:clinkiphpvrtexlib.h(39) : see declaration of ‘PVRTextureUtilities’

I’m afraid that VC6 is no longer supported in the SDK and it looks like it’s choking on some of the template specialisations and some enum defs. To use PVRTexLib you’ll probably need to update your compiler.

I have installed VC++ 2008 express in order to test your library, it does compile properly however the code crashed when trying to compress the texture, i am passing the code i am using, i took it from the document, so it should work unless i forgot something , it does crash at the PVRU->CompressPVR(sOriginalTexture, sCompressedTexture, 0); call




#include "PVRTexLib.h"
using namespace pvrtexlib;

//PVRTextureUtilities PVRU;



void test_pvrt()
{

unsigned char data;
int i;

data = (unsigned char )malloc(256256
4 );
for(i=0;i<2562564;i++)
{
data = 255;
}


// get the utilities instance
PVRTextureUtilities *PVRU = PVRTextureUtilities::ptr();



// make a CPVRTexture instance with data passed
CPVRTexture sOriginalTexture( 256, // u32Width,
256, // u32Height,
0, // u32MipMapCount,
1, // u32NumSurfaces,
false, // bBorder,
false, // bTwiddled,
false, // bCubeMap,
false, // bVolume,
false, // bFalseMips,
true, // bHasAlpha,
MGLPT_ARGB, // ePixelType,
0.0f, // fNormalMap,
data // pPixelData
);

CPVRTexture sCompressedTexture( sOriginalTexture.getHeader() );

sCompressedTexture.setPixelType(OGL_PVRTC4);


PVRU->CompressPVR(sOriginalTexture, sCompressedTexture, 0);


sCompressedTexture.writeToFile(“test.pvr”);

}


forgot to mention that i am using PVRTexLib_2.03.23.1162.zip

and “data = 255” is “data = 255;” did not paste propely

The code you are using looks correct except for where the sOriginalTexture is being constructed where MGLPT_ARGB_8888 is used. As of the 2.3 release of our SDK (PVRTexLib v3.7) the standard format for 32bpp changed. If you try to compress from a non-standard format PVRTexLib throws an exception (hence the crash). It’s a good idea to handle these exceptions (see in 1.3 in the PVRTexLib doc) as they’ll give you (and me) some idea as to what’s going wrong.





The best fix is to use the eInt8StandardPixelType constant for this value (defined in PVRTexLibGlobals.h).





I’ve just noticed that the example has not been updated in the documentation to reflect the change in format and will need to be fixed asap :S





I hope this helps - apologies for the mistake in the docs.

Thamk you Gordon, indeed when using DX10_R8G8B8A8_UNORM , it does not longer crash…

Xmas wrote:
Paletted textures are not natively supported and will indeed be converted to RGB/RGBA.



But Apple's iPhone documentation states that GL_OES_compressed_paletted_texture is a supported extension on the iPhone. (It lists GL_IMG_texture_compression_pvrtc as a separate extension that's also supported.)



I'd be inclined to believe the people that made the GPU (you) over the OEM (Apple), but I'd still like to know the real story.



Support for GL_OES_compressed_paletted_texture is required by OpenGL ES 1.1. However, that doesn’t mean it has to be a native hardware format, just that the driver will accept data in paletted format. The driver will internally expand paletted textures to RGB/RGBA.