Browse Source

Removed a bunch of pixel formats

Marko Pintera 12 years ago
parent
commit
54bb560e81

+ 8 - 8
CamelotClient/CamelotClient.cpp

@@ -28,9 +28,9 @@
 #include "CmTestTextSprite.h"
 #include "CmTestTextSprite.h"
 #include "CmEditorWindow.h"
 #include "CmEditorWindow.h"
 
 
-//#define DX11
+#define DX11
 //#define DX9
 //#define DX9
-#define GL
+//#define GL
 
 
 using namespace CamelotFramework;
 using namespace CamelotFramework;
 using namespace CamelotEditor;
 using namespace CamelotEditor;
@@ -70,8 +70,8 @@ int CALLBACK WinMain(
 	HSceneObject testModelGO = SceneObject::create("TestMesh");
 	HSceneObject testModelGO = SceneObject::create("TestMesh");
 	HRenderable testRenderable = testModelGO->addComponent<Renderable>();
 	HRenderable testRenderable = testModelGO->addComponent<Renderable>();
 
 
-//	HSceneObject testTextGO = SceneObject::create("TestText");
-//	GameObjectHandle<TestTextSprite> textSprite = testTextGO->addComponent<TestTextSprite>();
+	HSceneObject testTextGO = SceneObject::create("TestText");
+	GameObjectHandle<TestTextSprite> textSprite = testTextGO->addComponent<TestTextSprite>();
 
 
 	HFont font;
 	HFont font;
 	
 	
@@ -89,12 +89,12 @@ int CALLBACK WinMain(
 		font = Importer::instance().import("C:\\arial.ttf", fontImportOptions);
 		font = Importer::instance().import("C:\\arial.ttf", fontImportOptions);
 	}
 	}
 
 
-//	HTexture windowFrameTex = static_resource_cast<Texture>(Importer::instance().import("C:\\WindowFrameTest.bmp"));
-//	gResources().create(windowFrameTex, "C:\\WindowFrameTest.tex", true);
+	HTexture windowFrameTex = static_resource_cast<Texture>(Importer::instance().import("C:\\WindowFrameTest.bmp"));
+	gResources().create(windowFrameTex, "C:\\WindowFrameTest.tex", true);
 
 
-//	windowFrameTex.waitUntilLoaded();
+	windowFrameTex.waitUntilLoaded();
 
 
-//	textSprite->init(camera, "Testing in a new row, does this work?", font, 12, windowFrameTex);
+	textSprite->init(camera, "Testing in a new row, does this work?", font, 12, windowFrameTex);
 
 
 #if defined DX9
 #if defined DX9
 	///////////////// HLSL 9 SHADERS //////////////////////////
 	///////////////// HLSL 9 SHADERS //////////////////////////

+ 18 - 30
CamelotD3D11RenderSystem/Source/CmD3D11Mappings.cpp

@@ -442,7 +442,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_UNKNOWN	:
 		case DXGI_FORMAT_UNKNOWN	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32A32_TYPELESS	:
 		case DXGI_FORMAT_R32G32B32A32_TYPELESS	:
-			return PF_FLOAT32_RGBA;
+			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32A32_FLOAT	:
 		case DXGI_FORMAT_R32G32B32A32_FLOAT	:
 			return PF_FLOAT32_RGBA;
 			return PF_FLOAT32_RGBA;
 		case DXGI_FORMAT_R32G32B32A32_UINT	:
 		case DXGI_FORMAT_R32G32B32A32_UINT	:
@@ -450,7 +450,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R32G32B32A32_SINT	:
 		case DXGI_FORMAT_R32G32B32A32_SINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32_TYPELESS	:
 		case DXGI_FORMAT_R32G32B32_TYPELESS	:
-			return PF_FLOAT32_RGB;
+			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32_FLOAT	:
 		case DXGI_FORMAT_R32G32B32_FLOAT	:
 			return PF_FLOAT32_RGB;
 			return PF_FLOAT32_RGB;
 		case DXGI_FORMAT_R32G32B32_UINT	:
 		case DXGI_FORMAT_R32G32B32_UINT	:
@@ -458,7 +458,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R32G32B32_SINT	:
 		case DXGI_FORMAT_R32G32B32_SINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16B16A16_TYPELESS	:
 		case DXGI_FORMAT_R16G16B16A16_TYPELESS	:
-			return PF_FLOAT16_RGBA;
+			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16B16A16_FLOAT	:
 		case DXGI_FORMAT_R16G16B16A16_FLOAT	:
 			return PF_FLOAT16_RGBA;
 			return PF_FLOAT16_RGBA;
 		case DXGI_FORMAT_R16G16B16A16_UNORM	:
 		case DXGI_FORMAT_R16G16B16A16_UNORM	:
@@ -472,7 +472,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R32G32_TYPELESS	:
 		case DXGI_FORMAT_R32G32_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32_FLOAT	:
 		case DXGI_FORMAT_R32G32_FLOAT	:
-			return PF_UNKNOWN;
+			return PF_FLOAT32_RG;
 		case DXGI_FORMAT_R32G32_UINT	:
 		case DXGI_FORMAT_R32G32_UINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32_SINT	:
 		case DXGI_FORMAT_R32G32_SINT	:
@@ -508,7 +508,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R16G16_TYPELESS	:
 		case DXGI_FORMAT_R16G16_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16_FLOAT	:
 		case DXGI_FORMAT_R16G16_FLOAT	:
-			return PF_UNKNOWN;
+			return PF_FLOAT16_RG;
 		case DXGI_FORMAT_R16G16_UNORM	:
 		case DXGI_FORMAT_R16G16_UNORM	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16_UINT	:
 		case DXGI_FORMAT_R16G16_UINT	:
@@ -522,7 +522,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_D32_FLOAT	:
 		case DXGI_FORMAT_D32_FLOAT	:
 			return PF_D32;
 			return PF_D32;
 		case DXGI_FORMAT_R32_FLOAT	:
 		case DXGI_FORMAT_R32_FLOAT	:
-			return PF_UNKNOWN;
+			return PF_FLOAT32_R;
 		case DXGI_FORMAT_R32_UINT	:
 		case DXGI_FORMAT_R32_UINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32_SINT	:
 		case DXGI_FORMAT_R32_SINT	:
@@ -548,9 +548,9 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R16_TYPELESS	:
 		case DXGI_FORMAT_R16_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16_FLOAT	:
 		case DXGI_FORMAT_R16_FLOAT	:
-			return PF_UNKNOWN;
+			return PF_FLOAT16_R;
 		case DXGI_FORMAT_D16_UNORM	:
 		case DXGI_FORMAT_D16_UNORM	:
-			return PF_UNKNOWN;
+			return PF_D16;
 		case DXGI_FORMAT_R16_UNORM	:
 		case DXGI_FORMAT_R16_UNORM	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16_UINT	:
 		case DXGI_FORMAT_R16_UINT	:
@@ -562,7 +562,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R8_TYPELESS	:
 		case DXGI_FORMAT_R8_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8_UNORM	:
 		case DXGI_FORMAT_R8_UNORM	:
-			return PF_UNKNOWN;
+			return PF_R8;
 		case DXGI_FORMAT_R8_UINT	:
 		case DXGI_FORMAT_R8_UINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8_SNORM	:
 		case DXGI_FORMAT_R8_SNORM	:
@@ -626,24 +626,10 @@ namespace CamelotFramework
 	{
 	{
 		switch(enginePF)
 		switch(enginePF)
 		{
 		{
-		case PF_L8:
+		case PF_R8:
 			return DXGI_FORMAT_R8_UNORM;
 			return DXGI_FORMAT_R8_UNORM;
-		case PF_L16:
-			return DXGI_FORMAT_R16_UNORM;
-		case PF_A8:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_A4L4:
-			return DXGI_FORMAT_UNKNOWN;
 		case PF_R8G8:
 		case PF_R8G8:
 			return DXGI_FORMAT_R8G8_UNORM; 
 			return DXGI_FORMAT_R8G8_UNORM; 
-		case PF_R3G3B2:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_A1R5G5B5:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_R5G6B5:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_A4R4G4B4:
-			return DXGI_FORMAT_UNKNOWN;
 		case PF_R8G8B8:
 		case PF_R8G8B8:
 			return DXGI_FORMAT_UNKNOWN;
 			return DXGI_FORMAT_UNKNOWN;
 		case PF_A8R8G8B8:
 		case PF_A8R8G8B8:
@@ -658,20 +644,22 @@ namespace CamelotFramework
 			return DXGI_FORMAT_R8G8B8A8_UNORM;
 			return DXGI_FORMAT_R8G8B8A8_UNORM;
 		case PF_B8G8R8A8:
 		case PF_B8G8R8A8:
 			return DXGI_FORMAT_B8G8R8A8_UNORM;
 			return DXGI_FORMAT_B8G8R8A8_UNORM;
-		case PF_A2B10G10R10:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_A2R10G10B10:
-			return DXGI_FORMAT_UNKNOWN;
 		case PF_FLOAT16_R:
 		case PF_FLOAT16_R:
 			return DXGI_FORMAT_R16_FLOAT;
 			return DXGI_FORMAT_R16_FLOAT;
+		case PF_FLOAT16_RG:
+			return DXGI_FORMAT_R16G16_FLOAT;
+		case PF_FLOAT16_RGB:
+			return DXGI_FORMAT_UNKNOWN;
 		case PF_FLOAT16_RGBA:
 		case PF_FLOAT16_RGBA:
 			return DXGI_FORMAT_R16G16B16A16_FLOAT;
 			return DXGI_FORMAT_R16G16B16A16_FLOAT;
 		case PF_FLOAT32_R:
 		case PF_FLOAT32_R:
 			return DXGI_FORMAT_R32_FLOAT;
 			return DXGI_FORMAT_R32_FLOAT;
+		case PF_FLOAT32_RG:
+			return DXGI_FORMAT_R32G32_FLOAT;
+		case PF_FLOAT32_RGB:
+			return DXGI_FORMAT_R32G32B32_FLOAT;
 		case PF_FLOAT32_RGBA:
 		case PF_FLOAT32_RGBA:
 			return DXGI_FORMAT_R32G32B32A32_FLOAT;
 			return DXGI_FORMAT_R32G32B32A32_FLOAT;
-		case PF_SHORT_RGBA:
-			return DXGI_FORMAT_R16G16B16A16_UNORM;
 		case PF_DXT1:
 		case PF_DXT1:
 			return DXGI_FORMAT_BC1_UNORM;
 			return DXGI_FORMAT_BC1_UNORM;
 		case PF_DXT2:
 		case PF_DXT2:

+ 6 - 58
CamelotD3D9Renderer/Source/CmD3D9Mappings.cpp

@@ -466,24 +466,8 @@ namespace CamelotFramework
 	{
 	{
 		switch(d3dPF)
 		switch(d3dPF)
 		{
 		{
-		case D3DFMT_A8:
-			return PF_A8;
 		case D3DFMT_L8:
 		case D3DFMT_L8:
-			return PF_L8;
-		case D3DFMT_L16:
-			return PF_L16;
-		case D3DFMT_A4L4:
-			return PF_A4L4;
-		case D3DFMT_A8L8:
-			return PF_R8G8;	// Assume little endian here
-		case D3DFMT_R3G3B2:
-			return PF_R3G3B2;
-		case D3DFMT_A1R5G5B5:
-			return PF_A1R5G5B5;
-		case D3DFMT_A4R4G4B4:
-			return PF_A4R4G4B4;
-		case D3DFMT_R5G6B5:
-			return PF_R5G6B5;
+			return PF_R8;
 		case D3DFMT_R8G8B8:
 		case D3DFMT_R8G8B8:
 			return PF_R8G8B8;
 			return PF_R8G8B8;
 		case D3DFMT_X8R8G8B8:
 		case D3DFMT_X8R8G8B8:
@@ -494,10 +478,6 @@ namespace CamelotFramework
 			return PF_X8B8G8R8;
 			return PF_X8B8G8R8;
 		case D3DFMT_A8B8G8R8:
 		case D3DFMT_A8B8G8R8:
 			return PF_A8B8G8R8;
 			return PF_A8B8G8R8;
-		case D3DFMT_A2R10G10B10:
-			return PF_A2R10G10B10;
-        case D3DFMT_A2B10G10R10:
-           return PF_A2B10G10R10;
 		case D3DFMT_R16F:
 		case D3DFMT_R16F:
 			return PF_FLOAT16_R;
 			return PF_FLOAT16_R;
 		case D3DFMT_A16B16G16R16F:
 		case D3DFMT_A16B16G16R16F:
@@ -505,15 +485,11 @@ namespace CamelotFramework
 		case D3DFMT_R32F:
 		case D3DFMT_R32F:
 			return PF_FLOAT32_R;
 			return PF_FLOAT32_R;
 		case D3DFMT_G32R32F:
 		case D3DFMT_G32R32F:
-			return PF_FLOAT32_GR;
+			return PF_FLOAT32_RG;
 		case D3DFMT_A32B32G32R32F:
 		case D3DFMT_A32B32G32R32F:
 			return PF_FLOAT32_RGBA;
 			return PF_FLOAT32_RGBA;
 		case D3DFMT_G16R16F:
 		case D3DFMT_G16R16F:
-			return PF_FLOAT16_GR;
-		case D3DFMT_A16B16G16R16:
-			return PF_SHORT_RGBA;
-		case D3DFMT_G16R16:
-			return PF_SHORT_GR;
+			return PF_FLOAT16_RG;
 		case D3DFMT_DXT1:
 		case D3DFMT_DXT1:
 			return PF_DXT1;
 			return PF_DXT1;
 		case D3DFMT_DXT2:
 		case D3DFMT_DXT2:
@@ -539,24 +515,8 @@ namespace CamelotFramework
 	{
 	{
 		switch(camelotPf)
 		switch(camelotPf)
 		{
 		{
-		case PF_L8:
+		case PF_R8:
 			return D3DFMT_L8;
 			return D3DFMT_L8;
-		case PF_L16:
-			return D3DFMT_L16;
-		case PF_A8:
-			return D3DFMT_A8;
-		case PF_A4L4:
-			return D3DFMT_A4L4;
-		case PF_R8G8:
-			return D3DFMT_A8L8; // Assume little endian here
-		case PF_R3G3B2:
-			return D3DFMT_R3G3B2;
-		case PF_A1R5G5B5:
-			return D3DFMT_A1R5G5B5;
-		case PF_R5G6B5:
-			return D3DFMT_R5G6B5;
-		case PF_A4R4G4B4:
-			return D3DFMT_A4R4G4B4;
 		case PF_R8G8B8:
 		case PF_R8G8B8:
 			return D3DFMT_R8G8B8;
 			return D3DFMT_R8G8B8;
 		case PF_A8R8G8B8:
 		case PF_A8R8G8B8:
@@ -567,26 +527,18 @@ namespace CamelotFramework
 			return D3DFMT_X8R8G8B8;
 			return D3DFMT_X8R8G8B8;
 		case PF_X8B8G8R8:
 		case PF_X8B8G8R8:
 			return D3DFMT_X8B8G8R8;
 			return D3DFMT_X8B8G8R8;
-		case PF_A2B10G10R10:
-            return D3DFMT_A2B10G10R10;
-		case PF_A2R10G10B10:
-			return D3DFMT_A2R10G10B10;
 		case PF_FLOAT16_R:
 		case PF_FLOAT16_R:
 			return D3DFMT_R16F;
 			return D3DFMT_R16F;
-		case PF_FLOAT16_GR:
+		case PF_FLOAT16_RG:
 			return D3DFMT_G16R16F;
 			return D3DFMT_G16R16F;
 		case PF_FLOAT16_RGBA:
 		case PF_FLOAT16_RGBA:
 			return D3DFMT_A16B16G16R16F;
 			return D3DFMT_A16B16G16R16F;
 		case PF_FLOAT32_R:
 		case PF_FLOAT32_R:
 			return D3DFMT_R32F;
 			return D3DFMT_R32F;
-		case PF_FLOAT32_GR:
+		case PF_FLOAT32_RG:
 			return D3DFMT_G32R32F;
 			return D3DFMT_G32R32F;
 		case PF_FLOAT32_RGBA:
 		case PF_FLOAT32_RGBA:
 			return D3DFMT_A32B32G32R32F;
 			return D3DFMT_A32B32G32R32F;
-		case PF_SHORT_RGBA:
-			return D3DFMT_A16B16G16R16;
-		case PF_SHORT_GR:
-			return D3DFMT_G16R16;
 		case PF_DXT1:
 		case PF_DXT1:
 			return D3DFMT_DXT1;
 			return D3DFMT_DXT1;
 		case PF_DXT2:
 		case PF_DXT2:
@@ -618,14 +570,10 @@ namespace CamelotFramework
 
 
 		switch(enginePF)
 		switch(enginePF)
 		{
 		{
-		case PF_B5G6R5:
-			return PF_R5G6B5;
 		case PF_B8G8R8:
 		case PF_B8G8R8:
 			return PF_R8G8B8;
 			return PF_R8G8B8;
 		case PF_B8G8R8A8:
 		case PF_B8G8R8A8:
 			return PF_A8R8G8B8;
 			return PF_A8R8G8B8;
-        case PF_SHORT_RGB:
-            return PF_SHORT_RGBA;
 		case PF_FLOAT16_RGB:
 		case PF_FLOAT16_RGB:
 			return PF_FLOAT16_RGBA;
 			return PF_FLOAT16_RGBA;
 		case PF_FLOAT32_RGB:
 		case PF_FLOAT32_RGB:

+ 1 - 1
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -2208,7 +2208,7 @@ namespace CamelotFramework
 		D3DSURFACE_DESC bbSurfDesc;
 		D3DSURFACE_DESC bbSurfDesc;
 		bbSurf->GetDesc(&bbSurfDesc);
 		bbSurf->GetDesc(&bbSurfDesc);
 
 
-		for (UINT32 ipf = static_cast<UINT32>(PF_L8); ipf < static_cast<UINT32>(PF_COUNT); ++ipf)
+		for (UINT32 ipf = 1; ipf < static_cast<UINT32>(PF_COUNT); ++ipf)
 		{
 		{
 			PixelFormat pf = (PixelFormat)ipf;
 			PixelFormat pf = (PixelFormat)ipf;
 
 

+ 9 - 18
CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp

@@ -10,18 +10,6 @@
 
 
 #include "FreeImage.h"
 #include "FreeImage.h"
 
 
-// freeimage 3.9.1~3.11.0 interoperability fix
-#ifndef FREEIMAGE_COLORORDER
-// we have freeimage 3.9.1, define these symbols in such way as 3.9.1 really work (do not use 3.11.0 definition, as color order was changed between these two versions on Apple systems)
-#define FREEIMAGE_COLORORDER_BGR	0
-#define FREEIMAGE_COLORORDER_RGB	1
-#if defined(FREEIMAGE_BIGENDIAN)
-#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
-#else
-#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
-#endif
-#endif
-
 namespace CamelotFramework
 namespace CamelotFramework
 {
 {
 	void FreeImageLoadErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) 
 	void FreeImageLoadErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) 
@@ -239,19 +227,21 @@ namespace CamelotFramework
 			switch(bpp)
 			switch(bpp)
 			{
 			{
 			case 8:
 			case 8:
-				format = PF_L8;
+				format = PF_R8;
 				break;
 				break;
 			case 16:
 			case 16:
 				// Determine 555 or 565 from green mask
 				// Determine 555 or 565 from green mask
 				// cannot be 16-bit greyscale since that's FIT_UINT16
 				// cannot be 16-bit greyscale since that's FIT_UINT16
 				if(FreeImage_GetGreenMask(fiBitmap) == FI16_565_GREEN_MASK)
 				if(FreeImage_GetGreenMask(fiBitmap) == FI16_565_GREEN_MASK)
 				{
 				{
-					format = PF_R5G6B5;
+					assert(false && "Format not supported by the engine. TODO.");
+					return nullptr;
 				}
 				}
 				else
 				else
 				{
 				{
+					assert(false && "Format not supported by the engine. TODO.");
+					return nullptr;
 					// FreeImage doesn't support 4444 format so must be 1555
 					// FreeImage doesn't support 4444 format so must be 1555
-					format = PF_A1R5G5B5;
 				}
 				}
 				break;
 				break;
 			case 24:
 			case 24:
@@ -278,17 +268,18 @@ namespace CamelotFramework
 		case FIT_UINT16:
 		case FIT_UINT16:
 		case FIT_INT16:
 		case FIT_INT16:
 			// 16-bit greyscale
 			// 16-bit greyscale
-			format = PF_L16;
+			assert(false && "No INT pixel formats supported currently. TODO.");
+			return nullptr;
 			break;
 			break;
 		case FIT_FLOAT:
 		case FIT_FLOAT:
 			// Single-component floating point data
 			// Single-component floating point data
 			format = PF_FLOAT32_R;
 			format = PF_FLOAT32_R;
 			break;
 			break;
 		case FIT_RGB16:
 		case FIT_RGB16:
-			format = PF_SHORT_RGB;
+			format = PF_FLOAT16_RGB;
 			break;
 			break;
 		case FIT_RGBA16:
 		case FIT_RGBA16:
-			format = PF_SHORT_RGBA;
+			format = PF_FLOAT16_RGBA;
 			break;
 			break;
 		case FIT_RGBF:
 		case FIT_RGBF:
 			format = PF_FLOAT32_RGB;
 			format = PF_FLOAT32_RGB;

+ 0 - 2
CamelotGLRenderer/Source/CmGLPixelBuffer.cpp

@@ -680,8 +680,6 @@ namespace CamelotFramework
 		/// - Either source or target is luminance due doesn't looks like supported by hardware
 		/// - Either source or target is luminance due doesn't looks like supported by hardware
 		/// - the source dimensions match the destination ones, in which case no scaling is needed
 		/// - the source dimensions match the destination ones, in which case no scaling is needed
 		if(!GLEW_EXT_framebuffer_object ||
 		if(!GLEW_EXT_framebuffer_object ||
-			PixelUtil::isLuminance(src_orig.format) ||
-			PixelUtil::isLuminance(mFormat) ||
 			(src_orig.getWidth() == dstBox.getWidth() &&
 			(src_orig.getWidth() == dstBox.getWidth() &&
 			src_orig.getHeight() == dstBox.getHeight() &&
 			src_orig.getHeight() == dstBox.getHeight() &&
 			src_orig.getDepth() == dstBox.getDepth()))
 			src_orig.getDepth() == dstBox.getDepth()))

+ 34 - 147
CamelotGLRenderer/Source/CmGLPixelFormat.cpp

@@ -37,37 +37,14 @@ namespace CamelotFramework  {
     {
     {
         switch(mFormat)
         switch(mFormat)
         {
         {
-			case PF_A8:
-				return GL_ALPHA;
-            case PF_L8:
-                return GL_LUMINANCE;
-            case PF_L16:
-                return GL_LUMINANCE;
+			case PF_R8:
+				return GL_RED;
 			case PF_R8G8:
 			case PF_R8G8:
 				return GL_RG;
 				return GL_RG;
-			case PF_R3G3B2:
-				return GL_RGB;
-			case PF_A1R5G5B5:
-				return GL_BGRA;
-			case PF_R5G6B5:
-				return GL_RGB;
-			case PF_B5G6R5:
-				return GL_BGR;
-			case PF_A4R4G4B4:
-				return GL_BGRA;
-#if CM_ENDIAN == CM_ENDIAN_BIG
-            // Formats are in native endian, so R8G8B8 on little endian is
-            // BGR, on big endian it is RGB.
-            case PF_R8G8B8:
-                return GL_RGB;
-            case PF_B8G8R8:
-                return GL_BGR;
-#else
             case PF_R8G8B8:
             case PF_R8G8B8:
                 return GL_BGR;
                 return GL_BGR;
             case PF_B8G8R8:
             case PF_B8G8R8:
                 return GL_RGB;
                 return GL_RGB;
-#endif
 			case PF_X8R8G8B8:
 			case PF_X8R8G8B8:
 			case PF_A8R8G8B8:
 			case PF_A8R8G8B8:
 				return GL_BGRA;
 				return GL_BGRA;
@@ -78,32 +55,22 @@ namespace CamelotFramework  {
                 return GL_BGRA;
                 return GL_BGRA;
 			case PF_R8G8B8A8:
 			case PF_R8G8B8A8:
 				return GL_RGBA;
 				return GL_RGBA;
-            case PF_A2R10G10B10:
-                return GL_BGRA;
-            case PF_A2B10G10R10:
-                return GL_RGBA;
 			case PF_FLOAT16_R:
 			case PF_FLOAT16_R:
-                return GL_LUMINANCE;
-			case PF_FLOAT16_GR:
-				return GL_LUMINANCE_ALPHA;
+                return GL_RED;
+			case PF_FLOAT16_RG:
+				return GL_RG;
             case PF_FLOAT16_RGB:
             case PF_FLOAT16_RGB:
                 return GL_RGB;
                 return GL_RGB;
             case PF_FLOAT16_RGBA:
             case PF_FLOAT16_RGBA:
                 return GL_RGBA;
                 return GL_RGBA;
 			case PF_FLOAT32_R:
 			case PF_FLOAT32_R:
-                return GL_LUMINANCE;
-			case PF_FLOAT32_GR:
-				return GL_LUMINANCE_ALPHA;
+                return GL_RED;
+			case PF_FLOAT32_RG:
+				return GL_RG;
             case PF_FLOAT32_RGB:
             case PF_FLOAT32_RGB:
                 return GL_RGB;
                 return GL_RGB;
             case PF_FLOAT32_RGBA:
             case PF_FLOAT32_RGBA:
                 return GL_RGBA;
                 return GL_RGBA;
-			case PF_SHORT_RGBA:
-				return GL_RGBA;
-            case PF_SHORT_RGB:
-                return GL_RGB;
-			case PF_SHORT_GR:
-				return GL_LUMINANCE_ALPHA;
             case PF_DXT1:
             case PF_DXT1:
                 return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
                 return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
             case PF_DXT3:
             case PF_DXT3:
@@ -119,35 +86,11 @@ namespace CamelotFramework  {
     {
     {
         switch(mFormat)
         switch(mFormat)
         {
         {
-			case PF_A8:
-            case PF_L8:
+			case PF_R8:
             case PF_R8G8B8:
             case PF_R8G8B8:
             case PF_B8G8R8:
             case PF_B8G8R8:
 			case PF_R8G8:
 			case PF_R8G8:
                 return GL_UNSIGNED_BYTE;
                 return GL_UNSIGNED_BYTE;
-			case PF_R3G3B2:
-				return GL_UNSIGNED_BYTE_3_3_2;
-			case PF_A1R5G5B5:
-				return GL_UNSIGNED_SHORT_1_5_5_5_REV;
-			case PF_R5G6B5:
-			case PF_B5G6R5:
-				return GL_UNSIGNED_SHORT_5_6_5;
-			case PF_A4R4G4B4:
-				return GL_UNSIGNED_SHORT_4_4_4_4_REV;
-            case PF_L16:
-                return GL_UNSIGNED_SHORT;
-#if CM_ENDIAN == CM_ENDIAN_BIG
-			case PF_X8B8G8R8:
-			case PF_A8B8G8R8:
-                return GL_UNSIGNED_INT_8_8_8_8_REV;
-			case PF_X8R8G8B8:
-            case PF_A8R8G8B8:
-				return GL_UNSIGNED_INT_8_8_8_8_REV;
-            case PF_B8G8R8A8:
-                return GL_UNSIGNED_BYTE;
-			case PF_R8G8B8A8:
-				return GL_UNSIGNED_BYTE;
-#else
 			case PF_X8B8G8R8:
 			case PF_X8B8G8R8:
 			case PF_A8B8G8R8:
 			case PF_A8B8G8R8:
                 return GL_UNSIGNED_BYTE;
                 return GL_UNSIGNED_BYTE;
@@ -158,25 +101,16 @@ namespace CamelotFramework  {
                 return GL_UNSIGNED_INT_8_8_8_8;
                 return GL_UNSIGNED_INT_8_8_8_8;
 			case PF_R8G8B8A8:
 			case PF_R8G8B8A8:
 				return GL_UNSIGNED_INT_8_8_8_8;
 				return GL_UNSIGNED_INT_8_8_8_8;
-#endif
-            case PF_A2R10G10B10:
-                return GL_UNSIGNED_INT_2_10_10_10_REV;
-            case PF_A2B10G10R10:
-                return GL_UNSIGNED_INT_2_10_10_10_REV;
 			case PF_FLOAT16_R:
 			case PF_FLOAT16_R:
-			case PF_FLOAT16_GR:
+			case PF_FLOAT16_RG:
             case PF_FLOAT16_RGB:
             case PF_FLOAT16_RGB:
             case PF_FLOAT16_RGBA:
             case PF_FLOAT16_RGBA:
-                return GL_HALF_FLOAT_ARB;
+                return GL_HALF_FLOAT;
 			case PF_FLOAT32_R:
 			case PF_FLOAT32_R:
-			case PF_FLOAT32_GR:
+			case PF_FLOAT32_RG:
             case PF_FLOAT32_RGB:
             case PF_FLOAT32_RGB:
             case PF_FLOAT32_RGBA:
             case PF_FLOAT32_RGBA:
                 return GL_FLOAT;
                 return GL_FLOAT;
-			case PF_SHORT_RGBA:
-            case PF_SHORT_RGB:
-			case PF_SHORT_GR:
-				return GL_UNSIGNED_SHORT;
             default:
             default:
                 return 0;
                 return 0;
         }
         }
@@ -210,25 +144,10 @@ namespace CamelotFramework  {
     GLenum GLPixelUtil::getGLInternalFormat(PixelFormat mFormat, bool hwGamma)
     GLenum GLPixelUtil::getGLInternalFormat(PixelFormat mFormat, bool hwGamma)
     {
     {
         switch(mFormat) {
         switch(mFormat) {
-            case PF_L8:
-                return GL_LUMINANCE8;
-            case PF_L16:
-                return GL_LUMINANCE16;
-            case PF_A8:
-                return GL_ALPHA8;
-            case PF_A4L4:
-                return GL_LUMINANCE4_ALPHA4;
+            case PF_R8:
+                return GL_R8;
 			case PF_R8G8:
 			case PF_R8G8:
 				return GL_RG8;
 				return GL_RG8;
-			case PF_R3G3B2:
-				return GL_R3_G3_B2;
-			case PF_A1R5G5B5:
-				return GL_RGB5_A1;
-            case PF_R5G6B5:
-			case PF_B5G6R5:
-                return GL_RGB5;
-            case PF_A4R4G4B4:
-                return GL_RGBA4;
             case PF_R8G8B8:
             case PF_R8G8B8:
             case PF_B8G8R8:
             case PF_B8G8R8:
 			case PF_X8B8G8R8:
 			case PF_X8B8G8R8:
@@ -243,31 +162,22 @@ namespace CamelotFramework  {
 					return GL_SRGB8_ALPHA8;
 					return GL_SRGB8_ALPHA8;
 				else
 				else
 					return GL_RGBA8;
 					return GL_RGBA8;
-            case PF_A2R10G10B10:
-            case PF_A2B10G10R10:
-                return GL_RGB10_A2;
 			case PF_FLOAT16_R:
 			case PF_FLOAT16_R:
 				return GL_LUMINANCE16F_ARB;
 				return GL_LUMINANCE16F_ARB;
             case PF_FLOAT16_RGB:
             case PF_FLOAT16_RGB:
                 return GL_RGB16F_ARB;
                 return GL_RGB16F_ARB;
-			case PF_FLOAT16_GR: 
-				return GL_LUMINANCE_ALPHA16F_ARB;
+			case PF_FLOAT16_RG: 
+				return GL_RG16F;
             case PF_FLOAT16_RGBA:
             case PF_FLOAT16_RGBA:
-                return GL_RGBA16F_ARB;
+                return GL_RGBA16F;
 			case PF_FLOAT32_R:
 			case PF_FLOAT32_R:
-				return GL_LUMINANCE32F_ARB;
-			case PF_FLOAT32_GR:
-				return GL_LUMINANCE_ALPHA32F_ARB;
+				return GL_R32F;
+			case PF_FLOAT32_RG:
+				return GL_RG32F;
             case PF_FLOAT32_RGB:
             case PF_FLOAT32_RGB:
-                return GL_RGB32F_ARB;
+                return GL_RGB32F;
             case PF_FLOAT32_RGBA:
             case PF_FLOAT32_RGBA:
-                return GL_RGBA32F_ARB;
-			case PF_SHORT_RGBA:
-				return GL_RGBA16;
-            case PF_SHORT_RGB:
-                return GL_RGB16;
-			case PF_SHORT_GR:
-				return GL_LUMINANCE16_ALPHA16;
+                return GL_RGBA32F;
 			case PF_DXT1:
 			case PF_DXT1:
 				if (hwGamma)
 				if (hwGamma)
 					return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
 					return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
@@ -332,54 +242,31 @@ namespace CamelotFramework  {
 	{
 	{
 		switch(fmt) 
 		switch(fmt) 
 		{
 		{
-		case GL_LUMINANCE8:
-			return PF_L8;
-		case GL_LUMINANCE16:
-			return PF_L16;
-		case GL_ALPHA8:
-			return PF_A8;
-		case GL_LUMINANCE4_ALPHA4:
-			// Unsupported by GL as input format, use the byte packed format
-			return PF_R8G8;
+		case GL_R8:
+			return PF_R8;
 		case GL_RG8:
 		case GL_RG8:
 			return PF_R8G8;
 			return PF_R8G8;
-		case GL_R3_G3_B2:
-			return PF_R3G3B2;
-		case GL_RGB5_A1:
-			return PF_A1R5G5B5;
-		case GL_RGB5:
-			return PF_R5G6B5;
-		case GL_RGBA4:
-			return PF_A4R4G4B4;
 		case GL_RGB8:
 		case GL_RGB8:
 		case GL_SRGB8:
 		case GL_SRGB8:
 			return PF_X8R8G8B8;
 			return PF_X8R8G8B8;
 		case GL_RGBA8:
 		case GL_RGBA8:
 		case GL_SRGB8_ALPHA8:
 		case GL_SRGB8_ALPHA8:
 			return PF_A8R8G8B8;
 			return PF_A8R8G8B8;
-		case GL_RGB10_A2:
-			return PF_A2R10G10B10;
-		case GL_RGBA16:
-			return PF_SHORT_RGBA;
-        case GL_RGB16:
-            return PF_SHORT_RGB;
-		case GL_LUMINANCE16_ALPHA16:
-			return PF_SHORT_GR;
-		case GL_LUMINANCE_FLOAT16_ATI:
+		case GL_R16F:
 			return PF_FLOAT16_R;
 			return PF_FLOAT16_R;
-		case GL_LUMINANCE_ALPHA_FLOAT16_ATI:
-			return PF_FLOAT16_GR;
-		case GL_LUMINANCE_ALPHA_FLOAT32_ATI:
-			return PF_FLOAT32_GR;
-		case GL_LUMINANCE_FLOAT32_ATI:
+		case GL_RG16F:
+			return PF_FLOAT16_RG;
+		case GL_RG32F:
+			return PF_FLOAT32_RG;
+		case GL_R32F:
 			return PF_FLOAT32_R;
 			return PF_FLOAT32_R;
-		case GL_RGB_FLOAT16_ATI: // GL_RGB16F_ARB
+		case GL_RGB16F:
 			return PF_FLOAT16_RGB;
 			return PF_FLOAT16_RGB;
-		case GL_RGBA_FLOAT16_ATI:
+		case GL_RGBA16F:
 			return PF_FLOAT16_RGBA;
 			return PF_FLOAT16_RGBA;
-		case GL_RGB_FLOAT32_ATI:
+		case GL_RGB32F:
 			return PF_FLOAT32_RGB;
 			return PF_FLOAT32_RGB;
-		case GL_RGBA_FLOAT32_ATI:
+		case GL_RGBA32F:
 			return PF_FLOAT32_RGBA;
 			return PF_FLOAT32_RGBA;
 		case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 		case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 		case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
 		case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:

+ 0 - 1
CamelotGLRenderer/Source/CmGLRenderTexture.cpp

@@ -339,7 +339,6 @@ static const UINT32 depthBits[] =
         switch(pct)
         switch(pct)
         {
         {
         case PCT_BYTE: format = PF_A8R8G8B8; break;
         case PCT_BYTE: format = PF_A8R8G8B8; break;
-        case PCT_SHORT: format = PF_SHORT_RGBA; break;
         case PCT_FLOAT16: format = PF_FLOAT16_RGBA; break;
         case PCT_FLOAT16: format = PF_FLOAT16_RGBA; break;
         case PCT_FLOAT32: format = PF_FLOAT32_RGBA; break;
         case PCT_FLOAT32: format = PF_FLOAT32_RGBA; break;
         case PCT_COUNT: break;
         case PCT_COUNT: break;

+ 32 - 74
CamelotUtility/Include/CmPixelData.h

@@ -11,47 +11,28 @@ namespace CamelotFramework
     {
     {
         /// Unknown pixel format.
         /// Unknown pixel format.
         PF_UNKNOWN = 0,
         PF_UNKNOWN = 0,
-        /// 8-bit pixel format, all bits luminace.
-        PF_L8 = 1,
-		PF_BYTE_L = PF_L8,
-        /// 16-bit pixel format, all bits luminace.
-        PF_L16 = 2,
-		PF_SHORT_L = PF_L16,
-        /// 8-bit pixel format, all bits alpha.
-        PF_A8 = 3,
-		PF_BYTE_A = PF_A8,
-        /// 8-bit pixel format, 4 bits alpha, 4 bits luminance.
-        PF_A4L4 = 4,
+        /// 8-bit pixel format, all bits red
+        PF_R8 = 1,
 		/// 2 byte pixel format, 1 byte red, 1 byte green
 		/// 2 byte pixel format, 1 byte red, 1 byte green
-		PF_R8G8 = 5,
-        /// 16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.
-        PF_R5G6B5 = 6,
-		/// 16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.
-        PF_B5G6R5 = 7,
-        /// 8-bit pixel format, 2 bits blue, 3 bits green, 3 bits red.
-        PF_R3G3B2 = 31,
-        /// 16-bit pixel format, 4 bits for alpha, red, green and blue.
-        PF_A4R4G4B4 = 8,
-        /// 16-bit pixel format, 5 bits for blue, green, red and 1 for alpha.
-        PF_A1R5G5B5 = 9,
+		PF_R8G8 = 2,
         /// 24-bit pixel format, 8 bits for red, green and blue.
         /// 24-bit pixel format, 8 bits for red, green and blue.
-        PF_R8G8B8 = 10,
+        PF_R8G8B8 = 3,
         /// 24-bit pixel format, 8 bits for blue, green and red.
         /// 24-bit pixel format, 8 bits for blue, green and red.
-        PF_B8G8R8 = 11,
+        PF_B8G8R8 = 4,
         /// 32-bit pixel format, 8 bits for alpha, red, green and blue.
         /// 32-bit pixel format, 8 bits for alpha, red, green and blue.
-        PF_A8R8G8B8 = 12,
+        PF_A8R8G8B8 = 5,
         /// 32-bit pixel format, 8 bits for blue, green, red and alpha.
         /// 32-bit pixel format, 8 bits for blue, green, red and alpha.
-        PF_A8B8G8R8 = 13,
+        PF_A8B8G8R8 = 6,
         /// 32-bit pixel format, 8 bits for blue, green, red and alpha.
         /// 32-bit pixel format, 8 bits for blue, green, red and alpha.
-        PF_B8G8R8A8 = 14,
+        PF_B8G8R8A8 = 7,
 		/// 32-bit pixel format, 8 bits for red, green, blue and alpha.
 		/// 32-bit pixel format, 8 bits for red, green, blue and alpha.
-		PF_R8G8B8A8 = 28,
+		PF_R8G8B8A8 = 8,
         /// 32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue
         /// 32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue
         /// like PF_A8R8G8B8, but alpha will get discarded
         /// like PF_A8R8G8B8, but alpha will get discarded
-        PF_X8R8G8B8 = 26,
+        PF_X8R8G8B8 = 9,
         /// 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red
         /// 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red
         /// like PF_A8B8G8R8, but alpha will get discarded
         /// like PF_A8B8G8R8, but alpha will get discarded
-        PF_X8B8G8R8 = 27,
+        PF_X8B8G8R8 = 10,
 		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
 		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
 		PF_BYTE_RGB = PF_R8G8B8,
 		PF_BYTE_RGB = PF_R8G8B8,
 		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
 		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
@@ -60,62 +41,42 @@ namespace CamelotFramework
 		PF_BYTE_BGRA = PF_B8G8R8A8,
 		PF_BYTE_BGRA = PF_B8G8R8A8,
 		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
 		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
 		PF_BYTE_RGBA = PF_R8G8B8A8,      
 		PF_BYTE_RGBA = PF_R8G8B8A8,      
-        /// 32-bit pixel format, 2 bits for alpha, 10 bits for red, green and blue.
-        PF_A2R10G10B10 = 15,
-        /// 32-bit pixel format, 10 bits for blue, green and red, 2 bits for alpha.
-        PF_A2B10G10R10 = 16,
         /// DDS (DirectDraw Surface) DXT1 format
         /// DDS (DirectDraw Surface) DXT1 format
-        PF_DXT1 = 17,
+        PF_DXT1 = 11,
         /// DDS (DirectDraw Surface) DXT2 format
         /// DDS (DirectDraw Surface) DXT2 format
-        PF_DXT2 = 18,
+        PF_DXT2 = 12,
         /// DDS (DirectDraw Surface) DXT3 format
         /// DDS (DirectDraw Surface) DXT3 format
-        PF_DXT3 = 19,
+        PF_DXT3 = 13,
         /// DDS (DirectDraw Surface) DXT4 format
         /// DDS (DirectDraw Surface) DXT4 format
-        PF_DXT4 = 20,
+        PF_DXT4 = 14,
         /// DDS (DirectDraw Surface) DXT5 format
         /// DDS (DirectDraw Surface) DXT5 format
-        PF_DXT5 = 21,
+        PF_DXT5 = 15,
 		// 16-bit pixel format, 16 bits (float) for red
 		// 16-bit pixel format, 16 bits (float) for red
-        PF_FLOAT16_R = 32,
+        PF_FLOAT16_R = 16,
+		// 32-bit, 2-channel s10e5 floating point pixel format, 16-bit red, 16-bit green
+		PF_FLOAT16_RG = 17,
         // 48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue
         // 48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue
-        PF_FLOAT16_RGB = 22,
+        PF_FLOAT16_RGB = 18,
         // 64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue, 16 bits (float) for alpha
         // 64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue, 16 bits (float) for alpha
-        PF_FLOAT16_RGBA = 23,
+        PF_FLOAT16_RGBA = 19,
 		// 32-bit pixel format, 32 bits (float) for red
 		// 32-bit pixel format, 32 bits (float) for red
-        PF_FLOAT32_R = 33,
+        PF_FLOAT32_R = 20,
+		// 64-bit, 2-channel floating point pixel format, 32-bit red, 32-bit green
+		PF_FLOAT32_RG = 21,
         // 96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue
         // 96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue
-        PF_FLOAT32_RGB = 24,
+        PF_FLOAT32_RGB = 22,
         // 128-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue, 32 bits (float) for alpha
         // 128-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue, 32 bits (float) for alpha
-        PF_FLOAT32_RGBA = 25,
-		// 32-bit, 2-channel s10e5 floating point pixel format, 16-bit green, 16-bit red
-		PF_FLOAT16_GR = 35,
-		// 64-bit, 2-channel floating point pixel format, 32-bit green, 32-bit red
-		PF_FLOAT32_GR = 36,
-		// Depth texture format
-		PF_DEPTH = 29,
-		// 64-bit pixel format, 16 bits for red, green, blue and alpha
-		PF_SHORT_RGBA = 30,
-		// 32-bit pixel format, 16-bit green, 16-bit red
-		PF_SHORT_GR = 34,
-		// 48-bit pixel format, 16 bits for red, green and blue
-		PF_SHORT_RGB = 37,
-        /// PVRTC (PowerVR) RGB 2 bpp
-        PF_PVRTC_RGB2 = 38,
-        /// PVRTC (PowerVR) RGBA 2 bpp
-        PF_PVRTC_RGBA2 = 39,
-        /// PVRTC (PowerVR) RGB 4 bpp
-        PF_PVRTC_RGB4 = 40,
-        /// PVRTC (PowerVR) RGBA 4 bpp
-        PF_PVRTC_RGBA4 = 41,
+        PF_FLOAT32_RGBA = 23,
 		// Depth stencil, 32bit depth, 8bit stencil + 24 unused
 		// Depth stencil, 32bit depth, 8bit stencil + 24 unused
-		PF_D32_S8X24 = 42,
+		PF_D32_S8X24 = 24,
 		// Depth stencil, 24bit depth + 8bit stencil
 		// Depth stencil, 24bit depth + 8bit stencil
-		PF_D24S8 = 43,
+		PF_D24S8 = 25,
 		// Depth, 32bits
 		// Depth, 32bits
-		PF_D32 = 44,
+		PF_D32 = 26,
 		// Depth, 16bits
 		// Depth, 16bits
-		PF_D16 = 45,
+		PF_D16 = 27,
 		// Number of pixel formats currently defined
 		// Number of pixel formats currently defined
-        PF_COUNT = 46
+        PF_COUNT = 28
     };
     };
 	typedef vector<PixelFormat>::type PixelFormatList;
 	typedef vector<PixelFormat>::type PixelFormatList;
 
 
@@ -134,10 +95,7 @@ namespace CamelotFramework
         PFF_DEPTH           = 0x00000008,
         PFF_DEPTH           = 0x00000008,
         // Format is in native endian. Generally true for the 16, 24 and 32 bits
         // Format is in native endian. Generally true for the 16, 24 and 32 bits
         // formats which can be represented as machine integers.
         // formats which can be represented as machine integers.
-        PFF_NATIVEENDIAN    = 0x00000010,
-        // This is an intensity format instead of a RGB one. The luminance
-        // replaces R,G and B. (but not A)
-        PFF_LUMINANCE       = 0x00000020
+        PFF_NATIVEENDIAN    = 0x00000010
     };
     };
     
     
     /** Pixel component format */
     /** Pixel component format */

+ 0 - 13
CamelotUtility/Include/CmPixelUtil.h

@@ -91,8 +91,6 @@ namespace CamelotFramework {
         static bool isDepth(PixelFormat format);
         static bool isDepth(PixelFormat format);
         /** Shortcut method to determine if the format is in native endian format. */
         /** Shortcut method to determine if the format is in native endian format. */
         static bool isNativeEndian(PixelFormat format);
         static bool isNativeEndian(PixelFormat format);
-        /** Shortcut method to determine if the format is a luminance format. */
-        static bool isLuminance(PixelFormat format);
 		
 		
 		/** Return wether a certain image extent is valid for this image format.
 		/** Return wether a certain image extent is valid for this image format.
 			@param width
 			@param width
@@ -165,17 +163,6 @@ namespace CamelotFramework {
         */
         */
         static String getBNFExpressionOfPixelFormats(bool accessibleOnly = false);
         static String getBNFExpressionOfPixelFormats(bool accessibleOnly = false);
 
 
-        /** Returns the similar format but acoording with given bit depths.
-            @param fmt      The original foamt.
-            @param integerBits Preferred bit depth (pixel bits) for integer pixel format.
-                            Available values: 0, 16 and 32, where 0 (the default) means as it is.
-            @param floatBits Preferred bit depth (channel bits) for float pixel format.
-                            Available values: 0, 16 and 32, where 0 (the default) means as it is.
-            @returns        The format that similar original format with bit depth according
-                            with preferred bit depth, or original format if no convertion occuring.
-        */
-        static PixelFormat getFormatForBitDepths(PixelFormat fmt, UINT16 integerBits, UINT16 floatBits);
-
         /** Pack a colour value to memory
         /** Pack a colour value to memory
         	@param colour	The colour
         	@param colour	The colour
         	@param pf		Pixelformat in which to write the colour
         	@param pf		Pixelformat in which to write the colour

+ 134 - 531
CamelotUtility/Source/CmPixelUtil.cpp

@@ -384,127 +384,33 @@ namespace CamelotFramework {
         /* Masks and shifts */
         /* Masks and shifts */
         0, 0, 0, 0, 0, 0, 0, 0
         0, 0, 0, 0, 0, 0, 0, 0
         },
         },
-	//-----------------------------------------------------------------------
-        {"PF_L8",
-        /* Bytes per element */
-        1,
-        /* Flags */
-        PFF_LUMINANCE | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 1,
-        /* rbits, gbits, bbits, abits */
-        8, 0, 0, 0,
-        /* Masks and shifts */
-        0xFF, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_L16",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_LUMINANCE | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_SHORT, 1,
-        /* rbits, gbits, bbits, abits */
-        16, 0, 0, 0,
-        /* Masks and shifts */
-        0xFFFF, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_A8",
-        /* Bytes per element */
-        1,
-        /* Flags */
-        PFF_HASALPHA | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 1,
-        /* rbits, gbits, bbits, abits */
-        0, 0, 0, 8,
-        /* Masks and shifts */
-        0, 0, 0, 0xFF, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_A4L4",
-        /* Bytes per element */
-        1,
-        /* Flags */
-        PFF_HASALPHA | PFF_LUMINANCE | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 2,
-        /* rbits, gbits, bbits, abits */
-        4, 0, 0, 4,
-        /* Masks and shifts */
-        0x0F, 0, 0, 0xF0, 0, 0, 0, 4
-        },
-	//-----------------------------------------------------------------------
-        {"PF_BYTE_LA",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_HASALPHA | PFF_LUMINANCE,
-        /* Component type and count */
-        PCT_BYTE, 2,
-        /* rbits, gbits, bbits, abits */
-        8, 0, 0, 8,
-        /* Masks and shifts */
-        0,0,0,0,0,0,0,0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_R5G6B5",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        5, 6, 5, 0,
-        /* Masks and shifts */
-        0xF800, 0x07E0, 0x001F, 0,
-        11, 5, 0, 0
-        },
-	//-----------------------------------------------------------------------
-		{"PF_B5G6R5",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        5, 6, 5, 0,
-        /* Masks and shifts */
-        0x001F, 0x07E0, 0xF800, 0,
-        0, 5, 11, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_A4R4G4B4",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_HASALPHA | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        4, 4, 4, 4,
-        /* Masks and shifts */
-        0x0F00, 0x00F0, 0x000F, 0xF000,
-        8, 4, 0, 12
-        },
-	//-----------------------------------------------------------------------
-        {"PF_A1R5G5B5",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_HASALPHA | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        5, 5, 5, 1,
-        /* Masks and shifts */
-        0x7C00, 0x03E0, 0x001F, 0x8000,
-        10, 5, 0, 15,
-        },
+		//-----------------------------------------------------------------------
+		{"PF_R8",
+		/* Bytes per element */
+		1,
+		/* Flags */
+		PFF_NATIVEENDIAN,
+		/* Component type and count */
+		PCT_BYTE, 1,
+		/* rbits, gbits, bbits, abits */
+		8, 0, 0, 0,
+		/* Masks and shifts */
+		0xFF, 0, 0, 0, 0, 0, 0, 0
+		},
+		//-----------------------------------------------------------------------
+		{"PF_R8G8",
+		/* Bytes per element */
+		1,
+		/* Flags */
+		PFF_NATIVEENDIAN,
+		/* Component type and count */
+		PCT_BYTE, 2,
+		/* rbits, gbits, bbits, abits */
+		8, 8, 0, 0,
+		/* Masks and shifts */
+		0xFF, 0x00FF, 0, 0, 
+		16, 8, 0, 0
+		},
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
         {"PF_R8G8B8",
         {"PF_R8G8B8",
         /* Bytes per element */
         /* Bytes per element */
@@ -576,33 +482,47 @@ namespace CamelotFramework {
         8, 16, 24, 0
         8, 16, 24, 0
         },
         },
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-        {"PF_A2R10G10B10",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_HASALPHA | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        10, 10, 10, 2,
-        /* Masks and shifts */
-        0x3FF00000, 0x000FFC00, 0x000003FF, 0xC0000000,
-        20, 10, 0, 30
-        },
+		{"PF_R8G8B8A8",
+		/* Bytes per element */
+		4,
+		/* Flags */
+		PFF_HASALPHA | PFF_NATIVEENDIAN,
+		/* Component type and count */
+		PCT_BYTE, 4,
+		/* rbits, gbits, bbits, abits */
+		8, 8, 8, 8,
+		/* Masks and shifts */
+		0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
+		24, 16, 8, 0
+		},
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-        {"PF_A2B10G10R10",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_HASALPHA | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        10, 10, 10, 2,
-        /* Masks and shifts */
-        0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000,
-        0, 10, 20, 30
-        },
+		{"PF_X8R8G8B8",
+		/* Bytes per element */
+		4,
+		/* Flags */
+		PFF_NATIVEENDIAN,
+		/* Component type and count */
+		PCT_BYTE, 3,
+		/* rbits, gbits, bbits, abits */
+		8, 8, 8, 0,
+		/* Masks and shifts */
+		0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
+		16, 8, 0, 24
+		},
+	//-----------------------------------------------------------------------
+		{"PF_X8B8G8R8",
+		/* Bytes per element */
+		4,
+		/* Flags */
+		PFF_NATIVEENDIAN,
+		/* Component type and count */
+		PCT_BYTE, 3,
+		/* rbits, gbits, bbits, abits */
+		8, 8, 8, 0,
+		/* Masks and shifts */
+		0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000,
+		0, 8, 16, 24
+		},
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
         {"PF_DXT1",
         {"PF_DXT1",
         /* Bytes per element */
         /* Bytes per element */
@@ -668,6 +588,32 @@ namespace CamelotFramework {
         /* Masks and shifts */
         /* Masks and shifts */
         0, 0, 0, 0, 0, 0, 0, 0
         0, 0, 0, 0, 0, 0, 0, 0
         },
         },
+	//-----------------------------------------------------------------------
+		{"PF_FLOAT16_R",
+		/* Bytes per element */
+		2,
+		/* Flags */
+		PFF_FLOAT,
+		/* Component type and count */
+		PCT_FLOAT16, 1,
+		/* rbits, gbits, bbits, abits */
+		16, 0, 0, 0,
+		/* Masks and shifts */
+		0, 0, 0, 0, 0, 0, 0, 0
+		},
+	//-----------------------------------------------------------------------
+		{"PF_FLOAT16_RG",
+		/* Bytes per element */
+		4,
+		/* Flags */
+		PFF_FLOAT,
+		/* Component type and count */
+		PCT_FLOAT16, 2,
+		/* rbits, gbits, bbits, abits */
+		16, 16, 0, 0,
+		/* Masks and shifts */
+		0, 0, 0, 0, 0, 0, 0, 0
+		},
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
         {"PF_FLOAT16_RGB",
         {"PF_FLOAT16_RGB",
         /* Bytes per element */
         /* Bytes per element */
@@ -694,6 +640,32 @@ namespace CamelotFramework {
         /* Masks and shifts */
         /* Masks and shifts */
         0, 0, 0, 0, 0, 0, 0, 0
         0, 0, 0, 0, 0, 0, 0, 0
         },
         },
+	//-----------------------------------------------------------------------
+		{"PF_FLOAT32_R",
+		/* Bytes per element */
+		4,
+		/* Flags */
+		PFF_FLOAT,
+		/* Component type and count */
+		PCT_FLOAT32, 1,
+		/* rbits, gbits, bbits, abits */
+		32, 0, 0, 0,
+		/* Masks and shifts */
+		0, 0, 0, 0, 0, 0, 0, 0
+		},
+	//-----------------------------------------------------------------------
+		{"PF_FLOAT32_RG",
+		/* Bytes per element */
+		8,
+		/* Flags */
+		PFF_FLOAT,
+		/* Component type and count */
+		PCT_FLOAT32, 2,
+		/* rbits, gbits, bbits, abits */
+		32, 32, 0, 0,
+		/* Masks and shifts */
+		0, 0, 0, 0, 0, 0, 0, 0
+		},
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
         {"PF_FLOAT32_RGB",
         {"PF_FLOAT32_RGB",
         /* Bytes per element */
         /* Bytes per element */
@@ -720,219 +692,6 @@ namespace CamelotFramework {
         /* Masks and shifts */
         /* Masks and shifts */
         0, 0, 0, 0, 0, 0, 0, 0
         0, 0, 0, 0, 0, 0, 0, 0
         },
         },
-	//-----------------------------------------------------------------------
-        {"PF_X8R8G8B8",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        8, 8, 8, 0,
-        /* Masks and shifts */
-        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
-        16, 8, 0, 24
-        },
-	//-----------------------------------------------------------------------
-        {"PF_X8B8G8R8",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        8, 8, 8, 0,
-        /* Masks and shifts */
-        0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000,
-        0, 8, 16, 24
-        },
-	//-----------------------------------------------------------------------
-        {"PF_R8G8B8A8",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_HASALPHA | PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        8, 8, 8, 8,
-        /* Masks and shifts */
-        0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
-        24, 16, 8, 0
-        },
-	//-----------------------------------------------------------------------
-		{"PF_DEPTH",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_DEPTH,
-        /* Component type and count */
-        PCT_FLOAT32, 1, // ?
-        /* rbits, gbits, bbits, abits */
-        0, 0, 0, 0,
-        /* Masks and shifts */
-		0, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-		{"PF_SHORT_RGBA",
-		/* Bytes per element */
-        8,
-        /* Flags */
-        PFF_HASALPHA,
-        /* Component type and count */
-        PCT_SHORT, 4,
-        /* rbits, gbits, bbits, abits */
-        16, 16, 16, 16,
-        /* Masks and shifts */
-		0, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_R3G3B2",
-        /* Bytes per element */
-        1,
-        /* Flags */
-        PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        3, 3, 2, 0,
-        /* Masks and shifts */
-        0xE0, 0x1C, 0x03, 0,
-        5, 2, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_FLOAT16_R",
-        /* Bytes per element */
-        2,
-        /* Flags */
-        PFF_FLOAT,
-        /* Component type and count */
-        PCT_FLOAT16, 1,
-        /* rbits, gbits, bbits, abits */
-        16, 0, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_FLOAT32_R",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_FLOAT,
-        /* Component type and count */
-        PCT_FLOAT32, 1,
-        /* rbits, gbits, bbits, abits */
-        32, 0, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_SHORT_GR",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_NATIVEENDIAN,
-        /* Component type and count */
-        PCT_SHORT, 2,
-        /* rbits, gbits, bbits, abits */
-        16, 16, 0, 0,
-        /* Masks and shifts */
-        0x0000FFFF, 0xFFFF0000, 0, 0, 
-		0, 16, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_FLOAT16_GR",
-        /* Bytes per element */
-        4,
-        /* Flags */
-        PFF_FLOAT,
-        /* Component type and count */
-        PCT_FLOAT16, 2,
-        /* rbits, gbits, bbits, abits */
-        16, 16, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-        {"PF_FLOAT32_GR",
-        /* Bytes per element */
-        8,
-        /* Flags */
-        PFF_FLOAT,
-        /* Component type and count */
-        PCT_FLOAT32, 2,
-        /* rbits, gbits, bbits, abits */
-        32, 32, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-	//-----------------------------------------------------------------------
-		{"PF_SHORT_RGB",
-		/* Bytes per element */
-        6,
-        /* Flags */
-        0,
-        /* Component type and count */
-        PCT_SHORT, 3,
-        /* rbits, gbits, bbits, abits */
-        16, 16, 16, 0,
-        /* Masks and shifts */
-		0, 0, 0, 0, 0, 0, 0, 0
-        },
-    //-----------------------------------------------------------------------
-		{"PF_PVRTC_RGB2",
-        /* Bytes per element */
-        0,
-        /* Flags */
-        PFF_COMPRESSED,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        0, 0, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-    //-----------------------------------------------------------------------
-		{"PF_PVRTC_RGBA2",
-        /* Bytes per element */
-        0,
-        /* Flags */
-        PFF_COMPRESSED | PFF_HASALPHA,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        0, 0, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-    //-----------------------------------------------------------------------
-		{"PF_PVRTC_RGB4",
-        /* Bytes per element */
-        0,
-        /* Flags */
-        PFF_COMPRESSED,
-        /* Component type and count */
-        PCT_BYTE, 3,
-        /* rbits, gbits, bbits, abits */
-        0, 0, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
-    //-----------------------------------------------------------------------
-		{"PF_PVRTC_RGBA4",
-        /* Bytes per element */
-        0,
-        /* Flags */
-        PFF_COMPRESSED | PFF_HASALPHA,
-        /* Component type and count */
-        PCT_BYTE, 4,
-        /* rbits, gbits, bbits, abits */
-        0, 0, 0, 0,
-        /* Masks and shifts */
-        0, 0, 0, 0, 0, 0, 0, 0
-        },
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
 		{"PF_D32_S8X24",
 		{"PF_D32_S8X24",
 		/* Bytes per element */
 		/* Bytes per element */
@@ -1058,17 +817,6 @@ namespace CamelotFramework {
 				case PF_DXT5:
 				case PF_DXT5:
 					return ((width+3)/4)*((height+3)/4)*16 * depth;
 					return ((width+3)/4)*((height+3)/4)*16 * depth;
 
 
-                // Size calculations from the PVRTC OpenGL extension spec
-                // http://www.khronos.org/registry/gles/extensions/IMG/IMG_texture_compression_pvrtc.txt
-                // Basically, 32 bytes is the minimum texture size.  Smaller textures are padded up to 32 bytes
-                case PF_PVRTC_RGB2:
-                case PF_PVRTC_RGBA2:
-					assert(depth == 1);
-                    return (std::max((int)width, 16) * std::max((int)height, 8) * 2 + 7) / 8;
-                case PF_PVRTC_RGB4:
-                case PF_PVRTC_RGBA4:
-					assert(depth == 1);
-                    return (std::max((int)width, 8) * std::max((int)height, 8) * 4 + 7) / 8;
 				default:
 				default:
 				CM_EXCEPT(InvalidParametersException, "Invalid compressed pixel format");
 				CM_EXCEPT(InvalidParametersException, "Invalid compressed pixel format");
 			}
 			}
@@ -1113,11 +861,6 @@ namespace CamelotFramework {
     {
     {
         return (PixelUtil::getFlags(format) & PFF_NATIVEENDIAN) > 0;
         return (PixelUtil::getFlags(format) & PFF_NATIVEENDIAN) > 0;
     }
     }
-    //-----------------------------------------------------------------------
-    bool PixelUtil::isLuminance(PixelFormat format)
-    {
-        return (PixelUtil::getFlags(format) & PFF_LUMINANCE) > 0;
-    }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
 	bool PixelUtil::isValidExtent(size_t width, size_t height, size_t depth, PixelFormat format)
 	bool PixelUtil::isValidExtent(size_t width, size_t height, size_t depth, PixelFormat format)
 	{
 	{
@@ -1243,109 +986,6 @@ namespace CamelotFramework {
         return result;
         return result;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    PixelFormat PixelUtil::getFormatForBitDepths(PixelFormat fmt, UINT16 integerBits, UINT16 floatBits)
-    {
-        switch (integerBits)
-        {
-        case 16:
-            switch (fmt)
-            {
-            case PF_R8G8B8:
-            case PF_X8R8G8B8:
-                return PF_R5G6B5;
-
-            case PF_B8G8R8:
-            case PF_X8B8G8R8:
-                return PF_B5G6R5;
-
-            case PF_A8R8G8B8:
-            case PF_R8G8B8A8:
-            case PF_A8B8G8R8:
-            case PF_B8G8R8A8:
-                return PF_A4R4G4B4;
-
-            case PF_A2R10G10B10:
-            case PF_A2B10G10R10:
-                return PF_A1R5G5B5;
-
-            default:
-                // use original image format
-                break;
-            }
-            break;
-
-        case 32:
-            switch (fmt)
-            {
-            case PF_R5G6B5:
-                return PF_X8R8G8B8;
-
-            case PF_B5G6R5:
-                return PF_X8B8G8R8;
-
-            case PF_A4R4G4B4:
-                return PF_A8R8G8B8;
-
-            case PF_A1R5G5B5:
-                return PF_A2R10G10B10;
-
-            default:
-                // use original image format
-                break;
-            }
-            break;
-
-        default:
-            // use original image format
-            break;
-        }
-
-        switch (floatBits)
-        {
-        case 16:
-            switch (fmt)
-            {
-            case PF_FLOAT32_R:
-                return PF_FLOAT16_R;
-
-            case PF_FLOAT32_RGB:
-                return PF_FLOAT16_RGB;
-
-            case PF_FLOAT32_RGBA:
-                return PF_FLOAT16_RGBA;
-
-            default:
-                // use original image format
-                break;
-            }
-            break;
-
-        case 32:
-            switch (fmt)
-            {
-            case PF_FLOAT16_R:
-                return PF_FLOAT32_R;
-
-            case PF_FLOAT16_RGB:
-                return PF_FLOAT32_RGB;
-
-            case PF_FLOAT16_RGBA:
-                return PF_FLOAT32_RGBA;
-
-            default:
-                // use original image format
-                break;
-            }
-            break;
-
-        default:
-            // use original image format
-            break;
-        }
-
-        return fmt;
-    }
-    //-----------------------------------------------------------------------
     /*************************************************************************
     /*************************************************************************
     * Pixel packing/unpacking utilities
     * Pixel packing/unpacking utilities
     */
     */
@@ -1390,7 +1030,7 @@ namespace CamelotFramework {
             case PF_FLOAT32_R:
             case PF_FLOAT32_R:
                 ((float*)dest)[0] = r;
                 ((float*)dest)[0] = r;
                 break;
                 break;
-			case PF_FLOAT32_GR:
+			case PF_FLOAT32_RG:
 				((float*)dest)[0] = g;
 				((float*)dest)[0] = g;
 				((float*)dest)[1] = r;
 				((float*)dest)[1] = r;
 				break;
 				break;
@@ -1408,7 +1048,7 @@ namespace CamelotFramework {
             case PF_FLOAT16_R:
             case PF_FLOAT16_R:
                 ((UINT16*)dest)[0] = Bitwise::floatToHalf(r);
                 ((UINT16*)dest)[0] = Bitwise::floatToHalf(r);
                 break;
                 break;
-			case PF_FLOAT16_GR:
+			case PF_FLOAT16_RG:
 				((UINT16*)dest)[0] = Bitwise::floatToHalf(g);
 				((UINT16*)dest)[0] = Bitwise::floatToHalf(g);
 				((UINT16*)dest)[1] = Bitwise::floatToHalf(r);
 				((UINT16*)dest)[1] = Bitwise::floatToHalf(r);
 				break;
 				break;
@@ -1423,17 +1063,6 @@ namespace CamelotFramework {
                 ((UINT16*)dest)[2] = Bitwise::floatToHalf(b);
                 ((UINT16*)dest)[2] = Bitwise::floatToHalf(b);
                 ((UINT16*)dest)[3] = Bitwise::floatToHalf(a);
                 ((UINT16*)dest)[3] = Bitwise::floatToHalf(a);
                 break;
                 break;
-            case PF_SHORT_RGB:
-				((UINT16*)dest)[0] = (UINT16)Bitwise::floatToFixed(r, 16);
-                ((UINT16*)dest)[1] = (UINT16)Bitwise::floatToFixed(g, 16);
-                ((UINT16*)dest)[2] = (UINT16)Bitwise::floatToFixed(b, 16);
-                break;
-			case PF_SHORT_RGBA:
-				((UINT16*)dest)[0] = (UINT16)Bitwise::floatToFixed(r, 16);
-                ((UINT16*)dest)[1] = (UINT16)Bitwise::floatToFixed(g, 16);
-                ((UINT16*)dest)[2] = (UINT16)Bitwise::floatToFixed(b, 16);
-                ((UINT16*)dest)[3] = (UINT16)Bitwise::floatToFixed(a, 16);
-				break;
 			case PF_R8G8:
 			case PF_R8G8:
 				((UINT8*)dest)[0] = (UINT8)Bitwise::floatToFixed(r, 8);
 				((UINT8*)dest)[0] = (UINT8)Bitwise::floatToFixed(r, 8);
                 ((UINT8*)dest)[1] = (UINT8)Bitwise::floatToFixed(g, 8);
                 ((UINT8*)dest)[1] = (UINT8)Bitwise::floatToFixed(g, 8);
@@ -1458,18 +1087,11 @@ namespace CamelotFramework {
         if(des.flags & PFF_NATIVEENDIAN) {
         if(des.flags & PFF_NATIVEENDIAN) {
             // Shortcut for integer formats unpacking
             // Shortcut for integer formats unpacking
             const unsigned int value = Bitwise::intRead(src, des.elemBytes);
             const unsigned int value = Bitwise::intRead(src, des.elemBytes);
-            if(des.flags & PFF_LUMINANCE)
-            {
-                // Luminance format -- only rbits used
-                *r = *g = *b = (UINT8)Bitwise::fixedToFixed(
-                    (value & des.rmask)>>des.rshift, des.rbits, 8);
-            }
-            else
-            {
-                *r = (UINT8)Bitwise::fixedToFixed((value & des.rmask)>>des.rshift, des.rbits, 8);
-                *g = (UINT8)Bitwise::fixedToFixed((value & des.gmask)>>des.gshift, des.gbits, 8);
-                *b = (UINT8)Bitwise::fixedToFixed((value & des.bmask)>>des.bshift, des.bbits, 8);
-            }
+
+            *r = (UINT8)Bitwise::fixedToFixed((value & des.rmask)>>des.rshift, des.rbits, 8);
+            *g = (UINT8)Bitwise::fixedToFixed((value & des.gmask)>>des.gshift, des.gbits, 8);
+            *b = (UINT8)Bitwise::fixedToFixed((value & des.bmask)>>des.bshift, des.bbits, 8);
+
             if(des.flags & PFF_HASALPHA)
             if(des.flags & PFF_HASALPHA)
             {
             {
                 *a = (UINT8)Bitwise::fixedToFixed((value & des.amask)>>des.ashift, des.abits, 8);
                 *a = (UINT8)Bitwise::fixedToFixed((value & des.amask)>>des.ashift, des.abits, 8);
@@ -1496,18 +1118,11 @@ namespace CamelotFramework {
         if(des.flags & PFF_NATIVEENDIAN) {
         if(des.flags & PFF_NATIVEENDIAN) {
             // Shortcut for integer formats unpacking
             // Shortcut for integer formats unpacking
             const unsigned int value = Bitwise::intRead(src, des.elemBytes);
             const unsigned int value = Bitwise::intRead(src, des.elemBytes);
-            if(des.flags & PFF_LUMINANCE)
-            {
-                // Luminance format -- only rbits used
-                *r = *g = *b = Bitwise::fixedToFloat(
-                    (value & des.rmask)>>des.rshift, des.rbits);
-            }
-            else
-            {
-                *r = Bitwise::fixedToFloat((value & des.rmask)>>des.rshift, des.rbits);
-                *g = Bitwise::fixedToFloat((value & des.gmask)>>des.gshift, des.gbits);
-                *b = Bitwise::fixedToFloat((value & des.bmask)>>des.bshift, des.bbits);
-            }
+
+			*r = Bitwise::fixedToFloat((value & des.rmask)>>des.rshift, des.rbits);
+			*g = Bitwise::fixedToFloat((value & des.gmask)>>des.gshift, des.gbits);
+			*b = Bitwise::fixedToFloat((value & des.bmask)>>des.bshift, des.bbits);
+
             if(des.flags & PFF_HASALPHA)
             if(des.flags & PFF_HASALPHA)
             {
             {
                 *a = Bitwise::fixedToFloat((value & des.amask)>>des.ashift, des.abits);
                 *a = Bitwise::fixedToFloat((value & des.amask)>>des.ashift, des.abits);
@@ -1523,7 +1138,7 @@ namespace CamelotFramework {
                 *r = *g = *b = ((float*)src)[0];
                 *r = *g = *b = ((float*)src)[0];
                 *a = 1.0f;
                 *a = 1.0f;
                 break;
                 break;
-			case PF_FLOAT32_GR:
+			case PF_FLOAT32_RG:
 				*g = ((float*)src)[0];
 				*g = ((float*)src)[0];
 				*r = *b = ((float*)src)[1];
 				*r = *b = ((float*)src)[1];
 				*a = 1.0f;
 				*a = 1.0f;
@@ -1544,7 +1159,7 @@ namespace CamelotFramework {
                 *r = *g = *b = Bitwise::halfToFloat(((UINT16*)src)[0]);
                 *r = *g = *b = Bitwise::halfToFloat(((UINT16*)src)[0]);
                 *a = 1.0f;
                 *a = 1.0f;
                 break;
                 break;
-			case PF_FLOAT16_GR:
+			case PF_FLOAT16_RG:
 				*g = Bitwise::halfToFloat(((UINT16*)src)[0]);
 				*g = Bitwise::halfToFloat(((UINT16*)src)[0]);
 				*r = *b = Bitwise::halfToFloat(((UINT16*)src)[1]);
 				*r = *b = Bitwise::halfToFloat(((UINT16*)src)[1]);
 				*a = 1.0f;
 				*a = 1.0f;
@@ -1561,18 +1176,6 @@ namespace CamelotFramework {
                 *b = Bitwise::halfToFloat(((UINT16*)src)[2]);
                 *b = Bitwise::halfToFloat(((UINT16*)src)[2]);
                 *a = Bitwise::halfToFloat(((UINT16*)src)[3]);
                 *a = Bitwise::halfToFloat(((UINT16*)src)[3]);
                 break;
                 break;
-			case PF_SHORT_RGB:
-				*r = Bitwise::fixedToFloat(((UINT16*)src)[0], 16);
-                *g = Bitwise::fixedToFloat(((UINT16*)src)[1], 16);
-				*b = Bitwise::fixedToFloat(((UINT16*)src)[2], 16);
-				*a = 1.0f;
-				break;
-			case PF_SHORT_RGBA:
-				*r = Bitwise::fixedToFloat(((UINT16*)src)[0], 16);
-                *g = Bitwise::fixedToFloat(((UINT16*)src)[1], 16);
-				*b = Bitwise::fixedToFloat(((UINT16*)src)[2], 16);
-				*a = Bitwise::fixedToFloat(((UINT16*)src)[3], 16);
-				break;
 			case PF_R8G8:
 			case PF_R8G8:
 				*r = Bitwise::fixedToFloat(((UINT8*)src)[0], 8);
 				*r = Bitwise::fixedToFloat(((UINT8*)src)[0], 8);
 				*g = Bitwise::fixedToFloat(((UINT8*)src)[1], 8);
 				*g = Bitwise::fixedToFloat(((UINT8*)src)[1], 8);
@@ -1767,7 +1370,7 @@ namespace CamelotFramework {
 		case FILTER_BILINEAR:
 		case FILTER_BILINEAR:
 			switch (src.format) 
 			switch (src.format) 
 			{
 			{
-			case PF_L8: case PF_A8: case PF_R8G8:
+			case PF_R8G8:
 			case PF_R8G8B8: case PF_B8G8R8:
 			case PF_R8G8B8: case PF_B8G8R8:
 			case PF_R8G8B8A8: case PF_B8G8R8A8:
 			case PF_R8G8B8A8: case PF_B8G8R8A8:
 			case PF_A8B8G8R8: case PF_A8R8G8B8:
 			case PF_A8B8G8R8: case PF_A8R8G8B8:

+ 13 - 6
TODO.txt

@@ -2,13 +2,20 @@
 
 
 ----------------------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------------------
 
 
-24bit textures don't seem to load properly
- - Seems DX11 doesn't support 24bit texture format so instead it chooses a 32bit one but 
-   when we write to texture we still assume the format is the original 24bit one. 
- - After creating the texture I need to update the actual format
- - And when copying texture data make sure I copy it channel by channel
-32bit textures seem to have some channels flipped
+Texture format changes:
+I screwed up R8G8 format by making it NATIVENDIAN
+
+Unify formats and their masks/shifts - Use DX11 model everywhere (already used on floating point formats)
+
+DirectX9 - most significant to least significant - ARGB is actually BGRA in memory
+DirectX11 - least significant to most significant - RGBA is RGBA in memory
+OpenGL seems to be the same as DirectX11 although I can't confirm
+
+Go through all formats and check if they match this. (Ogre components seem to assume the DX9 model)
+Floating point formats all seem to be in DX11 order in memory for all render systems
  
  
+When loading WindowFrameTex manually, it doesn't get released properly
+
 
 
 Immediate TODO:
 Immediate TODO:
  - Issue with rendering same object from multiple cameras:
  - Issue with rendering same object from multiple cameras: