#ifndef __CRYDXPSGCM_FORMATS__
#define __CRYDXPSGCM_FORMATS__

static uint32 DXGI_FORMAT2GCM[]	=
{
	~0,																							//DXGI_FORMAT_UNKNOWN										= 0,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32A32_TYPELESS			= 1,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32A32_FLOAT				= 2,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32A32_UINT					= 3,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32A32_SINT					= 4,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32_TYPELESS				= 5,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32_FLOAT						= 6,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32_UINT						= 7,
	CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT,					//DXGI_FORMAT_R32G32B32_SINT						= 8,
	CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT,					//DXGI_FORMAT_R16G16B16A16_TYPELESS			= 9,
	CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT,					//DXGI_FORMAT_R16G16B16A16_FLOAT				= 10,
	CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT,					//DXGI_FORMAT_R16G16B16A16_UNORM				= 11,
	CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT,					//DXGI_FORMAT_R16G16B16A16_UINT					= 12,
	CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT,					//DXGI_FORMAT_R16G16B16A16_SNORM				= 13,
	CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT,					//DXGI_FORMAT_R16G16B16A16_SINT					= 14,
	~0,																							//DXGI_FORMAT_R32G32_TYPELESS						= 15,
	~0,																							//DXGI_FORMAT_R32G32_FLOAT							= 16,
	~0,																							//DXGI_FORMAT_R32G32_UINT								= 17,
	~0,																							//DXGI_FORMAT_R32G32_SINT								= 18,
	~0,																							//DXGI_FORMAT_R32G8X24_TYPELESS					= 19,
	CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT,							//DXGI_FORMAT_D32_FLOAT_S8X24_UINT			= 20,
	CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT,							//DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS	= 21,
	CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT,							//DXGI_FORMAT_X32_TYPELESS_G8X24_UINT		= 22,
	~0,																							//DXGI_FORMAT_R10G10B10A2_TYPELESS			= 23,
	~0,																							//DXGI_FORMAT_R10G10B10A2_UNORM					= 24,
	~0,																							//DXGI_FORMAT_R10G10B10A2_UINT					= 25,
	~0,																							//DXGI_FORMAT_R11G11B10_FLOAT						= 26,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_R8G8B8A8_TYPELESS					= 27,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_R8G8B8A8_UNORM						= 28,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_R8G8B8A8_UNORM_SRGB				= 29,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_R8G8B8A8_UINT							= 30,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_R8G8B8A8_SNORM						= 31,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_R8G8B8A8_SINT							= 32,
	CELL_GCM_TEXTURE_Y16_X16_FLOAT,									//DXGI_FORMAT_R16G16_TYPELESS						= 33,
	CELL_GCM_TEXTURE_Y16_X16_FLOAT,									//DXGI_FORMAT_R16G16_FLOAT							= 34,
	CELL_GCM_TEXTURE_Y16_X16_FLOAT,									//DXGI_FORMAT_R16G16_UNORM							= 35,
	CELL_GCM_TEXTURE_Y16_X16_FLOAT,									//DXGI_FORMAT_R16G16_UINT								= 36,
	CELL_GCM_TEXTURE_Y16_X16_FLOAT,									//DXGI_FORMAT_R16G16_SNORM							= 37,
	CELL_GCM_TEXTURE_Y16_X16_FLOAT,									//DXGI_FORMAT_R16G16_SINT								= 38,
	CELL_GCM_TEXTURE_X32_FLOAT,											//DXGI_FORMAT_R32_TYPELESS							= 39,
	CELL_GCM_TEXTURE_X32_FLOAT,											//DXGI_FORMAT_D32_FLOAT									= 40,
	CELL_GCM_TEXTURE_X32_FLOAT,											//DXGI_FORMAT_R32_FLOAT									= 41,
	CELL_GCM_TEXTURE_X32_FLOAT,											//DXGI_FORMAT_R32_UINT									= 42,
	CELL_GCM_TEXTURE_X32_FLOAT,											//DXGI_FORMAT_R32_SINT									= 43,
	CELL_GCM_TEXTURE_DEPTH24_D8,										//DXGI_FORMAT_R24G8_TYPELESS						= 44,
	CELL_GCM_TEXTURE_DEPTH24_D8,										//DXGI_FORMAT_D24_UNORM_S8_UINT					= 45,
	CELL_GCM_TEXTURE_DEPTH24_D8,										//DXGI_FORMAT_R24_UNORM_X8_TYPELESS			= 46,
	CELL_GCM_TEXTURE_DEPTH24_D8,										//DXGI_FORMAT_X24_TYPELESS_G8_UINT			= 47,
	CELL_GCM_TEXTURE_G8B8,													//DXGI_FORMAT_R8G8_TYPELESS							= 48,
	CELL_GCM_TEXTURE_G8B8,													//DXGI_FORMAT_R8G8_UNORM								= 49,
	CELL_GCM_TEXTURE_G8B8,													//DXGI_FORMAT_R8G8_UINT									= 50,
	CELL_GCM_TEXTURE_G8B8,													//DXGI_FORMAT_R8G8_SNORM								= 51,
	CELL_GCM_TEXTURE_G8B8,													//DXGI_FORMAT_R8G8_SINT									= 52,
	CELL_GCM_TEXTURE_X16,														//DXGI_FORMAT_R16_TYPELESS							= 53,
	CELL_GCM_TEXTURE_DEPTH16_FLOAT,									//DXGI_FORMAT_R16_FLOAT									= 54,
	CELL_GCM_TEXTURE_X16,														//DXGI_FORMAT_D16_UNORM									= 55,
	CELL_GCM_TEXTURE_X16,														//DXGI_FORMAT_R16_UNORM									= 56,
	CELL_GCM_TEXTURE_X16,														//DXGI_FORMAT_R16_UINT									= 57,
	CELL_GCM_TEXTURE_X16,														//DXGI_FORMAT_R16_SNORM									= 58,
	CELL_GCM_TEXTURE_X16,														//DXGI_FORMAT_R16_SINT									= 59,
	CELL_GCM_TEXTURE_B8,														//DXGI_FORMAT_R8_TYPELESS								= 60,
	CELL_GCM_TEXTURE_B8,														//DXGI_FORMAT_R8_UNORM									= 61,
	CELL_GCM_TEXTURE_B8,														//DXGI_FORMAT_R8_UINT										= 62,
	CELL_GCM_TEXTURE_B8,														//DXGI_FORMAT_R8_SNORM									= 63,
	CELL_GCM_TEXTURE_B8,														//DXGI_FORMAT_R8_SINT										= 64,
	CELL_GCM_TEXTURE_B8,														//DXGI_FORMAT_A8_UNORM									= 65,
	~0,																							//DXGI_FORMAT_R1_UNORM									= 66,
	~0,																							//DXGI_FORMAT_R9G9B9E5_SHAREDEXP				= 67,
	~0,																							//DXGI_FORMAT_R8G8_B8G8_UNORM						= 68,
	~0,																							//DXGI_FORMAT_G8R8_G8B8_UNORM						= 69,
	CELL_GCM_TEXTURE_COMPRESSED_DXT1,								//DXGI_FORMAT_BC1_TYPELESS							= 70,
	CELL_GCM_TEXTURE_COMPRESSED_DXT1,								//DXGI_FORMAT_BC1_UNORM									= 71,
	CELL_GCM_TEXTURE_COMPRESSED_DXT1,								//DXGI_FORMAT_BC1_UNORM_SRGB						= 72,
	CELL_GCM_TEXTURE_COMPRESSED_DXT23,							//DXGI_FORMAT_BC2_TYPELESS							= 73,
	CELL_GCM_TEXTURE_COMPRESSED_DXT23,							//DXGI_FORMAT_BC2_UNORM									= 74,
	CELL_GCM_TEXTURE_COMPRESSED_DXT23,							//DXGI_FORMAT_BC2_UNORM_SRGB						= 75,
	CELL_GCM_TEXTURE_COMPRESSED_DXT45,							//DXGI_FORMAT_BC3_TYPELESS							= 76,
	CELL_GCM_TEXTURE_COMPRESSED_DXT45,							//DXGI_FORMAT_BC3_UNORM									= 77,
	CELL_GCM_TEXTURE_COMPRESSED_DXT45,							//DXGI_FORMAT_BC3_UNORM_SRGB						= 78,
	~0,																							//DXGI_FORMAT_BC4_TYPELESS							= 79,
	~0,																							//DXGI_FORMAT_BC4_UNORM									= 80,
	~0,																							//DXGI_FORMAT_BC4_SNORM									= 81,
	~0,																							//DXGI_FORMAT_BC5_TYPELESS							= 82,
	~0,																							//DXGI_FORMAT_BC5_UNORM									= 83,
	~0,																							//DXGI_FORMAT_BC5_SNORM									= 84,
	CELL_GCM_TEXTURE_R5G6B5,												//DXGI_FORMAT_B5G6R5_UNORM							= 85,
	CELL_GCM_TEXTURE_R5G6B5,												//DXGI_FORMAT_B5G5R5A1_UNORM						= 86,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_B8G8R8A8_UNORM						= 87,
	CELL_GCM_TEXTURE_A8R8G8B8,											//DXGI_FORMAT_B8G8R8X8_UNORM						= 88,
	~0																							//DXGI_FORMAT_FORCE_UINT								= 0xffffffffUL
};

#define GCM_TextureFormatSize(S,X) (((S)*GCM_TEXTUREFORMAT_SIZE[((X)&~(CELL_GCM_TEXTURE_LN|CELL_GCM_TEXTURE_UN))-0x81])>>1)
static uint8	GCM_TEXTUREFORMAT_SIZE[]=
{
	1*2,//CELL_GCM_TEXTURE_B8						= (0x81),
	2*2,//CELL_GCM_TEXTURE_A1R5G5B5				= (0x82),
	2*2,//CELL_GCM_TEXTURE_A4R4G4B4				= (0x83),
	2*2,//CELL_GCM_TEXTURE_R5G6B5					= (0x84),
	4*2,//CELL_GCM_TEXTURE_A8R8G8B8				= (0x85),
	1,//CELL_GCM_TEXTURE_COMPRESSED_DXT1		= (0x86),
	1*2,//CELL_GCM_TEXTURE_COMPRESSED_DXT23		= (0x87),
	1*2,//CELL_GCM_TEXTURE_COMPRESSED_DXT45		= (0x88),
	~0,//0x89
	~0,//0x8A
	2*2,//CELL_GCM_TEXTURE_G8B8					= (0x8B),
	~0,//0x8C
	~0,//0x8D
	~0,//0x8E
	2*2,//CELL_GCM_TEXTURE_R6G5B5					= (0x8F),
	4*2,//CELL_GCM_TEXTURE_DEPTH24_D8				= (0x90),
	4*2,//CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT		= (0x91),
	2*2,//CELL_GCM_TEXTURE_DEPTH16				= (0x92),
	2*2,//CELL_GCM_TEXTURE_DEPTH16_FLOAT			= (0x93),
	2*2,//CELL_GCM_TEXTURE_X16					= (0x94),
	4*2,//CELL_GCM_TEXTURE_Y16_X16				= (0x95),
	0,//(0x96),
	2*2,//CELL_GCM_TEXTURE_R5G5B5A1				= (0x97),
	2*2,//CELL_GCM_TEXTURE_COMPRESSED_HILO8		= (0x98),
	2*2,//CELL_GCM_TEXTURE_COMPRESSED_HILO_S8		= (0x99),
	8*2,//CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT	= (0x9A),
	16*2,//CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT	= (0x9B),
	4*2,//CELL_GCM_TEXTURE_X32_FLOAT				= (0x9C),
	2*2,//CELL_GCM_TEXTURE_D1R5G5B5				= (0x9D),
	4*2,//CELL_GCM_TEXTURE_D8R8G8B8				= (0x9E),
	4*2,//CELL_GCM_TEXTURE_Y16_X16_FLOAT			= (0x9F),
	~0,//0xA0
	~0,//0xA1
	~0,//0xA2
	~0,//0xA3
	~0,//0xA4
	~0,//0xA5
	~0,//0xA6
	~0,//0xA7
	~0,//0xA8
	~0,//0xA9
	~0,//0xAA
	~0,//0xAB
	~0,//0xAC
	4*2,//CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8	= (0xAD),
	4*2//CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8	= (0xAE),
};

#define GCM_TextureFormat2SurfaceFormat(X) GCM_TEXTUREFORMAT2SURFACEFORMAT[(X)-0x81]
static uint8	GCM_TEXTUREFORMAT2SURFACEFORMAT[]=
{
	CELL_GCM_SURFACE_B8,//CELL_GCM_TEXTURE_B8						= (0x81),
	CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5,//CELL_GCM_TEXTURE_A1R5G5B5				= (0x82),
	0,//CELL_GCM_TEXTURE_A4R4G4B4				= (0x83),
	CELL_GCM_SURFACE_R5G6B5,//CELL_GCM_TEXTURE_R5G6B5					= (0x84),
	CELL_GCM_SURFACE_A8R8G8B8,//CELL_GCM_TEXTURE_A8R8G8B8				= (0x85),
	0,//CELL_GCM_TEXTURE_COMPRESSED_DXT1		= (0x86),
	0,//CELL_GCM_TEXTURE_COMPRESSED_DXT23		= (0x87),
	0,//CELL_GCM_TEXTURE_COMPRESSED_DXT45		= (0x88),
	0,//0x89
	0,//0x8A
	CELL_GCM_SURFACE_G8B8,//CELL_GCM_TEXTURE_G8B8					= (0x8B),
	0,//0x8C
	0,//0x8D
	0,//0x8E
	CELL_GCM_SURFACE_R5G6B5,//CELL_GCM_TEXTURE_R6G5B5					= (0x8F),
	CELL_GCM_SURFACE_Z24S8,//CELL_GCM_TEXTURE_DEPTH24_D8				= (0x90),
	CELL_GCM_SURFACE_Z24S8,//CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT		= (0x91),
	CELL_GCM_SURFACE_Z16,//CELL_GCM_TEXTURE_DEPTH16				= (0x92),
	CELL_GCM_SURFACE_Z16,//CELL_GCM_TEXTURE_DEPTH16_FLOAT			= (0x93),
	0,//CELL_GCM_TEXTURE_X16					= (0x94),
	0,//CELL_GCM_TEXTURE_Y16_X16				= (0x95),
	0,//= (0x96),
	CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5,//CELL_GCM_TEXTURE_R5G5B5A1				= (0x97),
	0,//CELL_GCM_TEXTURE_COMPRESSED_HILO8		= (0x98),
	0,//CELL_GCM_TEXTURE_COMPRESSED_HILO_S8		= (0x99),
	CELL_GCM_SURFACE_F_W16Z16Y16X16,//CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT	= (0x9A),
	CELL_GCM_SURFACE_F_W32Z32Y32X32,//CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT	= (0x9B),
	CELL_GCM_SURFACE_F_X32,//CELL_GCM_TEXTURE_X32_FLOAT				= (0x9C),
	CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5,//CELL_GCM_TEXTURE_D1R5G5B5				= (0x9D),
	CELL_GCM_SURFACE_A8R8G8B8,//CELL_GCM_TEXTURE_D8R8G8B8				= (0x9E),
	0,//CELL_GCM_TEXTURE_Y16_X16_FLOAT			= (0x9F),
	0,//0xA0
	0,//0xA1
	0,//0xA2
	0,//0xA3
	0,//0xA4
	0,//0xA5
	0,//0xA6
	0,//0xA7
	0,//0xA8
	0,//0xA9
	0,//0xAA
	0,//0xAB
	0,//0xAC
	0,//CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8	= (0xAD),
	0//CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8	= (0xAE),
};

#endif

