1 /******************************************************************************
2
3 @File PVRTTexture.cpp
4
5 @Title PVRTTexture
6
7 @Version
8
9 @Copyright Copyright (c) Imagination Technologies Limited.
10
11 @Platform ANSI compatible
12
13 @Description Texture loading.
14
15 ******************************************************************************/
16 #include <string.h>
17 #include <stdlib.h>
18
19 #include "PVRTTexture.h"
20 #include "PVRTMap.h"
21
22 /*****************************************************************************
23 ** Functions
24 *****************************************************************************/
25 /*!***************************************************************************
26 @Function ReadFromPtr
27 @Input pDataCursor The data to read
28 @Description Reads from a pointer of memory in to the meta data block.
29 *****************************************************************************/
ReadFromPtr(const unsigned char ** pDataCursor)30 bool MetaDataBlock::ReadFromPtr(const unsigned char** pDataCursor)
31 {
32 memcpy(&DevFOURCC, *pDataCursor, sizeof(PVRTuint32)); *pDataCursor += sizeof(PVRTuint32);
33 memcpy(&u32Key, *pDataCursor, sizeof(PVRTuint32)); *pDataCursor += sizeof(PVRTuint32);
34 memcpy(&u32DataSize, *pDataCursor, sizeof(PVRTuint32)); *pDataCursor += sizeof(PVRTuint32);
35 if(u32DataSize > 0)
36 {
37 Data = new PVRTuint8[u32DataSize];
38 memcpy(Data, *pDataCursor, u32DataSize);
39 *pDataCursor += u32DataSize;
40 }
41
42 return true;
43 }
44
45 /*!***************************************************************************
46 @Function PVRTTextureLoadTiled
47 @Modified pDst Texture to place the tiled data
48 @Input nWidthDst Width of destination texture
49 @Input nHeightDst Height of destination texture
50 @Input pSrc Texture to tile
51 @Input nWidthSrc Width of source texture
52 @Input nHeightSrc Height of source texture
53 @Input nElementSize Bytes per pixel
54 @Input bTwiddled True if the data is twiddled
55 @Description Needed by PVRTTextureTile() in the various PVRTTextureAPIs
56 *****************************************************************************/
PVRTTextureLoadTiled(PVRTuint8 * const pDst,const unsigned int nWidthDst,const unsigned int nHeightDst,const PVRTuint8 * const pSrc,const unsigned int nWidthSrc,const unsigned int nHeightSrc,const unsigned int nElementSize,const bool bTwiddled)57 void PVRTTextureLoadTiled(
58 PVRTuint8 * const pDst,
59 const unsigned int nWidthDst,
60 const unsigned int nHeightDst,
61 const PVRTuint8 * const pSrc,
62 const unsigned int nWidthSrc,
63 const unsigned int nHeightSrc,
64 const unsigned int nElementSize,
65 const bool bTwiddled)
66 {
67 unsigned int nXs, nYs;
68 unsigned int nXd, nYd;
69 unsigned int nIdxSrc, nIdxDst;
70
71 for(nIdxDst = 0; nIdxDst < nWidthDst*nHeightDst; ++nIdxDst)
72 {
73 if(bTwiddled)
74 {
75 PVRTTextureDeTwiddle(nXd, nYd, nIdxDst);
76 }
77 else
78 {
79 nXd = nIdxDst % nWidthDst;
80 nYd = nIdxDst / nWidthDst;
81 }
82
83 nXs = nXd % nWidthSrc;
84 nYs = nYd % nHeightSrc;
85
86 if(bTwiddled)
87 {
88 PVRTTextureTwiddle(nIdxSrc, nXs, nYs);
89 }
90 else
91 {
92 nIdxSrc = nYs * nWidthSrc + nXs;
93 }
94
95 memcpy(pDst + nIdxDst*nElementSize, pSrc + nIdxSrc*nElementSize, nElementSize);
96 }
97 }
98
99 /*!***************************************************************************
100 @Function PVRTTextureCreate
101 @Input w Size of the texture
102 @Input h Size of the texture
103 @Input wMin Minimum size of a texture level
104 @Input hMin Minimum size of a texture level
105 @Input nBPP Bits per pixel of the format
106 @Input bMIPMap Create memory for MIP-map levels also?
107 @Return Allocated texture memory (must be free()d)
108 @Description Creates a PVRTextureHeaderV3 structure, including room for
109 the specified texture, in memory.
110 *****************************************************************************/
PVRTTextureCreate(const unsigned int w,const unsigned int h,const unsigned int wMin,const unsigned int hMin,const unsigned int nBPP,const bool bMIPMap)111 PVRTextureHeaderV3 *PVRTTextureCreate(
112 const unsigned int w,
113 const unsigned int h,
114 const unsigned int wMin,
115 const unsigned int hMin,
116 const unsigned int nBPP,
117 const bool bMIPMap)
118 {
119 size_t len;
120 unsigned char *p;
121
122 {
123 unsigned int wTmp = w, hTmp = h;
124
125 len = 0;
126 do
127 {
128 len += PVRT_MAX(wTmp, wMin) * PVRT_MAX(hTmp, hMin);
129 wTmp >>= 1;
130 hTmp >>= 1;
131 }
132 while(bMIPMap && (wTmp || hTmp));
133 }
134
135 len = (len * nBPP) / 8;
136 len += PVRTEX3_HEADERSIZE;
137
138 p = (unsigned char*)malloc(len);
139 _ASSERT(p);
140
141 if(p)
142 {
143 PVRTextureHeaderV3 * const psTexHeader = (PVRTextureHeaderV3*)p;
144
145 *psTexHeader=PVRTextureHeaderV3();
146
147 psTexHeader->u32Width=w;
148 psTexHeader->u32Height=h;
149
150 return psTexHeader;
151 }
152 else
153 {
154 return 0;
155 }
156 }
157
158
159 /*!***************************************************************************
160 @Function PVRTTextureTwiddle
161 @Output a Twiddled value
162 @Input u Coordinate axis 0
163 @Input v Coordinate axis 1
164 @Description Combine a 2D coordinate into a twiddled value
165 *****************************************************************************/
PVRTTextureTwiddle(unsigned int & a,const unsigned int u,const unsigned int v)166 void PVRTTextureTwiddle(unsigned int &a, const unsigned int u, const unsigned int v)
167 {
168 _ASSERT(!((u|v) & 0xFFFF0000));
169 a = 0;
170 for(int i = 0; i < 16; ++i)
171 {
172 a |= ((u & (1 << i)) << (i+1));
173 a |= ((v & (1 << i)) << (i+0));
174 }
175 }
176
177 /*!***************************************************************************
178 @Function PVRTTextureDeTwiddle
179 @Output u Coordinate axis 0
180 @Output v Coordinate axis 1
181 @Input a Twiddled value
182 @Description Extract 2D coordinates from a twiddled value.
183 *****************************************************************************/
PVRTTextureDeTwiddle(unsigned int & u,unsigned int & v,const unsigned int a)184 void PVRTTextureDeTwiddle(unsigned int &u, unsigned int &v, const unsigned int a)
185 {
186 u = 0;
187 v = 0;
188 for(int i = 0; i < 16; ++i)
189 {
190 u |= (a & (1 << ((2*i)+1))) >> (i+1);
191 v |= (a & (1 << ((2*i)+0))) >> (i+0);
192 }
193 }
194
195 /*!***********************************************************************
196 @Function PVRTGetBitsPerPixel
197 @Input u64PixelFormat A PVR Pixel Format ID.
198 @Return const PVRTuint32 Number of bits per pixel.
199 @Description Returns the number of bits per pixel in a PVR Pixel Format
200 identifier.
201 *************************************************************************/
PVRTGetBitsPerPixel(PVRTuint64 u64PixelFormat)202 PVRTuint32 PVRTGetBitsPerPixel(PVRTuint64 u64PixelFormat)
203 {
204 if((u64PixelFormat&PVRTEX_PFHIGHMASK)!=0)
205 {
206 PVRTuint8* PixelFormatChar=(PVRTuint8*)&u64PixelFormat;
207 return PixelFormatChar[4]+PixelFormatChar[5]+PixelFormatChar[6]+PixelFormatChar[7];
208 }
209 else
210 {
211 switch (u64PixelFormat)
212 {
213 case ePVRTPF_BW1bpp:
214 return 1;
215 case ePVRTPF_PVRTCI_2bpp_RGB:
216 case ePVRTPF_PVRTCI_2bpp_RGBA:
217 case ePVRTPF_PVRTCII_2bpp:
218 return 2;
219 case ePVRTPF_PVRTCI_4bpp_RGB:
220 case ePVRTPF_PVRTCI_4bpp_RGBA:
221 case ePVRTPF_PVRTCII_4bpp:
222 case ePVRTPF_ETC1:
223 case ePVRTPF_EAC_R11:
224 case ePVRTPF_ETC2_RGB:
225 case ePVRTPF_ETC2_RGB_A1:
226 case ePVRTPF_DXT1:
227 case ePVRTPF_BC4:
228 return 4;
229 case ePVRTPF_DXT2:
230 case ePVRTPF_DXT3:
231 case ePVRTPF_DXT4:
232 case ePVRTPF_DXT5:
233 case ePVRTPF_BC5:
234 case ePVRTPF_EAC_RG11:
235 case ePVRTPF_ETC2_RGBA:
236 return 8;
237 case ePVRTPF_YUY2:
238 case ePVRTPF_UYVY:
239 case ePVRTPF_RGBG8888:
240 case ePVRTPF_GRGB8888:
241 return 16;
242 case ePVRTPF_SharedExponentR9G9B9E5:
243 return 32;
244 case ePVRTPF_NumCompressedPFs:
245 return 0;
246 }
247 }
248 return 0;
249 }
250
251 /*!***********************************************************************
252 @Function PVRTGetFormatMinDims
253 @Input u64PixelFormat A PVR Pixel Format ID.
254 @Modified minX Returns the minimum width.
255 @Modified minY Returns the minimum height.
256 @Modified minZ Returns the minimum depth.
257 @Description Gets the minimum dimensions (x,y,z) for a given pixel format.
258 *************************************************************************/
PVRTGetFormatMinDims(PVRTuint64 u64PixelFormat,PVRTuint32 & minX,PVRTuint32 & minY,PVRTuint32 & minZ)259 void PVRTGetFormatMinDims(PVRTuint64 u64PixelFormat, PVRTuint32 &minX, PVRTuint32 &minY, PVRTuint32 &minZ)
260 {
261 switch(u64PixelFormat)
262 {
263 case ePVRTPF_DXT1:
264 case ePVRTPF_DXT2:
265 case ePVRTPF_DXT3:
266 case ePVRTPF_DXT4:
267 case ePVRTPF_DXT5:
268 case ePVRTPF_BC4:
269 case ePVRTPF_BC5:
270 case ePVRTPF_ETC1:
271 case ePVRTPF_ETC2_RGB:
272 case ePVRTPF_ETC2_RGBA:
273 case ePVRTPF_ETC2_RGB_A1:
274 case ePVRTPF_EAC_R11:
275 case ePVRTPF_EAC_RG11:
276 minX = 4;
277 minY = 4;
278 minZ = 1;
279 break;
280 case ePVRTPF_PVRTCI_4bpp_RGB:
281 case ePVRTPF_PVRTCI_4bpp_RGBA:
282 minX = 8;
283 minY = 8;
284 minZ = 1;
285 break;
286 case ePVRTPF_PVRTCI_2bpp_RGB:
287 case ePVRTPF_PVRTCI_2bpp_RGBA:
288 minX = 16;
289 minY = 8;
290 minZ = 1;
291 break;
292 case ePVRTPF_PVRTCII_4bpp:
293 minX = 4;
294 minY = 4;
295 minZ = 1;
296 break;
297 case ePVRTPF_PVRTCII_2bpp:
298 minX = 8;
299 minY = 4;
300 minZ = 1;
301 break;
302 case ePVRTPF_UYVY:
303 case ePVRTPF_YUY2:
304 case ePVRTPF_RGBG8888:
305 case ePVRTPF_GRGB8888:
306 minX = 2;
307 minY = 1;
308 minZ = 1;
309 break;
310 case ePVRTPF_BW1bpp:
311 minX = 8;
312 minY = 1;
313 minZ = 1;
314 break;
315 default: //Non-compressed formats all return 1.
316 minX = 1;
317 minY = 1;
318 minZ = 1;
319 break;
320 }
321 }
322
323 /*!***********************************************************************
324 @Function PVRTGetTextureDataSize
325 @Input iMipLevel Specifies a mip level to check, 'PVRTEX_ALLMIPLEVELS'
326 can be passed to get the size of all MIP levels.
327 @Input bAllSurfs Size of all surfaces is calculated if true,
328 only a single surface if false.
329 @Input bAllFaces Size of all faces is calculated if true,
330 only a single face if false.
331 @Return PVRTuint32 Size in BYTES of the specified texture area.
332 @Description Gets the size in BYTES of the texture, given various input
333 parameters. User can retrieve the size of either all
334 surfaces or a single surface, all faces or a single face and
335 all MIP-Maps or a single specified MIP level.
336 *************************************************************************/
PVRTGetTextureDataSize(PVRTextureHeaderV3 sTextureHeader,PVRTint32 iMipLevel,bool bAllSurfaces,bool bAllFaces)337 PVRTuint32 PVRTGetTextureDataSize(PVRTextureHeaderV3 sTextureHeader, PVRTint32 iMipLevel, bool bAllSurfaces, bool bAllFaces)
338 {
339 //The smallest divisible sizes for a pixel format
340 PVRTuint32 uiSmallestWidth=1;
341 PVRTuint32 uiSmallestHeight=1;
342 PVRTuint32 uiSmallestDepth=1;
343
344 PVRTuint64 PixelFormatPartHigh = sTextureHeader.u64PixelFormat&PVRTEX_PFHIGHMASK;
345
346 //If the pixel format is compressed, get the pixel format's minimum dimensions.
347 if (PixelFormatPartHigh==0)
348 {
349 PVRTGetFormatMinDims((EPVRTPixelFormat)sTextureHeader.u64PixelFormat, uiSmallestWidth, uiSmallestHeight, uiSmallestDepth);
350 }
351
352 //Needs to be 64-bit integer to support 16kx16k and higher sizes.
353 PVRTuint64 uiDataSize = 0;
354 if (iMipLevel==-1)
355 {
356 for (PVRTuint8 uiCurrentMIP = 0; uiCurrentMIP<sTextureHeader.u32MIPMapCount; ++uiCurrentMIP)
357 {
358 //Get the dimensions of the current MIP Map level.
359 PVRTuint32 uiWidth = PVRT_MAX(1,sTextureHeader.u32Width>>uiCurrentMIP);
360 PVRTuint32 uiHeight = PVRT_MAX(1,sTextureHeader.u32Height>>uiCurrentMIP);
361 PVRTuint32 uiDepth = PVRT_MAX(1,sTextureHeader.u32Depth>>uiCurrentMIP);
362
363 //If pixel format is compressed, the dimensions need to be padded.
364 if (PixelFormatPartHigh==0)
365 {
366 uiWidth=uiWidth+( (-1*uiWidth)%uiSmallestWidth);
367 uiHeight=uiHeight+( (-1*uiHeight)%uiSmallestHeight);
368 uiDepth=uiDepth+( (-1*uiDepth)%uiSmallestDepth);
369 }
370
371 //Add the current MIP Map's data size to the total.
372 uiDataSize+=(PVRTuint64)PVRTGetBitsPerPixel(sTextureHeader.u64PixelFormat)*(PVRTuint64)uiWidth*(PVRTuint64)uiHeight*(PVRTuint64)uiDepth;
373 }
374 }
375 else
376 {
377 //Get the dimensions of the specified MIP Map level.
378 PVRTuint32 uiWidth = PVRT_MAX(1,sTextureHeader.u32Width>>iMipLevel);
379 PVRTuint32 uiHeight = PVRT_MAX(1,sTextureHeader.u32Height>>iMipLevel);
380 PVRTuint32 uiDepth = PVRT_MAX(1,sTextureHeader.u32Depth>>iMipLevel);
381
382 //If pixel format is compressed, the dimensions need to be padded.
383 if (PixelFormatPartHigh==0)
384 {
385 uiWidth=uiWidth+( (-1*uiWidth)%uiSmallestWidth);
386 uiHeight=uiHeight+( (-1*uiHeight)%uiSmallestHeight);
387 uiDepth=uiDepth+( (-1*uiDepth)%uiSmallestDepth);
388 }
389
390 //Work out the specified MIP Map's data size
391 uiDataSize=PVRTGetBitsPerPixel(sTextureHeader.u64PixelFormat)*uiWidth*uiHeight*uiDepth;
392 }
393
394 //The number of faces/surfaces to register the size of.
395 PVRTuint32 numfaces = ((bAllFaces)?(sTextureHeader.u32NumFaces):(1));
396 PVRTuint32 numsurfs = ((bAllSurfaces)?(sTextureHeader.u32NumSurfaces):(1));
397
398 //Multiply the data size by number of faces and surfaces specified, and return.
399 return (PVRTuint32)(uiDataSize/8)*numsurfs*numfaces;
400 }
401
402 /*!***********************************************************************
403 @Function PVRTConvertOldTextureHeaderToV3
404 @Input LegacyHeader Legacy header for conversion.
405 @Modified NewHeader New header to output into.
406 @Modified MetaData MetaData Map to output into.
407 @Description Converts a legacy texture header (V1 or V2) to a current
408 generation header (V3)
409 *************************************************************************/
PVRTConvertOldTextureHeaderToV3(const PVR_Texture_Header * LegacyHeader,PVRTextureHeaderV3 & NewHeader,CPVRTMap<PVRTuint32,CPVRTMap<PVRTuint32,MetaDataBlock>> * pMetaData)410 void PVRTConvertOldTextureHeaderToV3(const PVR_Texture_Header* LegacyHeader, PVRTextureHeaderV3& NewHeader, CPVRTMap<PVRTuint32, CPVRTMap<PVRTuint32,MetaDataBlock> >* pMetaData)
411 {
412 //Setup variables
413 bool isPreMult;
414 PVRTuint64 ptNew;
415 EPVRTColourSpace cSpaceNew;
416 EPVRTVariableType chanTypeNew;
417
418 //Map the old enum to the new format.
419 PVRTMapLegacyTextureEnumToNewFormat((PVRTPixelType)(LegacyHeader->dwpfFlags&0xff),ptNew,cSpaceNew,chanTypeNew,isPreMult);
420
421 //Check if this is a cube map.
422 bool isCubeMap = (LegacyHeader->dwpfFlags&PVRTEX_CUBEMAP)!=0;
423
424 //Setup the new header.
425 NewHeader.u64PixelFormat=ptNew;
426 NewHeader.u32ChannelType=chanTypeNew;
427 NewHeader.u32ColourSpace=cSpaceNew;
428 NewHeader.u32Depth=1;
429 NewHeader.u32Flags=isPreMult?PVRTEX3_PREMULTIPLIED:0;
430 NewHeader.u32Height=LegacyHeader->dwHeight;
431 NewHeader.u32MetaDataSize=0;
432 NewHeader.u32MIPMapCount=(LegacyHeader->dwpfFlags&PVRTEX_MIPMAP?LegacyHeader->dwMipMapCount+1:1); //Legacy headers have a MIP Map count of 0 if there is only the top level. New Headers have a count of 1.
433 NewHeader.u32NumFaces=(isCubeMap?6:1);
434
435 //Only compute the number of surfaces if it's a V2 header, else default to 1 surface.
436 if (LegacyHeader->dwHeaderSize==sizeof(PVR_Texture_Header))
437 NewHeader.u32NumSurfaces=(LegacyHeader->dwNumSurfs/(isCubeMap?6:1));
438 else
439 NewHeader.u32NumSurfaces=1;
440
441 NewHeader.u32Version=PVRTEX3_IDENT;
442 NewHeader.u32Width=LegacyHeader->dwWidth;
443
444 //Clear any currently stored MetaData, or it will be inaccurate.
445 if (pMetaData)
446 {
447 pMetaData->Clear();
448 }
449
450 //Check if this is a normal map.
451 if (LegacyHeader->dwpfFlags&PVRTEX_BUMPMAP && pMetaData)
452 {
453 //Get a reference to the correct block.
454 MetaDataBlock& mbBumpData=(*pMetaData)[PVRTEX_CURR_IDENT][ePVRTMetaDataBumpData];
455
456 //Set up the block.
457 mbBumpData.DevFOURCC=PVRTEX_CURR_IDENT;
458 mbBumpData.u32Key=ePVRTMetaDataBumpData;
459 mbBumpData.u32DataSize=8;
460 mbBumpData.Data=new PVRTuint8[8];
461
462 //Setup the data for the block.
463 float bumpScale = 1.0f;
464 const char* bumpOrder = "xyz";
465
466 //Copy the bumpScale into the data.
467 memcpy(mbBumpData.Data,&bumpScale,4);
468
469 //Clear the string
470 memset(mbBumpData.Data+4,0,4);
471
472 //Copy the bumpOrder into the data.
473 memcpy(mbBumpData.Data+4, bumpOrder,3);
474
475 //Increment the meta data size.
476 NewHeader.u32MetaDataSize+=(12+mbBumpData.u32DataSize);
477 }
478
479 //Check if for vertical flip orientation.
480 if (LegacyHeader->dwpfFlags&PVRTEX_VERTICAL_FLIP && pMetaData)
481 {
482 //Get the correct meta data block
483 MetaDataBlock& mbTexOrientation=(*pMetaData)[PVRTEX_CURR_IDENT][ePVRTMetaDataTextureOrientation];
484
485 //Set the block up.
486 mbTexOrientation.u32DataSize=3;
487 mbTexOrientation.Data=new PVRTuint8[3];
488 mbTexOrientation.DevFOURCC=PVRTEX_CURR_IDENT;
489 mbTexOrientation.u32Key=ePVRTMetaDataTextureOrientation;
490
491 //Initialise the block to default orientation.
492 memset(mbTexOrientation.Data,0,3);
493
494 //Set the block oriented upwards.
495 mbTexOrientation.Data[ePVRTAxisY]=ePVRTOrientUp;
496
497 //Increment the meta data size.
498 NewHeader.u32MetaDataSize+=(12+mbTexOrientation.u32DataSize);
499 }
500 }
501
502 /*!***********************************************************************
503 @Function PVRTMapLegacyTextureEnumToNewFormat
504 @Input OldFormat Legacy Enumeration Value
505 @Modified newType New PixelType identifier.
506 @Modified newCSpace New ColourSpace
507 @Modified newChanType New Channel Type
508 @Modified isPreMult Whether format is pre-multiplied
509 @Description Maps a legacy enumeration value to the new PVR3 style format.
510 *************************************************************************/
PVRTMapLegacyTextureEnumToNewFormat(PVRTPixelType OldFormat,PVRTuint64 & newType,EPVRTColourSpace & newCSpace,EPVRTVariableType & newChanType,bool & isPreMult)511 void PVRTMapLegacyTextureEnumToNewFormat(PVRTPixelType OldFormat, PVRTuint64& newType, EPVRTColourSpace& newCSpace, EPVRTVariableType& newChanType, bool& isPreMult)
512 {
513 //Default value.
514 isPreMult=false;
515
516 switch (OldFormat)
517 {
518 case MGLPT_ARGB_4444:
519 {
520 newType=PVRTGENPIXELID4('a','r','g','b',4,4,4,4);
521 newCSpace=ePVRTCSpacelRGB;
522 newChanType=ePVRTVarTypeUnsignedShortNorm;
523 break;
524 }
525
526 case MGLPT_ARGB_1555:
527 {
528 newType=PVRTGENPIXELID4('a','r','g','b',1,5,5,5);
529 newCSpace=ePVRTCSpacelRGB;
530 newChanType=ePVRTVarTypeUnsignedShortNorm;
531 break;
532 }
533
534 case MGLPT_RGB_565:
535 {
536 newType=PVRTGENPIXELID3('r','g','b',5,6,5);
537 newCSpace=ePVRTCSpacelRGB;
538 newChanType=ePVRTVarTypeUnsignedShortNorm;
539 break;
540 }
541
542 case MGLPT_RGB_555:
543 {
544 newType=PVRTGENPIXELID4('x','r','g','b',1,5,5,5);
545 newCSpace=ePVRTCSpacelRGB;
546 newChanType=ePVRTVarTypeUnsignedShortNorm;
547 break;
548 }
549
550 case MGLPT_RGB_888:
551 {
552 newType=PVRTGENPIXELID3('r','g','b',8,8,8);
553 newCSpace=ePVRTCSpacelRGB;
554 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
555 break;
556 }
557
558 case MGLPT_ARGB_8888:
559 {
560 newType=PVRTGENPIXELID4('a','r','g','b',8,8,8,8);
561 newCSpace=ePVRTCSpacelRGB;
562 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
563 break;
564 }
565
566 case MGLPT_ARGB_8332:
567 {
568 newType=PVRTGENPIXELID4('a','r','g','b',8,3,3,2);
569 newCSpace=ePVRTCSpacelRGB;
570 newChanType=ePVRTVarTypeUnsignedShortNorm;
571 break;
572 }
573
574 case MGLPT_I_8:
575 {
576 newType=PVRTGENPIXELID1('i',8);
577 newCSpace=ePVRTCSpacelRGB;
578 newChanType=ePVRTVarTypeUnsignedByteNorm;
579 break;
580 }
581
582 case MGLPT_AI_88:
583 {
584 newType=PVRTGENPIXELID2('a','i',8,8);
585 newCSpace=ePVRTCSpacelRGB;
586 newChanType=ePVRTVarTypeUnsignedShortNorm;
587 break;
588 }
589
590 case MGLPT_1_BPP:
591 {
592 newType=ePVRTPF_BW1bpp;
593 newCSpace=ePVRTCSpacelRGB;
594 newChanType=ePVRTVarTypeUnsignedByteNorm;
595 break;
596 }
597
598 case MGLPT_VY1UY0:
599 {
600 newType=ePVRTPF_YUY2;
601 newCSpace=ePVRTCSpacelRGB;
602 newChanType=ePVRTVarTypeUnsignedByteNorm;
603 break;
604 }
605
606 case MGLPT_Y1VY0U:
607 {
608 newType=ePVRTPF_UYVY;
609 newCSpace=ePVRTCSpacelRGB;
610 newChanType=ePVRTVarTypeUnsignedByteNorm;
611 break;
612 }
613
614 case MGLPT_PVRTC2:
615 {
616 newType=ePVRTPF_PVRTCI_2bpp_RGBA;
617 newCSpace=ePVRTCSpacelRGB;
618 newChanType=ePVRTVarTypeUnsignedByteNorm;
619 break;
620 }
621
622 case MGLPT_PVRTC4:
623 {
624 newType=ePVRTPF_PVRTCI_4bpp_RGBA;
625 newCSpace=ePVRTCSpacelRGB;
626 newChanType=ePVRTVarTypeUnsignedByteNorm;
627 break;
628 }
629
630 case OGL_RGBA_4444:
631 {
632 newType=PVRTGENPIXELID4('r','g','b','a',4,4,4,4);
633 newCSpace=ePVRTCSpacelRGB;
634 newChanType=ePVRTVarTypeUnsignedShortNorm;
635 break;
636 }
637
638 case OGL_RGBA_5551:
639 {
640 newType=PVRTGENPIXELID4('r','g','b','a',5,5,5,1);
641 newCSpace=ePVRTCSpacelRGB;
642 newChanType=ePVRTVarTypeUnsignedShortNorm;
643 break;
644 }
645
646 case OGL_RGBA_8888:
647 {
648 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
649 newCSpace=ePVRTCSpacelRGB;
650 newChanType=ePVRTVarTypeUnsignedByteNorm;
651 break;
652 }
653
654 case OGL_RGB_565:
655 {
656 newType=PVRTGENPIXELID3('r','g','b',5,6,5);
657 newCSpace=ePVRTCSpacelRGB;
658 newChanType=ePVRTVarTypeUnsignedShortNorm;
659 break;
660 }
661
662 case OGL_RGB_555:
663 {
664 newType=PVRTGENPIXELID4('r','g','b','x',5,5,5,1);
665 newCSpace=ePVRTCSpacelRGB;
666 newChanType=ePVRTVarTypeUnsignedShortNorm;
667 break;
668 }
669
670 case OGL_RGB_888:
671 {
672 newType=PVRTGENPIXELID3('r','g','b',8,8,8);
673 newCSpace=ePVRTCSpacelRGB;
674 newChanType=ePVRTVarTypeUnsignedByteNorm;
675 break;
676 }
677
678 case OGL_I_8:
679 {
680 newType=PVRTGENPIXELID1('l',8);
681 newCSpace=ePVRTCSpacelRGB;
682 newChanType=ePVRTVarTypeUnsignedByteNorm;
683 break;
684 }
685
686 case OGL_AI_88:
687 {
688 newType=PVRTGENPIXELID2('l','a',8,8);
689 newCSpace=ePVRTCSpacelRGB;
690 newChanType=ePVRTVarTypeUnsignedByteNorm;
691 break;
692 }
693
694 case OGL_PVRTC2:
695 {
696 newType=ePVRTPF_PVRTCI_2bpp_RGBA;
697 newCSpace=ePVRTCSpacelRGB;
698 newChanType=ePVRTVarTypeUnsignedByteNorm;
699 break;
700 }
701
702 case OGL_PVRTC4:
703 {
704 newType=ePVRTPF_PVRTCI_4bpp_RGBA;
705 newCSpace=ePVRTCSpacelRGB;
706 newChanType=ePVRTVarTypeUnsignedByteNorm;
707 break;
708 }
709
710 case OGL_BGRA_8888:
711 {
712 newType=PVRTGENPIXELID4('b','g','r','a',8,8,8,8);
713 newCSpace=ePVRTCSpacelRGB;
714 newChanType=ePVRTVarTypeUnsignedByteNorm;
715 break;
716 }
717
718 case OGL_A_8:
719 {
720 newType=PVRTGENPIXELID1('a',8);
721 newCSpace=ePVRTCSpacelRGB;
722 newChanType=ePVRTVarTypeUnsignedByteNorm;
723 break;
724 }
725
726 case OGL_PVRTCII4:
727 {
728 newType=ePVRTPF_PVRTCII_4bpp;
729 newCSpace=ePVRTCSpacelRGB;
730 newChanType=ePVRTVarTypeUnsignedByteNorm;
731 break;
732 }
733
734 case OGL_PVRTCII2:
735 {
736 newType=ePVRTPF_PVRTCII_2bpp;
737 newCSpace=ePVRTCSpacelRGB;
738 newChanType=ePVRTVarTypeUnsignedByteNorm;
739 break;
740 }
741
742 #ifdef _WIN32
743 case D3D_DXT1:
744 {
745 newType=ePVRTPF_DXT1;
746 newCSpace=ePVRTCSpacelRGB;
747 newChanType=ePVRTVarTypeUnsignedByteNorm;
748 break;
749 }
750
751 case D3D_DXT2:
752 {
753 newType=ePVRTPF_DXT2;
754 newCSpace=ePVRTCSpacelRGB;
755 newChanType=ePVRTVarTypeUnsignedByteNorm;
756 isPreMult=true;
757 break;
758 }
759
760 case D3D_DXT3:
761 {
762 newType=ePVRTPF_DXT3;
763 newCSpace=ePVRTCSpacelRGB;
764 newChanType=ePVRTVarTypeUnsignedByteNorm;
765 break;
766 }
767
768 case D3D_DXT4:
769 {
770 newType=ePVRTPF_DXT4;
771 newCSpace=ePVRTCSpacelRGB;
772 newChanType=ePVRTVarTypeUnsignedByteNorm;
773 isPreMult=true;
774 break;
775 }
776
777 case D3D_DXT5:
778 {
779 newType=ePVRTPF_DXT5;
780 newCSpace=ePVRTCSpacelRGB;
781 newChanType=ePVRTVarTypeUnsignedByteNorm;
782 break;
783 }
784
785 #endif
786 case D3D_RGB_332:
787 {
788 newType=PVRTGENPIXELID3('r','g','b',3,3,2);
789 newCSpace=ePVRTCSpacelRGB;
790 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
791 break;
792 }
793
794 case D3D_AL_44:
795 {
796 newType=PVRTGENPIXELID2('a','l',4,4);
797 newCSpace=ePVRTCSpacelRGB;
798 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
799 break;
800 }
801
802 case D3D_LVU_655:
803 {
804 newType=PVRTGENPIXELID3('l','g','r',6,5,5);
805 newCSpace=ePVRTCSpacelRGB;
806 newChanType=ePVRTVarTypeSignedIntegerNorm;
807 break;
808 }
809
810 case D3D_XLVU_8888:
811 {
812 newType=PVRTGENPIXELID4('x','l','g','r',8,8,8,8);
813 newCSpace=ePVRTCSpacelRGB;
814 newChanType=ePVRTVarTypeSignedIntegerNorm;
815 break;
816 }
817
818 case D3D_QWVU_8888:
819 {
820 newType=PVRTGENPIXELID4('a','b','g','r',8,8,8,8);
821 newCSpace=ePVRTCSpacelRGB;
822 newChanType=ePVRTVarTypeSignedIntegerNorm;
823 break;
824 }
825
826 case D3D_ABGR_2101010:
827 {
828 newType=PVRTGENPIXELID4('a','b','g','r',2,10,10,10);
829 newCSpace=ePVRTCSpacelRGB;
830 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
831 break;
832 }
833
834 case D3D_ARGB_2101010:
835 {
836 newType=PVRTGENPIXELID4('a','r','g','b',2,10,10,10);
837 newCSpace=ePVRTCSpacelRGB;
838 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
839 break;
840 }
841
842 case D3D_AWVU_2101010:
843 {
844 newType=PVRTGENPIXELID4('a','r','g','b',2,10,10,10);
845 newCSpace=ePVRTCSpacelRGB;
846 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
847 break;
848 }
849
850 case D3D_GR_1616:
851 {
852 newType=PVRTGENPIXELID2('g','r',16,16);
853 newCSpace=ePVRTCSpacelRGB;
854 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
855 break;
856 }
857
858 case D3D_VU_1616:
859 {
860 newType=PVRTGENPIXELID2('g','r',16,16);
861 newCSpace=ePVRTCSpacelRGB;
862 newChanType=ePVRTVarTypeSignedIntegerNorm;
863 break;
864 }
865
866 case D3D_ABGR_16161616:
867 {
868 newType=PVRTGENPIXELID4('a','b','g','r',16,16,16,16);
869 newCSpace=ePVRTCSpacelRGB;
870 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
871 break;
872 }
873
874 case D3D_R16F:
875 {
876 newType=PVRTGENPIXELID1('r',16);
877 newCSpace=ePVRTCSpacelRGB;
878 newChanType=ePVRTVarTypeSignedFloat;
879 break;
880 }
881
882 case D3D_GR_1616F:
883 {
884 newType=PVRTGENPIXELID2('g','r',16,16);
885 newCSpace=ePVRTCSpacelRGB;
886 newChanType=ePVRTVarTypeSignedFloat;
887 break;
888 }
889
890 case D3D_ABGR_16161616F:
891 {
892 newType=PVRTGENPIXELID4('a','b','g','r',16,16,16,16);
893 newCSpace=ePVRTCSpacelRGB;
894 newChanType=ePVRTVarTypeSignedFloat;
895 break;
896 }
897
898 case D3D_R32F:
899 {
900 newType=PVRTGENPIXELID1('r',32);
901 newCSpace=ePVRTCSpacelRGB;
902 newChanType=ePVRTVarTypeSignedFloat;
903 break;
904 }
905
906 case D3D_GR_3232F:
907 {
908 newType=PVRTGENPIXELID2('g','r',32,32);
909 newCSpace=ePVRTCSpacelRGB;
910 newChanType=ePVRTVarTypeSignedFloat;
911 break;
912 }
913
914 case D3D_ABGR_32323232F:
915 {
916 newType=PVRTGENPIXELID4('a','b','g','r',32,32,32,32);
917 newCSpace=ePVRTCSpacelRGB;
918 newChanType=ePVRTVarTypeSignedFloat;
919 break;
920 }
921
922 case ETC_RGB_4BPP:
923 {
924 newType=ePVRTPF_ETC1;
925 newCSpace=ePVRTCSpacelRGB;
926 newChanType=ePVRTVarTypeUnsignedByteNorm;
927 break;
928 }
929
930 case D3D_A8:
931 {
932 newType=PVRTGENPIXELID1('a',8);
933 newCSpace=ePVRTCSpacelRGB;
934 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
935 break;
936 }
937
938 case D3D_V8U8:
939 {
940 newType=PVRTGENPIXELID2('g','r',8,8);
941 newCSpace=ePVRTCSpacelRGB;
942 newChanType=ePVRTVarTypeSignedIntegerNorm;
943 break;
944 }
945
946 case D3D_L16:
947 {
948 newType=PVRTGENPIXELID1('l',16);
949 newCSpace=ePVRTCSpacelRGB;
950 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
951 break;
952 }
953
954 case D3D_L8:
955 {
956 newType=PVRTGENPIXELID1('l',8);
957 newCSpace=ePVRTCSpacelRGB;
958 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
959 break;
960 }
961
962 case D3D_AL_88:
963 {
964 newType=PVRTGENPIXELID2('a','l',8,8);
965 newCSpace=ePVRTCSpacelRGB;
966 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
967 break;
968 }
969
970 case D3D_UYVY:
971 {
972 newType=ePVRTPF_UYVY;
973 newCSpace=ePVRTCSpacelRGB;
974 newChanType=ePVRTVarTypeUnsignedByteNorm;
975 break;
976 }
977
978 case D3D_YUY2:
979 {
980 newType=ePVRTPF_YUY2;
981 newCSpace=ePVRTCSpacelRGB;
982 newChanType=ePVRTVarTypeUnsignedByteNorm;
983 break;
984 }
985
986 case DX10_R32G32B32A32_FLOAT:
987 {
988 newType=PVRTGENPIXELID4('r','g','b','a',32,32,32,32);
989 newCSpace=ePVRTCSpacelRGB;
990 newChanType=ePVRTVarTypeSignedFloat;
991 break;
992 }
993
994 case DX10_R32G32B32A32_UINT:
995 {
996 newType=PVRTGENPIXELID4('r','g','b','a',32,32,32,32);
997 newCSpace=ePVRTCSpacelRGB;
998 newChanType=ePVRTVarTypeUnsignedInteger;
999 break;
1000 }
1001
1002 case DX10_R32G32B32A32_SINT:
1003 {
1004 newType=PVRTGENPIXELID4('r','g','b','a',32,32,32,32);
1005 newCSpace=ePVRTCSpacelRGB;
1006 newChanType=ePVRTVarTypeSignedInteger;
1007 break;
1008 }
1009
1010 case DX10_R32G32B32_FLOAT:
1011 {
1012 newType=PVRTGENPIXELID3('r','g','b',32,32,32);
1013 newCSpace=ePVRTCSpacelRGB;
1014 newChanType=ePVRTVarTypeSignedFloat;
1015 break;
1016 }
1017
1018 case DX10_R32G32B32_UINT:
1019 {
1020 newType=PVRTGENPIXELID3('r','g','b',32,32,32);
1021 newCSpace=ePVRTCSpacelRGB;
1022 newChanType=ePVRTVarTypeUnsignedInteger;
1023 break;
1024 }
1025
1026 case DX10_R32G32B32_SINT:
1027 {
1028 newType=PVRTGENPIXELID3('r','g','b',32,32,32);
1029 newCSpace=ePVRTCSpacelRGB;
1030 newChanType=ePVRTVarTypeSignedInteger;
1031 break;
1032 }
1033
1034 case DX10_R16G16B16A16_FLOAT:
1035 {
1036 newType=PVRTGENPIXELID4('r','g','b','a',16,16,16,16);
1037 newCSpace=ePVRTCSpacelRGB;
1038 newChanType=ePVRTVarTypeSignedFloat;
1039 break;
1040 }
1041
1042 case DX10_R16G16B16A16_UNORM:
1043 {
1044 newType=PVRTGENPIXELID4('r','g','b','a',16,16,16,16);
1045 newCSpace=ePVRTCSpacelRGB;
1046 newChanType=ePVRTVarTypeUnsignedShortNorm;
1047 break;
1048 }
1049
1050 case DX10_R16G16B16A16_UINT:
1051 {
1052 newType=PVRTGENPIXELID4('r','g','b','a',16,16,16,16);
1053 newCSpace=ePVRTCSpacelRGB;
1054 newChanType=ePVRTVarTypeUnsignedShort;
1055 break;
1056 }
1057
1058 case DX10_R16G16B16A16_SNORM:
1059 {
1060 newType=PVRTGENPIXELID4('r','g','b','a',16,16,16,16);
1061 newCSpace=ePVRTCSpacelRGB;
1062 newChanType=ePVRTVarTypeSignedShortNorm;
1063 break;
1064 }
1065
1066 case DX10_R16G16B16A16_SINT:
1067 {
1068 newType=PVRTGENPIXELID4('r','g','b','a',16,16,16,16);
1069 newCSpace=ePVRTCSpacelRGB;
1070 newChanType=ePVRTVarTypeSignedShort;
1071 break;
1072 }
1073
1074 case DX10_R32G32_FLOAT:
1075 {
1076 newType=PVRTGENPIXELID2('r','g',32,32);
1077 newCSpace=ePVRTCSpacelRGB;
1078 newChanType=ePVRTVarTypeSignedFloat;
1079 break;
1080 }
1081
1082 case DX10_R32G32_UINT:
1083 {
1084 newType=PVRTGENPIXELID2('r','g',32,32);
1085 newCSpace=ePVRTCSpacelRGB;
1086 newChanType=ePVRTVarTypeUnsignedInteger;
1087 break;
1088 }
1089
1090 case DX10_R32G32_SINT:
1091 {
1092 newType=PVRTGENPIXELID2('r','g',32,32);
1093 newCSpace=ePVRTCSpacelRGB;
1094 newChanType=ePVRTVarTypeSignedInteger;
1095 break;
1096 }
1097
1098 case DX10_R10G10B10A2_UNORM:
1099 {
1100 newType=PVRTGENPIXELID4('r','g','b','a',10,10,10,2);
1101 newCSpace=ePVRTCSpacelRGB;
1102 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1103 break;
1104 }
1105
1106 case DX10_R10G10B10A2_UINT:
1107 {
1108 newType=PVRTGENPIXELID4('r','g','b','a',10,10,10,2);
1109 newCSpace=ePVRTCSpacelRGB;
1110 newChanType=ePVRTVarTypeUnsignedInteger;
1111 break;
1112 }
1113
1114 case DX10_R11G11B10_FLOAT:
1115 {
1116 newType=PVRTGENPIXELID3('r','g','b',11,11,10);
1117 newCSpace=ePVRTCSpacelRGB;
1118 newChanType=ePVRTVarTypeSignedFloat;
1119 break;
1120 }
1121
1122 case DX10_R8G8B8A8_UNORM:
1123 {
1124 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1125 newCSpace=ePVRTCSpacelRGB;
1126 newChanType=ePVRTVarTypeUnsignedByteNorm;
1127 break;
1128 }
1129
1130 case DX10_R8G8B8A8_UNORM_SRGB:
1131 {
1132 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1133 newCSpace=ePVRTCSpacesRGB;
1134 newChanType=ePVRTVarTypeUnsignedByteNorm;
1135 break;
1136 }
1137
1138 case DX10_R8G8B8A8_UINT:
1139 {
1140 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1141 newCSpace=ePVRTCSpacelRGB;
1142 newChanType=ePVRTVarTypeUnsignedByte;
1143 break;
1144 }
1145
1146 case DX10_R8G8B8A8_SNORM:
1147 {
1148 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1149 newCSpace=ePVRTCSpacelRGB;
1150 newChanType=ePVRTVarTypeSignedByteNorm;
1151 break;
1152 }
1153
1154 case DX10_R8G8B8A8_SINT:
1155 {
1156 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1157 newCSpace=ePVRTCSpacelRGB;
1158 newChanType=ePVRTVarTypeSignedByte;
1159 break;
1160 }
1161
1162 case DX10_R16G16_FLOAT:
1163 {
1164 newType=PVRTGENPIXELID2('r','g',16,16);
1165 newCSpace=ePVRTCSpacelRGB;
1166 newChanType=ePVRTVarTypeSignedFloat;
1167 break;
1168 }
1169
1170 case DX10_R16G16_UNORM:
1171 {
1172 newType=PVRTGENPIXELID2('r','g',16,16);
1173 newCSpace=ePVRTCSpacelRGB;
1174 newChanType=ePVRTVarTypeUnsignedShortNorm;
1175 break;
1176 }
1177
1178 case DX10_R16G16_UINT:
1179 {
1180 newType=PVRTGENPIXELID2('r','g',16,16);
1181 newCSpace=ePVRTCSpacelRGB;
1182 newChanType=ePVRTVarTypeUnsignedShort;
1183 break;
1184 }
1185
1186 case DX10_R16G16_SNORM:
1187 {
1188 newType=PVRTGENPIXELID2('r','g',16,16);
1189 newCSpace=ePVRTCSpacelRGB;
1190 newChanType=ePVRTVarTypeSignedShortNorm;
1191 break;
1192 }
1193
1194 case DX10_R16G16_SINT:
1195 {
1196 newType=PVRTGENPIXELID2('r','g',16,16);
1197 newCSpace=ePVRTCSpacelRGB;
1198 newChanType=ePVRTVarTypeSignedShort;
1199 break;
1200 }
1201
1202 case DX10_R32_FLOAT:
1203 {
1204 newType=PVRTGENPIXELID1('r',32);
1205 newCSpace=ePVRTCSpacelRGB;
1206 newChanType=ePVRTVarTypeSignedFloat;
1207 break;
1208 }
1209
1210 case DX10_R32_UINT:
1211 {
1212 newType=PVRTGENPIXELID1('r',32);
1213 newCSpace=ePVRTCSpacelRGB;
1214 newChanType=ePVRTVarTypeUnsignedInteger;
1215 break;
1216 }
1217
1218 case DX10_R32_SINT:
1219 {
1220 newType=PVRTGENPIXELID1('r',32);
1221 newCSpace=ePVRTCSpacelRGB;
1222 newChanType=ePVRTVarTypeSignedInteger;
1223 break;
1224 }
1225
1226 case DX10_R8G8_UNORM:
1227 {
1228 newType=PVRTGENPIXELID2('r','g',8,8);
1229 newCSpace=ePVRTCSpacelRGB;
1230 newChanType=ePVRTVarTypeUnsignedByteNorm;
1231 break;
1232 }
1233
1234 case DX10_R8G8_UINT:
1235 {
1236 newType=PVRTGENPIXELID2('r','g',8,8);
1237 newCSpace=ePVRTCSpacelRGB;
1238 newChanType=ePVRTVarTypeUnsignedByte;
1239 break;
1240 }
1241
1242 case DX10_R8G8_SNORM:
1243 {
1244 newType=PVRTGENPIXELID2('r','g',8,8);
1245 newCSpace=ePVRTCSpacelRGB;
1246 newChanType=ePVRTVarTypeSignedByteNorm;
1247 break;
1248 }
1249
1250 case DX10_R8G8_SINT:
1251 {
1252 newType=PVRTGENPIXELID2('r','g',8,8);
1253 newCSpace=ePVRTCSpacelRGB;
1254 newChanType=ePVRTVarTypeSignedByte;
1255 break;
1256 }
1257
1258 case DX10_R16_FLOAT:
1259 {
1260 newType=PVRTGENPIXELID1('r',16);
1261 newCSpace=ePVRTCSpacelRGB;
1262 newChanType=ePVRTVarTypeSignedFloat;
1263 break;
1264 }
1265
1266 case DX10_R16_UNORM:
1267 {
1268 newType=PVRTGENPIXELID1('r',16);
1269 newCSpace=ePVRTCSpacelRGB;
1270 newChanType=ePVRTVarTypeUnsignedShortNorm;
1271 break;
1272 }
1273
1274 case DX10_R16_UINT:
1275 {
1276 newType=PVRTGENPIXELID1('r',16);
1277 newCSpace=ePVRTCSpacelRGB;
1278 newChanType=ePVRTVarTypeUnsignedShort;
1279 break;
1280 }
1281
1282 case DX10_R16_SNORM:
1283 {
1284 newType=PVRTGENPIXELID1('r',16);
1285 newCSpace=ePVRTCSpacelRGB;
1286 newChanType=ePVRTVarTypeSignedShortNorm;
1287 break;
1288 }
1289
1290 case DX10_R16_SINT:
1291 {
1292 newType=PVRTGENPIXELID1('r',16);
1293 newCSpace=ePVRTCSpacelRGB;
1294 newChanType=ePVRTVarTypeSignedShort;
1295 break;
1296 }
1297
1298 case DX10_R8_UNORM:
1299 {
1300 newType=PVRTGENPIXELID1('r',8);
1301 newCSpace=ePVRTCSpacelRGB;
1302 newChanType=ePVRTVarTypeUnsignedByteNorm;
1303 break;
1304 }
1305
1306 case DX10_R8_UINT:
1307 {
1308 newType=PVRTGENPIXELID1('r',8);
1309 newCSpace=ePVRTCSpacelRGB;
1310 newChanType=ePVRTVarTypeUnsignedByte;
1311 break;
1312 }
1313
1314 case DX10_R8_SNORM:
1315 {
1316 newType=PVRTGENPIXELID1('r',8);
1317 newCSpace=ePVRTCSpacelRGB;
1318 newChanType=ePVRTVarTypeSignedByteNorm;
1319 break;
1320 }
1321
1322 case DX10_R8_SINT:
1323 {
1324 newType=PVRTGENPIXELID1('r',8);
1325 newCSpace=ePVRTCSpacelRGB;
1326 newChanType=ePVRTVarTypeSignedByte;
1327 break;
1328 }
1329
1330 case DX10_A8_UNORM:
1331 {
1332 newType=PVRTGENPIXELID1('r',8);
1333 newCSpace=ePVRTCSpacelRGB;
1334 newChanType=ePVRTVarTypeUnsignedByteNorm;
1335 break;
1336 }
1337
1338 case DX10_R1_UNORM:
1339 {
1340 newType=ePVRTPF_BW1bpp;
1341 newCSpace=ePVRTCSpacelRGB;
1342 newChanType=ePVRTVarTypeUnsignedByteNorm;
1343 break;
1344 }
1345
1346 case DX10_R9G9B9E5_SHAREDEXP:
1347 {
1348 newType=ePVRTPF_SharedExponentR9G9B9E5;
1349 newCSpace=ePVRTCSpacelRGB;
1350 newChanType=ePVRTVarTypeSignedFloat;
1351 break;
1352 }
1353
1354 case DX10_R8G8_B8G8_UNORM:
1355 {
1356 newType=ePVRTPF_RGBG8888;
1357 newCSpace=ePVRTCSpacelRGB;
1358 newChanType=ePVRTVarTypeUnsignedByteNorm;
1359 break;
1360 }
1361
1362 case DX10_G8R8_G8B8_UNORM:
1363 {
1364 newType=ePVRTPF_GRGB8888;
1365 newCSpace=ePVRTCSpacelRGB;
1366 newChanType=ePVRTVarTypeUnsignedByteNorm;
1367 break;
1368 }
1369
1370 #ifdef _WIN32
1371 case DX10_BC1_UNORM:
1372 {
1373 newType=ePVRTPF_DXT1;
1374 newCSpace=ePVRTCSpacelRGB;
1375 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1376 break;
1377 }
1378
1379 case DX10_BC1_UNORM_SRGB:
1380 {
1381 newType=ePVRTPF_DXT1;
1382 newCSpace=ePVRTCSpacesRGB;
1383 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1384 break;
1385 }
1386
1387 case DX10_BC2_UNORM:
1388 {
1389 newType=ePVRTPF_DXT3;
1390 newCSpace=ePVRTCSpacelRGB;
1391 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1392 break;
1393 }
1394
1395 case DX10_BC2_UNORM_SRGB:
1396 {
1397 newType=ePVRTPF_DXT3;
1398 newCSpace=ePVRTCSpacesRGB;
1399 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1400 break;
1401 }
1402
1403 case DX10_BC3_UNORM:
1404 {
1405 newType=ePVRTPF_DXT5;
1406 newCSpace=ePVRTCSpacelRGB;
1407 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1408 break;
1409 }
1410
1411 case DX10_BC3_UNORM_SRGB:
1412 {
1413 newType=ePVRTPF_DXT5;
1414 newCSpace=ePVRTCSpacesRGB;
1415 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1416 break;
1417 }
1418
1419 case DX10_BC4_UNORM:
1420 {
1421 newType=ePVRTPF_BC4;
1422 newCSpace=ePVRTCSpacesRGB;
1423 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1424 break;
1425 }
1426
1427 case DX10_BC4_SNORM:
1428 {
1429 newType=ePVRTPF_BC4;
1430 newCSpace=ePVRTCSpacelRGB;
1431 newChanType=ePVRTVarTypeSignedIntegerNorm;
1432 break;
1433 }
1434
1435 case DX10_BC5_UNORM:
1436 {
1437 newType=ePVRTPF_BC5;
1438 newCSpace=ePVRTCSpacelRGB;
1439 newChanType=ePVRTVarTypeUnsignedIntegerNorm;
1440 break;
1441 }
1442
1443 case DX10_BC5_SNORM:
1444 {
1445 newType=ePVRTPF_BC5;
1446 newCSpace=ePVRTCSpacelRGB;
1447 newChanType=ePVRTVarTypeSignedIntegerNorm;
1448 break;
1449 }
1450
1451 #endif
1452 case ePT_VG_sRGBX_8888:
1453 {
1454 newType=PVRTGENPIXELID4('r','g','b','x',8,8,8,8);
1455 newCSpace=ePVRTCSpacesRGB;
1456 newChanType=ePVRTVarTypeUnsignedByteNorm;
1457 break;
1458 }
1459
1460 case ePT_VG_sRGBA_8888:
1461 {
1462 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1463 newCSpace=ePVRTCSpacesRGB;
1464 newChanType=ePVRTVarTypeUnsignedByteNorm;
1465 break;
1466 }
1467
1468 case ePT_VG_sRGBA_8888_PRE:
1469 {
1470 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1471 newCSpace=ePVRTCSpacesRGB;
1472 newChanType=ePVRTVarTypeUnsignedByteNorm;
1473 isPreMult=true;
1474 break;
1475 }
1476
1477 case ePT_VG_sRGB_565:
1478 {
1479 newType=PVRTGENPIXELID3('r','g','b',5,6,5);
1480 newCSpace=ePVRTCSpacesRGB;
1481 newChanType=ePVRTVarTypeUnsignedShortNorm;
1482 break;
1483 }
1484
1485 case ePT_VG_sRGBA_5551:
1486 {
1487 newType=PVRTGENPIXELID4('r','g','b','a',5,5,5,1);
1488 newCSpace=ePVRTCSpacesRGB;
1489 newChanType=ePVRTVarTypeUnsignedShortNorm;
1490 break;
1491 }
1492
1493 case ePT_VG_sRGBA_4444:
1494 {
1495 newType=PVRTGENPIXELID4('r','g','b','a',4,4,4,4);
1496 newCSpace=ePVRTCSpacesRGB;
1497 newChanType=ePVRTVarTypeUnsignedShortNorm;
1498 break;
1499 }
1500
1501 case ePT_VG_sL_8:
1502 {
1503 newType=PVRTGENPIXELID1('l',8);
1504 newCSpace=ePVRTCSpacesRGB;
1505 newChanType=ePVRTVarTypeUnsignedByteNorm;
1506 break;
1507 }
1508
1509 case ePT_VG_lRGBX_8888:
1510 {
1511 newType=PVRTGENPIXELID4('r','g','b','x',8,8,8,8);
1512 newCSpace=ePVRTCSpacelRGB;
1513 newChanType=ePVRTVarTypeUnsignedByteNorm;
1514 break;
1515 }
1516
1517 case ePT_VG_lRGBA_8888:
1518 {
1519 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1520 newCSpace=ePVRTCSpacelRGB;
1521 newChanType=ePVRTVarTypeUnsignedByteNorm;
1522 break;
1523 }
1524
1525 case ePT_VG_lRGBA_8888_PRE:
1526 {
1527 newType=PVRTGENPIXELID4('r','g','b','a',8,8,8,8);
1528 newCSpace=ePVRTCSpacelRGB;
1529 newChanType=ePVRTVarTypeUnsignedByteNorm;
1530 isPreMult=true;
1531 break;
1532 }
1533
1534 case ePT_VG_lL_8:
1535 {
1536 newType=PVRTGENPIXELID1('l',8);
1537 newCSpace=ePVRTCSpacelRGB;
1538 newChanType=ePVRTVarTypeUnsignedByteNorm;
1539 break;
1540 }
1541
1542 case ePT_VG_A_8:
1543 {
1544 newType=PVRTGENPIXELID1('a',8);
1545 newCSpace=ePVRTCSpacelRGB;
1546 newChanType=ePVRTVarTypeUnsignedByteNorm;
1547 break;
1548 }
1549
1550 case ePT_VG_BW_1:
1551 {
1552 newType=ePVRTPF_BW1bpp;
1553 newCSpace=ePVRTCSpacelRGB;
1554 newChanType=ePVRTVarTypeUnsignedByteNorm;
1555 break;
1556 }
1557
1558 case ePT_VG_sXRGB_8888:
1559 {
1560 newType=PVRTGENPIXELID4('x','r','g','b',8,8,8,8);
1561 newCSpace=ePVRTCSpacesRGB;
1562 newChanType=ePVRTVarTypeUnsignedByteNorm;
1563 break;
1564 }
1565
1566 case ePT_VG_sARGB_8888:
1567 {
1568 newType=PVRTGENPIXELID4('a','r','g','b',8,8,8,8);
1569 newCSpace=ePVRTCSpacesRGB;
1570 newChanType=ePVRTVarTypeUnsignedByteNorm;
1571 break;
1572 }
1573
1574 case ePT_VG_sARGB_8888_PRE:
1575 {
1576 newType=PVRTGENPIXELID4('a','r','g','b',8,8,8,8);
1577 newCSpace=ePVRTCSpacesRGB;
1578 newChanType=ePVRTVarTypeUnsignedByteNorm;
1579 isPreMult=true;
1580 break;
1581 }
1582
1583 case ePT_VG_sARGB_1555:
1584 {
1585 newType=PVRTGENPIXELID4('a','r','g','b',1,5,5,5);
1586 newCSpace=ePVRTCSpacesRGB;
1587 newChanType=ePVRTVarTypeUnsignedShortNorm;
1588 break;
1589 }
1590
1591 case ePT_VG_sARGB_4444:
1592 {
1593 newType=PVRTGENPIXELID4('a','r','g','b',4,4,4,4);
1594 newCSpace=ePVRTCSpacesRGB;
1595 newChanType=ePVRTVarTypeUnsignedShortNorm;
1596 break;
1597 }
1598
1599 case ePT_VG_lXRGB_8888:
1600 {
1601 newType=PVRTGENPIXELID4('x','r','g','b',8,8,8,8);
1602 newCSpace=ePVRTCSpacelRGB;
1603 newChanType=ePVRTVarTypeUnsignedByteNorm;
1604 break;
1605 }
1606
1607 case ePT_VG_lARGB_8888:
1608 {
1609 newType=PVRTGENPIXELID4('a','r','g','b',8,8,8,8);
1610 newCSpace=ePVRTCSpacelRGB;
1611 newChanType=ePVRTVarTypeUnsignedByteNorm;
1612 break;
1613 }
1614
1615 case ePT_VG_lARGB_8888_PRE:
1616 {
1617 newType=PVRTGENPIXELID4('a','r','g','b',8,8,8,8);
1618 newCSpace=ePVRTCSpacelRGB;
1619 newChanType=ePVRTVarTypeUnsignedByteNorm;
1620 isPreMult=true;
1621 break;
1622 }
1623
1624 case ePT_VG_sBGRX_8888:
1625 {
1626 newType=PVRTGENPIXELID4('b','g','r','x',8,8,8,8);
1627 newCSpace=ePVRTCSpacesRGB;
1628 newChanType=ePVRTVarTypeUnsignedByteNorm;
1629 break;
1630 }
1631
1632 case ePT_VG_sBGRA_8888:
1633 {
1634 newType=PVRTGENPIXELID4('b','g','r','a',8,8,8,8);
1635 newCSpace=ePVRTCSpacesRGB;
1636 newChanType=ePVRTVarTypeUnsignedByteNorm;
1637 break;
1638 }
1639
1640 case ePT_VG_sBGRA_8888_PRE:
1641 {
1642 newType=PVRTGENPIXELID4('b','g','r','a',8,8,8,8);
1643 newCSpace=ePVRTCSpacesRGB;
1644 newChanType=ePVRTVarTypeUnsignedByteNorm;
1645 isPreMult=true;
1646 break;
1647 }
1648
1649 case ePT_VG_sBGR_565:
1650 {
1651 newType=PVRTGENPIXELID3('b','g','r',5,6,5);
1652 newCSpace=ePVRTCSpacesRGB;
1653 newChanType=ePVRTVarTypeUnsignedShortNorm;
1654 break;
1655 }
1656
1657 case ePT_VG_sBGRA_5551:
1658 {
1659 newType=PVRTGENPIXELID4('b','g','r','a',5,5,5,1);
1660 newCSpace=ePVRTCSpacesRGB;
1661 newChanType=ePVRTVarTypeUnsignedShortNorm;
1662 break;
1663 }
1664
1665 case ePT_VG_sBGRA_4444:
1666 {
1667 newType=PVRTGENPIXELID4('b','g','r','x',4,4,4,4);
1668 newCSpace=ePVRTCSpacesRGB;
1669 newChanType=ePVRTVarTypeUnsignedShortNorm;
1670 break;
1671 }
1672
1673 case ePT_VG_lBGRX_8888:
1674 {
1675 newType=PVRTGENPIXELID4('b','g','r','x',8,8,8,8);
1676 newCSpace=ePVRTCSpacelRGB;
1677 newChanType=ePVRTVarTypeUnsignedByteNorm;
1678 break;
1679 }
1680
1681 case ePT_VG_lBGRA_8888:
1682 {
1683 newType=PVRTGENPIXELID4('b','g','r','a',8,8,8,8);
1684 newCSpace=ePVRTCSpacelRGB;
1685 newChanType=ePVRTVarTypeUnsignedByteNorm;
1686 break;
1687 }
1688
1689 case ePT_VG_lBGRA_8888_PRE:
1690 {
1691 newType=PVRTGENPIXELID4('b','g','r','a',8,8,8,8);
1692 newCSpace=ePVRTCSpacelRGB;
1693 newChanType=ePVRTVarTypeUnsignedByteNorm;
1694 isPreMult=true;
1695 break;
1696 }
1697
1698 case ePT_VG_sXBGR_8888:
1699 {
1700 newType=PVRTGENPIXELID4('x','b','g','r',8,8,8,8);
1701 newCSpace=ePVRTCSpacesRGB;
1702 newChanType=ePVRTVarTypeUnsignedByteNorm;
1703 break;
1704 }
1705
1706 case ePT_VG_sABGR_8888:
1707 {
1708 newType=PVRTGENPIXELID4('a','b','g','r',8,8,8,8);
1709 newCSpace=ePVRTCSpacesRGB;
1710 newChanType=ePVRTVarTypeUnsignedByteNorm;
1711 break;
1712 }
1713
1714 case ePT_VG_sABGR_8888_PRE:
1715 {
1716 newType=PVRTGENPIXELID4('a','b','g','r',8,8,8,8);
1717 newCSpace=ePVRTCSpacesRGB;
1718 newChanType=ePVRTVarTypeUnsignedByteNorm;
1719 isPreMult=true;
1720 break;
1721 }
1722
1723 case ePT_VG_sABGR_1555:
1724 {
1725 newType=PVRTGENPIXELID4('a','b','g','r',1,5,5,5);
1726 newCSpace=ePVRTCSpacesRGB;
1727 newChanType=ePVRTVarTypeUnsignedShortNorm;
1728 break;
1729 }
1730
1731 case ePT_VG_sABGR_4444:
1732 {
1733 newType=PVRTGENPIXELID4('x','b','g','r',4,4,4,4);
1734 newCSpace=ePVRTCSpacesRGB;
1735 newChanType=ePVRTVarTypeUnsignedShortNorm;
1736 break;
1737 }
1738
1739 case ePT_VG_lXBGR_8888:
1740 {
1741 newType=PVRTGENPIXELID4('x','b','g','r',8,8,8,8);
1742 newCSpace=ePVRTCSpacelRGB;
1743 newChanType=ePVRTVarTypeUnsignedByteNorm;
1744 break;
1745 }
1746
1747 case ePT_VG_lABGR_8888:
1748 {
1749 newType=PVRTGENPIXELID4('a','b','g','r',8,8,8,8);
1750 newCSpace=ePVRTCSpacelRGB;
1751 newChanType=ePVRTVarTypeUnsignedByteNorm;
1752 break;
1753 }
1754
1755 case ePT_VG_lABGR_8888_PRE:
1756 {
1757 newType=PVRTGENPIXELID4('a','b','g','r',8,8,8,8);
1758 newCSpace=ePVRTCSpacelRGB;
1759 newChanType=ePVRTVarTypeUnsignedByteNorm;
1760 isPreMult=true;
1761 break;
1762 }
1763 default:
1764 {
1765 newType=ePVRTPF_NumCompressedPFs;
1766 newCSpace=ePVRTCSpacelRGB;
1767 newChanType=ePVRTVarTypeNumVarTypes;
1768 break;
1769 }
1770 }
1771 }
1772
1773 /*****************************************************************************
1774 End of file (PVRTTexture.cpp)
1775 *****************************************************************************/
1776