Ver Fonte

Dropping support for rarely used pixel formats

BearishSun há 9 anos atrás
pai
commit
7cbf69f663

BIN
Data/Examples/Dragon.tga.asset


+ 1 - 31
Source/BansheeCore/Include/BsPixelData.h

@@ -26,40 +26,10 @@ namespace bs
         PF_R8G8B8 = 3,
         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 = 4,
         PF_B8G8R8 = 4,
-        /** 32-bit pixel format, 8 bits for alpha, red, green and blue. */
-        PF_A8R8G8B8 = 5,
-        /** 32-bit pixel format, 8 bits for blue, green, red and alpha. */
-        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 = 7,
         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 = 8,
-        /** 
-		 * 32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue. Like PF_A8R8G8B8, but alpha will get 
-		 * discarded.
-		 */
-        PF_X8R8G8B8 = 9,
-        /** 
-		 * 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red. Like PF_A8B8G8R8, but alpha will get 
-		 * discarded.
-		 */
-        PF_X8B8G8R8 = 10,
-		/** 
-		 * 32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue. Like PF_R8G8B8A8, but alpha will get 
-		 * discarded. 
-		 */
-		PF_R8G8B8X8 = 11,
-		/** 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red. */
-		/** Like PF_B8G8R8A8, but alpha will get discarded. */
-		PF_B8G8R8X8 = 12,
-		/** 24-bit pixel format, 8 bits for red, green and blue. */
-		PF_BYTE_RGB = PF_R8G8B8,
-		/** 24-bit pixel format, 8 bits for blue, green and red. */
-		PF_BYTE_BGR = PF_B8G8R8,
-		/** 32-bit pixel format, 8 bits for blue, green, red and alpha. */
-		PF_BYTE_BGRA = PF_B8G8R8A8,
-		/** 32-bit pixel format, 8 bits for red, green, blue and alpha. */
-		PF_BYTE_RGBA = PF_R8G8B8A8,      
+		PF_R8G8B8A8 = 8, 
         /** DXT1/BC1 format containing opaque RGB or 1-bit alpha RGB. 4 bits per pixel. */
         /** DXT1/BC1 format containing opaque RGB or 1-bit alpha RGB. 4 bits per pixel. */
         PF_BC1 = 13,
         PF_BC1 = 13,
 		/** DXT3/BC2 format containing RGB with premultiplied alpha. 4 bits per pixel. */
 		/** DXT3/BC2 format containing RGB with premultiplied alpha. 4 bits per pixel. */

+ 20 - 119
Source/BansheeCore/Source/BsPixelUtil.cpp

@@ -418,33 +418,9 @@ namespace bs
         16, 8, 0, 0
         16, 8, 0, 0
         },
         },
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-        {"PF_A8R8G8B8",
-        /* 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 */
-        0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF,
-        8, 16, 24, 0
-        },
+		{}, // Deleted format
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-        {"PF_A8B8G8R8",
-        /* 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,
-        },
+		{}, // Deleted format
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
         {"PF_B8G8R8A8",
         {"PF_B8G8R8A8",
         /* Bytes per element */
         /* Bytes per element */
@@ -474,61 +450,13 @@ namespace bs
 		0, 8, 16, 24
 		0, 8, 16, 24
 		},
 		},
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-		{"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 */
-		0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF,
-		8, 16, 24, 0
-		},
+		{}, // Deleted format
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-		{"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 */
-		0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
-		24, 16, 8, 0
-		},
+		{}, // Deleted format
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-		{"PF_R8G8B8X8",
-		/* Bytes per element */
-		4,
-		/* Flags */
-		PFF_HASALPHA | 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, 0
-		},
+		{}, // Deleted format
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-		{"PF_B8G8R8X8",
-		/* Bytes per element */
-		4,
-		/* Flags */
-		PFF_HASALPHA | 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, 0
-		},
+		{}, // Deleted format
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
         {"PF_BC1",
         {"PF_BC1",
         /* Bytes per element */
         /* Bytes per element */
@@ -1512,31 +1440,6 @@ namespace bs
             return;
             return;
         }
         }
 
 
-		// Converting to PF_X8R8G8B8 is exactly the same as converting to
-		// PF_A8R8G8B8. (same with PF_X8B8G8R8 and PF_A8B8G8R8)
-		if(dst.getFormat() == PF_X8R8G8B8 || dst.getFormat() == PF_X8B8G8R8)
-		{
-			// Do the same conversion, with PF_A8R8G8B8, which has a lot of
-			// optimized conversions
-			PixelFormat tempFormat = dst.getFormat() == PF_X8R8G8B8?PF_A8R8G8B8:PF_A8B8G8R8;
-			PixelData tempdst(dst.getWidth(), dst.getHeight(), dst.getDepth(), tempFormat);
-			bulkPixelConversion(src, tempdst);
-			return;
-		}
-
-		// Converting from PF_X8R8G8B8 is exactly the same as converting from
-		// PF_A8R8G8B8, given that the destination format does not have alpha.
-		if((src.getFormat() == PF_X8R8G8B8 || src.getFormat() == PF_X8B8G8R8) && !hasAlpha(dst.getFormat()))
-		{
-			// Do the same conversion, with PF_A8R8G8B8, which has a lot of
-			// optimized conversions
-			PixelFormat tempFormat = src.getFormat()==PF_X8R8G8B8?PF_A8R8G8B8:PF_A8B8G8R8;
-			PixelData tempsrc(src.getWidth(), src.getHeight(), src.getDepth(), tempFormat);
-			tempsrc.setExternalBuffer(src.getData());
-			bulkPixelConversion(tempsrc, dst);
-			return;
-		}
-
 		const UINT32 srcPixelSize = PixelUtil::getNumElemBytes(src.getFormat());
 		const UINT32 srcPixelSize = PixelUtil::getNumElemBytes(src.getFormat());
 		const UINT32 dstPixelSize = PixelUtil::getNumElemBytes(dst.getFormat());
 		const UINT32 dstPixelSize = PixelUtil::getNumElemBytes(dst.getFormat());
         UINT8 *srcptr = static_cast<UINT8*>(src.getData())
         UINT8 *srcptr = static_cast<UINT8*>(src.getData())
@@ -1628,8 +1531,6 @@ namespace bs
 			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_X8B8G8R8: case PF_X8R8G8B8:
 				if(src.getFormat() == scaled.getFormat()) 
 				if(src.getFormat() == scaled.getFormat()) 
 				{
 				{
 					// No intermediate buffer needed
 					// No intermediate buffer needed
@@ -1877,7 +1778,7 @@ namespace bs
 			return;
 			return;
 		}
 		}
 
 
-		PixelData bgraData(src.getWidth(), src.getHeight(), 1, PF_B8G8R8A8);
+		PixelData bgraData(src.getWidth(), src.getHeight(), 1, PF_R8G8B8A8);
 		bgraData.allocateInternalBuffer();
 		bgraData.allocateInternalBuffer();
 		bulkPixelConversion(src, bgraData);
 		bulkPixelConversion(src, bgraData);
 
 
@@ -1935,13 +1836,13 @@ namespace bs
 			return outputMipBuffers;
 			return outputMipBuffers;
 		}
 		}
 
 
-		PixelData argbData(src.getWidth(), src.getHeight(), 1, PF_A8R8G8B8);
-		argbData.allocateInternalBuffer();
-		bulkPixelConversion(src, argbData);
+		PixelData rgbaData(src.getWidth(), src.getHeight(), 1, PF_R8G8B8A8);
+		rgbaData.allocateInternalBuffer();
+		bulkPixelConversion(src, rgbaData);
 
 
 		nvtt::InputOptions io;
 		nvtt::InputOptions io;
 		io.setTextureLayout(nvtt::TextureType_2D, src.getWidth(), src.getHeight());
 		io.setTextureLayout(nvtt::TextureType_2D, src.getWidth(), src.getHeight());
-		io.setMipmapData(argbData.getData(), src.getWidth(), src.getHeight());
+		io.setMipmapData(rgbaData.getData(), src.getWidth(), src.getHeight());
 		io.setMipmapGeneration(true);
 		io.setMipmapGeneration(true);
 		io.setNormalMap(options.isNormalMap);
 		io.setNormalMap(options.isNormalMap);
 		io.setNormalizeMipmaps(options.normalizeMipmaps);
 		io.setNormalizeMipmaps(options.normalizeMipmaps);
@@ -1952,7 +1853,7 @@ namespace bs
 		
 		
 		UINT32 numMips = getMaxMipmaps(src.getWidth(), src.getHeight(), 1, src.getFormat());
 		UINT32 numMips = getMaxMipmaps(src.getWidth(), src.getHeight(), 1, src.getFormat());
 
 
-		Vector<SPtr<PixelData>> argbMipBuffers;
+		Vector<SPtr<PixelData>> rgbaMipBuffers;
 
 
 		// Note: This can be done more effectively without creating so many temp buffers
 		// Note: This can be done more effectively without creating so many temp buffers
 		// and working with the original formats directly, but it would complicate the code
 		// and working with the original formats directly, but it would complicate the code
@@ -1961,8 +1862,8 @@ namespace bs
 		UINT32 curHeight = src.getHeight();
 		UINT32 curHeight = src.getHeight();
 		for (UINT32 i = 0; i < numMips; i++)
 		for (UINT32 i = 0; i < numMips; i++)
 		{
 		{
-			argbMipBuffers.push_back(bs_shared_ptr_new<PixelData>(curWidth, curHeight, 1, PF_A8R8G8B8));
-			argbMipBuffers.back()->allocateInternalBuffer();
+			rgbaMipBuffers.push_back(bs_shared_ptr_new<PixelData>(curWidth, curHeight, 1, PF_R8G8B8A8));
+			rgbaMipBuffers.back()->allocateInternalBuffer();
 
 
 			if (curWidth > 1) 
 			if (curWidth > 1) 
 				curWidth = curWidth / 2;
 				curWidth = curWidth / 2;
@@ -1971,10 +1872,10 @@ namespace bs
 				curHeight = curHeight / 2;
 				curHeight = curHeight / 2;
 		}
 		}
 
 
-		argbMipBuffers.push_back(bs_shared_ptr_new<PixelData>(curWidth, curHeight, 1, PF_A8R8G8B8));
-		argbMipBuffers.back()->allocateInternalBuffer();
+		rgbaMipBuffers.push_back(bs_shared_ptr_new<PixelData>(curWidth, curHeight, 1, PF_R8G8B8A8));
+		rgbaMipBuffers.back()->allocateInternalBuffer();
 
 
-		NVTTMipmapOutputHandler outputHandler(argbMipBuffers);
+		NVTTMipmapOutputHandler outputHandler(rgbaMipBuffers);
 
 
 		nvtt::OutputOptions oo;
 		nvtt::OutputOptions oo;
 		oo.setOutputHeader(false);
 		oo.setOutputHeader(false);
@@ -1987,11 +1888,11 @@ namespace bs
 			return outputMipBuffers;
 			return outputMipBuffers;
 		}
 		}
 
 
-		argbData.freeInternalBuffer();
+		rgbaData.freeInternalBuffer();
 
 
-		for (UINT32 i = 0; i < (UINT32)argbMipBuffers.size(); i++)
+		for (UINT32 i = 0; i < (UINT32)rgbaMipBuffers.size(); i++)
 		{
 		{
-			SPtr<PixelData> argbBuffer = argbMipBuffers[i];
+			SPtr<PixelData> argbBuffer = rgbaMipBuffers[i];
 			SPtr<PixelData> outputBuffer = bs_shared_ptr_new<PixelData>(argbBuffer->getWidth(), argbBuffer->getHeight(), 1, src.getFormat());
 			SPtr<PixelData> outputBuffer = bs_shared_ptr_new<PixelData>(argbBuffer->getWidth(), argbBuffer->getHeight(), 1, src.getFormat());
 			outputBuffer->allocateInternalBuffer();
 			outputBuffer->allocateInternalBuffer();
 
 

+ 4 - 4
Source/BansheeCore/Source/BsTexture.cpp

@@ -102,7 +102,7 @@ namespace bs
 			}
 			}
 		}
 		}
 
 
-		writeDataImpl(src, face, mipLevel, discardEntireBuffer, queueIdx);
+		writeDataImpl(src, mipLevel, face, discardEntireBuffer, queueIdx);
 	}
 	}
 
 
 	void TextureCore::readData(PixelData& dest, UINT32 mipLevel, UINT32 face, UINT32 deviceIdx, UINT32 queueIdx)
 	void TextureCore::readData(PixelData& dest, UINT32 mipLevel, UINT32 face, UINT32 deviceIdx, UINT32 queueIdx)
@@ -122,7 +122,7 @@ namespace bs
 			return;
 			return;
 		}
 		}
 
 
-		readDataImpl(pixelData, face, mipLevel , deviceIdx, queueIdx);
+		readDataImpl(pixelData, mipLevel, face, deviceIdx, queueIdx);
 	}
 	}
 
 
 	PixelData TextureCore::lock(GpuLockOptions options, UINT32 mipLevel, UINT32 face, UINT32 deviceIdx, UINT32 queueIdx)
 	PixelData TextureCore::lock(GpuLockOptions options, UINT32 mipLevel, UINT32 face, UINT32 deviceIdx, UINT32 queueIdx)
@@ -367,7 +367,7 @@ namespace bs
 			[&](const SPtr<TextureCore>& texture, UINT32 _face, UINT32 _mipLevel, const SPtr<PixelData>& _pixData, 
 			[&](const SPtr<TextureCore>& texture, UINT32 _face, UINT32 _mipLevel, const SPtr<PixelData>& _pixData, 
 				bool _discardEntireBuffer, AsyncOp& asyncOp)
 				bool _discardEntireBuffer, AsyncOp& asyncOp)
 		{
 		{
-			texture->writeData(*_pixData, _face, _mipLevel, _discardEntireBuffer);
+			texture->writeData(*_pixData, _mipLevel, _face, _discardEntireBuffer);
 			_pixData->_unlock();
 			_pixData->_unlock();
 			asyncOp._completeOperation();
 			asyncOp._completeOperation();
 
 
@@ -388,7 +388,7 @@ namespace bs
 			// Make sure any queued command start executing before reading
 			// Make sure any queued command start executing before reading
 			RenderAPICore::instance().submitCommandBuffer(nullptr);
 			RenderAPICore::instance().submitCommandBuffer(nullptr);
 
 
-			texture->readData(*_pixData, _face, _mipLevel);
+			texture->readData(*_pixData, _mipLevel, _face);
 			_pixData->_unlock();
 			_pixData->_unlock();
 			asyncOp._completeOperation();
 			asyncOp._completeOperation();
 
 

+ 0 - 26
Source/BansheeD3D11RenderAPI/Source/BsD3D11Mappings.cpp

@@ -592,9 +592,6 @@ namespace bs
 		case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
 		case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
 		case DXGI_FORMAT_B8G8R8A8_UNORM:
 		case DXGI_FORMAT_B8G8R8A8_UNORM:
 			return PF_B8G8R8A8;
 			return PF_B8G8R8A8;
-		case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
-		case DXGI_FORMAT_B8G8R8X8_UNORM:
-			return PF_B8G8R8X8;
 		default:
 		default:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		}
 		}
@@ -613,14 +610,6 @@ namespace bs
 			return DXGI_FORMAT_R8G8_UNORM; 
 			return DXGI_FORMAT_R8G8_UNORM; 
 		case PF_R8G8B8:
 		case PF_R8G8B8:
 			return DXGI_FORMAT_UNKNOWN;
 			return DXGI_FORMAT_UNKNOWN;
-		case PF_A8R8G8B8:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_A8B8G8R8:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_X8R8G8B8:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_X8B8G8R8:
-			return DXGI_FORMAT_UNKNOWN;
 		case PF_R8G8B8A8:
 		case PF_R8G8B8A8:
 			if (gamma)
 			if (gamma)
 				return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
 				return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
@@ -632,14 +621,6 @@ namespace bs
 			if (gamma)
 			if (gamma)
 				return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
 				return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
 			return DXGI_FORMAT_B8G8R8A8_UNORM;
 			return DXGI_FORMAT_B8G8R8A8_UNORM;
-		case PF_B8G8R8X8:
-			if (!isSampledTexture)
-				return DXGI_FORMAT_UNKNOWN;
-
-			if (gamma)
-				return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
-
-			return DXGI_FORMAT_B8G8R8X8_UNORM;
 		case PF_FLOAT16_R:
 		case PF_FLOAT16_R:
 			return DXGI_FORMAT_R16_FLOAT;
 			return DXGI_FORMAT_R16_FLOAT;
 		case PF_FLOAT16_RG:
 		case PF_FLOAT16_RG:
@@ -838,19 +819,12 @@ namespace bs
 			return PF_FLOAT32_RGBA;
 			return PF_FLOAT32_RGBA;
 		case PF_R8G8B8:
 		case PF_R8G8B8:
 		case PF_B8G8R8:
 		case PF_B8G8R8:
-		case PF_X8R8G8B8:
-		case PF_A8R8G8B8:
 		case PF_BC1:
 		case PF_BC1:
 		case PF_BC1a:
 		case PF_BC1a:
 		case PF_BC2:
 		case PF_BC2:
 		case PF_BC3:
 		case PF_BC3:
 		case PF_UNKNOWN:
 		case PF_UNKNOWN:
 			return PF_R8G8B8A8;
 			return PF_R8G8B8A8;
-		case PF_A8B8G8R8:
-		case PF_X8B8G8R8:
-		case PF_R8G8B8X8:
-		case PF_B8G8R8X8:
-			return PF_B8G8R8A8;
 		case PF_D32_S8X24:
 		case PF_D32_S8X24:
 			return PF_FLOAT32_RG;
 			return PF_FLOAT32_RG;
 		case PF_D24S8:
 		case PF_D24S8:

+ 1 - 1
Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderWindow.cpp

@@ -511,7 +511,7 @@ namespace bs
 		mDevice.getImmediateContext()->Map(tempTexture, 0,D3D11_MAP_READ, 0, &mappedTex2D);
 		mDevice.getImmediateContext()->Map(tempTexture, 0,D3D11_MAP_READ, 0, &mappedTex2D);
 
 
 		// Copy the the texture to the dest
 		// Copy the the texture to the dest
-		PixelData src(getProperties().getWidth(), getProperties().getHeight(), 1, PF_A8B8G8R8);
+		PixelData src(getProperties().getWidth(), getProperties().getHeight(), 1, PF_R8G8B8A8);
 		src.setExternalBuffer((UINT8*)mappedTex2D.pData);
 		src.setExternalBuffer((UINT8*)mappedTex2D.pData);
 		PixelUtil::bulkPixelConversion(src, dst);
 		PixelUtil::bulkPixelConversion(src, dst);
 
 

+ 1 - 0
Source/BansheeEditor/Source/BsEditorApplication.cpp

@@ -29,6 +29,7 @@
 #include "BsSplashScreen.h"
 #include "BsSplashScreen.h"
 #include "BsDynLib.h"
 #include "BsDynLib.h"
 #include "BsSceneManager.h"
 #include "BsSceneManager.h"
+#include "BsEngineConfig.h"
 
 
 namespace bs
 namespace bs
 {
 {

+ 0 - 1
Source/BansheeEngine/Include/BsApplication.h

@@ -4,7 +4,6 @@
 
 
 #include "BsPrerequisites.h"
 #include "BsPrerequisites.h"
 #include "BsCoreApplication.h"
 #include "BsCoreApplication.h"
-#include "BsEngineConfig.h"
 #include "BsEvent.h"
 #include "BsEvent.h"
 
 
 namespace bs
 namespace bs

+ 1 - 0
Source/BansheeEngine/Source/BsApplication.cpp

@@ -20,6 +20,7 @@
 #include "BsRendererMaterialManager.h"
 #include "BsRendererMaterialManager.h"
 #include "BsPlatform.h"
 #include "BsPlatform.h"
 #include "BsEngineShaderIncludeHandler.h"
 #include "BsEngineShaderIncludeHandler.h"
+#include "BsEngineConfig.h"
 
 
 namespace bs
 namespace bs
 {
 {

+ 4 - 4
Source/BansheeFreeImgImporter/Source/BsFreeImgImporter.cpp

@@ -325,16 +325,16 @@ namespace bs
 				//     PF_BYTE_BGR[A] for little endian (== PF_ARGB native)
 				//     PF_BYTE_BGR[A] for little endian (== PF_ARGB native)
 				//     PF_BYTE_RGB[A] for big endian (== PF_RGBA native)
 				//     PF_BYTE_RGB[A] for big endian (== PF_RGBA native)
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-				format = PF_BYTE_RGB;
+				format = PF_R8G8B8;
 #else
 #else
-				format = PF_BYTE_BGR;
+				format = PF_B8G8R8;
 #endif
 #endif
 				break;
 				break;
 			case 32:
 			case 32:
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-				format = PF_BYTE_RGBA;
+				format = PF_R8G8B8A8;
 #else
 #else
-				format = PF_BYTE_BGRA;
+				format = PF_B8G8R8A8;
 #endif
 #endif
 				break;
 				break;
 
 

+ 2 - 19
Source/BansheeGLRenderAPI/Source/BsGLPixelFormat.cpp

@@ -19,15 +19,9 @@ namespace bs
                 return GL_RGB;
                 return GL_RGB;
             case PF_B8G8R8:
             case PF_B8G8R8:
                 return GL_BGR;
                 return GL_BGR;
-			case PF_R8G8B8X8:
 			case PF_R8G8B8A8:
 			case PF_R8G8B8A8:
-			case PF_A8R8G8B8:
-			case PF_X8R8G8B8:
                 return GL_RGBA;
                 return GL_RGBA;
             case PF_B8G8R8A8:
             case PF_B8G8R8A8:
-			case PF_B8G8R8X8:
-			case PF_A8B8G8R8:
-			case PF_X8B8G8R8:
                 return GL_BGRA;
                 return GL_BGRA;
 			case PF_FLOAT16_R:
 			case PF_FLOAT16_R:
                 return GL_RED;
                 return GL_RED;
@@ -74,15 +68,8 @@ namespace bs
             case PF_B8G8R8:
             case PF_B8G8R8:
 			case PF_R8G8:
 			case PF_R8G8:
 				return GL_UNSIGNED_BYTE;
 				return GL_UNSIGNED_BYTE;
-			case PF_X8B8G8R8:
-			case PF_A8B8G8R8:
-			case PF_X8R8G8B8:
-            case PF_A8R8G8B8:
-				return GL_UNSIGNED_INT_8_8_8_8;
             case PF_B8G8R8A8:
             case PF_B8G8R8A8:
-			case PF_B8G8R8X8:
 			case PF_R8G8B8A8:
 			case PF_R8G8B8A8:
-			case PF_R8G8B8X8:
 				return GL_UNSIGNED_INT_8_8_8_8_REV;
 				return GL_UNSIGNED_INT_8_8_8_8_REV;
 			case PF_FLOAT16_R:
 			case PF_FLOAT16_R:
 			case PF_FLOAT16_RG:
 			case PF_FLOAT16_RG:
@@ -141,8 +128,6 @@ namespace bs
 				return GL_RG8;
 				return GL_RG8;
             case PF_R8G8B8:
             case PF_R8G8B8:
             case PF_B8G8R8:
             case PF_B8G8R8:
-			case PF_B8G8R8X8:
-			case PF_R8G8B8X8:
 				if (hwGamma)
 				if (hwGamma)
 					return GL_SRGB8;
 					return GL_SRGB8;
 				else
 				else
@@ -257,7 +242,7 @@ namespace bs
 			return PF_R8G8;
 			return PF_R8G8;
 		case GL_RGB8:
 		case GL_RGB8:
 		case GL_SRGB8:
 		case GL_SRGB8:
-			return PF_R8G8B8X8;
+			return PF_R8G8B8;
 		case GL_RGBA8:
 		case GL_RGBA8:
 		case GL_SRGB8_ALPHA8:
 		case GL_SRGB8_ALPHA8:
 			return PF_R8G8B8A8;
 			return PF_R8G8B8A8;
@@ -327,9 +312,7 @@ namespace bs
 			return PF_R8G8;
 			return PF_R8G8;
 		case PF_R8G8B8:
 		case PF_R8G8B8:
 		case PF_B8G8R8:
 		case PF_B8G8R8:
-		case PF_B8G8R8X8:
-		case PF_R8G8B8X8:
-			return PF_R8G8B8X8;
+			return PF_R8G8B8;
 		case PF_B8G8R8A8:
 		case PF_B8G8R8A8:
 		case PF_R8G8B8A8:
 		case PF_R8G8B8A8:
 			return PF_R8G8B8A8;
 			return PF_R8G8B8A8;

+ 7 - 16
Source/BansheeGLRenderAPI/Source/BsGLRenderTexture.cpp

@@ -238,11 +238,11 @@ namespace bs
     {
     {
         // Try all formats, and report which ones work as target
         // Try all formats, and report which ones work as target
         GLuint fb = 0, tid = 0;
         GLuint fb = 0, tid = 0;
-        GLint old_drawbuffer = 0, old_readbuffer = 0;
+        GLint oldDrawbuffer = 0, oldReadbuffer = 0;
         GLenum target = GL_TEXTURE_2D;
         GLenum target = GL_TEXTURE_2D;
 
 
-        glGetIntegerv (GL_DRAW_BUFFER, &old_drawbuffer);
-        glGetIntegerv (GL_READ_BUFFER, &old_readbuffer);
+        glGetIntegerv (GL_DRAW_BUFFER, &oldDrawbuffer);
+        glGetIntegerv (GL_READ_BUFFER, &oldReadbuffer);
 
 
         for(size_t x=0; x<PF_COUNT; ++x)
         for(size_t x=0; x<PF_COUNT; ++x)
         {
         {
@@ -333,17 +333,8 @@ namespace bs
                 glDeleteTextures(1, &tid);
                 glDeleteTextures(1, &tid);
         }
         }
 
 
-        // It seems a bug in nVidia driver: glBindFramebuffer should restore
-        // draw and read buffers, but in some unclear circumstances it won't.
-        glDrawBuffer(old_drawbuffer);
-        glReadBuffer(old_readbuffer);
-
-		String fmtstring = "";
-        for(size_t x = 0; x < PF_COUNT; ++x)
-        {
-            if(mProps[x].valid)
-                fmtstring += PixelUtil::getFormatName((PixelFormat)x)+" ";
-        }
+        glDrawBuffer(oldDrawbuffer);
+        glReadBuffer(oldReadbuffer);
     }
     }
     
     
     PixelFormat GLRTTManager::getSupportedAlternative(PixelFormat format)
     PixelFormat GLRTTManager::getSupportedAlternative(PixelFormat format)
@@ -355,7 +346,7 @@ namespace bs
         PixelComponentType pct = PixelUtil::getElementType(format);
         PixelComponentType pct = PixelUtil::getElementType(format);
         switch(pct)
         switch(pct)
         {
         {
-        case PCT_BYTE: format = PF_A8R8G8B8; break;
+        case PCT_BYTE: format = PF_R8G8B8A8; 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;
         default: break;
         default: break;
@@ -365,7 +356,7 @@ namespace bs
             return format;
             return format;
 
 
         // If none at all, return to default
         // If none at all, return to default
-        return PF_A8R8G8B8;
+        return PF_R8G8B8A8;
     }
     }
 
 
 	GLRenderTexture::GLRenderTexture(const RENDER_TEXTURE_DESC& desc)
 	GLRenderTexture::GLRenderTexture(const RENDER_TEXTURE_DESC& desc)

+ 1 - 10
Source/BansheeVulkanRenderAPI/Source/BsVulkanUtility.cpp

@@ -32,7 +32,6 @@ namespace bs
 
 
 			return VK_FORMAT_R8G8B8A8_UNORM;
 			return VK_FORMAT_R8G8B8A8_UNORM;
 		case PF_B8G8R8A8:
 		case PF_B8G8R8A8:
-		case PF_B8G8R8X8:
 			if (sRGB)
 			if (sRGB)
 				return VK_FORMAT_B8G8R8A8_SRGB;
 				return VK_FORMAT_B8G8R8A8_SRGB;
 
 
@@ -54,15 +53,11 @@ namespace bs
 		case PF_FLOAT32_RGBA:
 		case PF_FLOAT32_RGBA:
 			return VK_FORMAT_R32G32B32A32_SFLOAT;
 			return VK_FORMAT_R32G32B32A32_SFLOAT;
 		case PF_BC1:
 		case PF_BC1:
+		case PF_BC1a:
 			if (sRGB)
 			if (sRGB)
 				return VK_FORMAT_BC1_RGB_SRGB_BLOCK;
 				return VK_FORMAT_BC1_RGB_SRGB_BLOCK;
 
 
 			return VK_FORMAT_BC1_RGB_UNORM_BLOCK;
 			return VK_FORMAT_BC1_RGB_UNORM_BLOCK;
-		case PF_BC1a:
-			if (sRGB)
-				return VK_FORMAT_BC1_RGBA_SRGB_BLOCK;
-
-			return VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
 		case PF_BC2:
 		case PF_BC2:
 			if (sRGB)
 			if (sRGB)
 				return VK_FORMAT_BC2_SRGB_BLOCK;
 				return VK_FORMAT_BC2_SRGB_BLOCK;
@@ -96,10 +91,6 @@ namespace bs
 			return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
 			return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
 		case PF_UNORM_R10G10B10A2:
 		case PF_UNORM_R10G10B10A2:
 			return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
 			return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
-		case PF_A8R8G8B8:
-		case PF_A8B8G8R8:
-		case PF_X8R8G8B8:
-		case PF_X8B8G8R8:
 		case PF_UNKNOWN:
 		case PF_UNKNOWN:
 		default:
 		default:
 			return VK_FORMAT_UNDEFINED;
 			return VK_FORMAT_UNDEFINED;

+ 1 - 0
Source/ExampleProject/Source/Main.cpp

@@ -29,6 +29,7 @@
 #include "BsSceneObject.h"
 #include "BsSceneObject.h"
 #include "BsCoreThread.h"
 #include "BsCoreThread.h"
 #include "BsProfilerOverlay.h"
 #include "BsProfilerOverlay.h"
+#include "BsEngineConfig.h"
 
 
 // Example includes
 // Example includes
 #include "CameraFlyer.h"
 #include "CameraFlyer.h"