Kaynağa Gözat

Pixel formats refactor/update:
- Added 8/16/32 bit integer formats
- Added 8/16 bit signed normalized formats
- Added 16 bit unsigned normalized formats
- Renamed old pixel formats to follow a nicer naming convention
- Updated pixel packing/unpacking code so it is more generalized

BearishSun 8 yıl önce
ebeveyn
işleme
a2cbf9eddd
37 değiştirilmiş dosya ile 1198 ekleme ve 697 silme
  1. 4 0
      Data/Raw/Engine/DataList.json
  2. 130 99
      Source/BansheeCore/Include/BsPixelData.h
  3. 0 3
      Source/BansheeCore/Include/BsPixelUtil.h
  4. 1 1
      Source/BansheeCore/Include/BsTexture.h
  5. 1 1
      Source/BansheeCore/Source/BsLightProbeVolume.cpp
  6. 562 282
      Source/BansheeCore/Source/BsPixelUtil.cpp
  7. 1 1
      Source/BansheeCore/Source/BsReflectionProbe.cpp
  8. 2 2
      Source/BansheeCore/Source/BsRendererMeshData.cpp
  9. 2 2
      Source/BansheeCore/Source/BsSkybox.cpp
  10. 1 1
      Source/BansheeCore/Source/BsTextureImportOptions.cpp
  11. 4 4
      Source/BansheeCore/Source/BsTextureManager.cpp
  12. 1 1
      Source/BansheeCore/Source/Win32/BsWin32Platform.cpp
  13. 93 58
      Source/BansheeD3D11RenderAPI/Source/BsD3D11Mappings.cpp
  14. 1 1
      Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderWindow.cpp
  15. 1 1
      Source/BansheeEditor/Source/BsScenePicking.cpp
  16. 4 4
      Source/BansheeEngine/Source/BsBuiltinResources.cpp
  17. 2 2
      Source/BansheeFontImporter/Source/BsFontImporter.cpp
  18. 41 13
      Source/BansheeFreeImgImporter/Source/BsFreeImgImporter.cpp
  19. 235 160
      Source/BansheeGLRenderAPI/Source/BsGLPixelFormat.cpp
  20. 4 4
      Source/BansheeGLRenderAPI/Source/BsGLRenderTexture.cpp
  21. 1 1
      Source/BansheeSL/Source/BsSLFXCompiler.cpp
  22. 20 5
      Source/BansheeUtility/Include/BsBitwise.h
  23. 3 3
      Source/BansheeVulkanRenderAPI/Source/BsVulkanTextureManager.cpp
  24. 54 18
      Source/BansheeVulkanRenderAPI/Source/BsVulkanUtility.cpp
  25. 2 2
      Source/Examples/ExampleLowLevelRendering/Source/Main.cpp
  26. 1 1
      Source/Examples/ExamplePhysicallyBasedShading/Source/Main.cpp
  27. 1 1
      Source/MBansheeEditor/Windows/GameWindow.cs
  28. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneAxesGUI.cs
  29. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneWindow.cs
  30. 3 3
      Source/MBansheeEngine/Rendering/Texture.cs
  31. 1 1
      Source/RenderBeast/Source/BsLightProbes.cpp
  32. 4 4
      Source/RenderBeast/Source/BsPostProcessing.cpp
  33. 1 1
      Source/RenderBeast/Source/BsRenderBeast.cpp
  34. 10 10
      Source/RenderBeast/Source/BsRenderCompositor.cpp
  35. 2 2
      Source/RenderBeast/Source/BsRendererTextures.cpp
  36. 1 1
      Source/SBansheeEditor/Source/BsScriptBuildManager.cpp
  37. 2 2
      Source/SBansheeEngine/Include/BsPixelDataEx.h

+ 4 - 0
Data/Raw/Engine/DataList.json

@@ -345,6 +345,10 @@
         {
             "Path": "PPSSRResolve.bsl",
             "UUID": "86b9699c-162d-4729-9985-c94e0f45bacb"
+        },
+        {
+            "Path": "TetrahedronRender.bsl",
+            "UUID": "0ea10201-ae22-4a64-bd09-06f8b4a35d9a"
         }
     ],
     "Skin": [

+ 130 - 99
Source/BansheeCore/Include/BsPixelData.h

@@ -14,30 +14,30 @@ namespace bs
 	 */
 
 	/** Pixel formats usable by images, textures and render surfaces. */
-    enum BS_SCRIPT_EXPORT() PixelFormat
-    {
-        /** Unknown pixel format. */
-        PF_UNKNOWN				BS_SCRIPT_EXPORT(ex:true) = 0,
-        /** 8-bit pixel format, all bits red. */
-        PF_R8					BS_SCRIPT_EXPORT(n:R8) = 1,
-		/** 2 byte pixel format, 1 byte red, 1 byte green. */
-		PF_R8G8					BS_SCRIPT_EXPORT(n:R8G8) = 2,
-        /** 24-bit pixel format, 8 bits for red, green and blue. */
-        PF_R8G8B8				BS_SCRIPT_EXPORT(n:R8G8B8) = 3,
-        /** 24-bit pixel format, 8 bits for blue, green and red. */
-        PF_B8G8R8				BS_SCRIPT_EXPORT(n:B8G8R8) = 4,
-        /** 32-bit pixel format, 8 bits for blue, green, red and alpha. */
-        PF_B8G8R8A8				BS_SCRIPT_EXPORT(n:B8G8R8A8) = 7,
-		/** 32-bit pixel format, 8 bits for red, green, blue and alpha. */
-		PF_R8G8B8A8				BS_SCRIPT_EXPORT(n:R8G8B8A8) = 8,
-        /** DXT1/BC1 format containing opaque RGB or 1-bit alpha RGB. 4 bits per pixel. */
-        PF_BC1					BS_SCRIPT_EXPORT(n:BC1) = 13,
+	enum BS_SCRIPT_EXPORT() PixelFormat
+	{
+		/** Unknown pixel format. */
+		PF_UNKNOWN				BS_SCRIPT_EXPORT(ex:true) = 0,
+		/** 8-bit 1-channel pixel format, unsigned normalized. */
+		PF_R8					BS_SCRIPT_EXPORT(n:R8) = 1,
+		/** 8-bit 2-channel pixel format, unsigned normalized. */
+		PF_RG8					BS_SCRIPT_EXPORT(n:RG8) = 2,
+		/** 8-bit 3-channel pixel format, unsigned normalized. */
+		PF_RGB8					BS_SCRIPT_EXPORT(n:RGB8) = 3,
+		/** 8-bit 3-channel pixel format, unsigned normalized. */
+		PF_BGR8					BS_SCRIPT_EXPORT(n:BGR8) = 4,
+		/** 8-bit 4-channel pixel format, unsigned normalized. */
+		PF_BGRA8				BS_SCRIPT_EXPORT(n:BGRA8) = 7,
+		/** 8-bit 4-channel pixel format, unsigned normalized. */
+		PF_RGBA8				BS_SCRIPT_EXPORT(n:RGBA8) = 8,
+		/** DXT1/BC1 format containing opaque RGB or 1-bit alpha RGB. 4 bits per pixel. */
+		PF_BC1					BS_SCRIPT_EXPORT(n:BC1) = 13,
 		/** DXT3/BC2 format containing RGB with premultiplied alpha. 4 bits per pixel. */
 		PF_BC1a					BS_SCRIPT_EXPORT(ex:true) = 14,
-        /** DXT3/BC2 format containing RGB with explicit alpha. 8 bits per pixel. */
-        PF_BC2					BS_SCRIPT_EXPORT(n:BC2) = 15,
-        /** DXT5/BC2 format containing RGB with explicit alpha. 8 bits per pixel. Better alpha gradients than BC2. */
-        PF_BC3					BS_SCRIPT_EXPORT(n:BC3) = 16,
+		/** DXT3/BC2 format containing RGB with explicit alpha. 8 bits per pixel. */
+		PF_BC2					BS_SCRIPT_EXPORT(n:BC2) = 15,
+		/** DXT5/BC2 format containing RGB with explicit alpha. 8 bits per pixel. Better alpha gradients than BC2. */
+		PF_BC3					BS_SCRIPT_EXPORT(n:BC3) = 16,
 		/** One channel compressed format. 4 bits per pixel. */
 		PF_BC4					BS_SCRIPT_EXPORT(n:BC4) = 17,
 		/** Two channel compressed format. 8 bits per pixel. */
@@ -49,80 +49,111 @@ namespace bs
 		 * higher decompress overhead. 8 bits per pixel. 
 		 */
 		PF_BC7					BS_SCRIPT_EXPORT(n:BC7) = 20,
-		/** 16-bit pixel format, 16 bits (float) for red. */
-        PF_FLOAT16_R			BS_SCRIPT_EXPORT(n:Float16_R) = 21,
-		/** 32-bit, 2-channel s10e5 floating point pixel format, 16-bit red, 16-bit green. */
-		PF_FLOAT16_RG			BS_SCRIPT_EXPORT(n:Float16_RG) = 22,
-        /** 48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue. */
-        PF_FLOAT16_RGB			BS_SCRIPT_EXPORT(n:Float16_RGB) = 23,
-        /** 
-		 * 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			BS_SCRIPT_EXPORT(n:Float16_RGBA) = 24,
-		/** 32-bit pixel format, 32 bits (float) for red. */
-        PF_FLOAT32_R			BS_SCRIPT_EXPORT(n:Float32_R) = 25,
-		/** 64-bit, 2-channel floating point pixel format, 32-bit red, 32-bit green. */
-		PF_FLOAT32_RG			BS_SCRIPT_EXPORT(n:Float32_RG) = 26,
-        /** 96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue. */
-        PF_FLOAT32_RGB			BS_SCRIPT_EXPORT(n:Float32_RGB) = 27,
-        /** 
-		 * 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			BS_SCRIPT_EXPORT(n:Float32_RGBA) = 28,
-		/** Depth stencil format, 32bit depth, 8bit stencil + 24 unused. */
+		/** 16-bit 1-channel pixel format, signed float. */
+		PF_R16F					BS_SCRIPT_EXPORT(n:R16F) = 21,
+		/** 16-bit 2-channel pixel format, signed float. */
+		PF_RG16F				BS_SCRIPT_EXPORT(n:RG16F) = 22,
+		/** 16-bit 4-channel pixel format, signed float. */
+		PF_RGBA16F				BS_SCRIPT_EXPORT(n:RGBA16F) = 24,
+		/** 32-bit 1-channel pixel format, signed float. */
+		PF_R32F					BS_SCRIPT_EXPORT(n:R32F) = 25,
+		/** 32-bit 2-channel pixel format, signed float. */
+		PF_RG32F				BS_SCRIPT_EXPORT(n:RG32F) = 26,
+		/** 32-bit 3-channel pixel format, signed float. */
+		PF_RGB32F				BS_SCRIPT_EXPORT(n:RGB32F) = 27,
+		/** 32-bit 4-channel pixel format, signed float. */
+		PF_RGBA32F				BS_SCRIPT_EXPORT(n:RGBA32F) = 28,
+		/** Depth stencil format, 32bit depth, 8bit stencil + 24 unused. Depth stored as signed float. */
 		PF_D32_S8X24			BS_SCRIPT_EXPORT(n:D32_S8X24) = 29,
-		/** Depth stencil fomrat, 24bit depth + 8bit stencil. */
+		/** Depth stencil fomrat, 24bit depth + 8bit stencil. Depth stored as unsigned normalized. */
 		PF_D24S8				BS_SCRIPT_EXPORT(n:D24S8) = 30,
-		/** Depth format, 32bits. */
+		/** Depth format, 32bits. Signed float. */
 		PF_D32					BS_SCRIPT_EXPORT(n:D32) = 31,
-		/** Depth format, 16bits. */
+		/** Depth format, 16bits. Unsigned normalized. */
 		PF_D16					BS_SCRIPT_EXPORT(n:D16) = 32,
+		/** Packed unsigned float format, 11 bits for red, 11 bits for green, 10 bits for blue. */
+		PF_RG11B10F				BS_SCRIPT_EXPORT(ex:true) = 33,
 		/** 
-		 * 32-bit float format, 11 bits (float) for red, 11 bits (float) for green, 10 bits (float) for blue.
-		 */
-		PF_FLOAT_R11G11B10		BS_SCRIPT_EXPORT(ex:true) = 33,
-		/** 
-		 * 32-bit unsigned normalized format, 10 bits (float) for red, 10 bits (float) for green, 10 bits (float) for blue, 
-		 * and two bits for alpha.
-		 */
-		PF_UNORM_R10G10B10A2	BS_SCRIPT_EXPORT(ex:true) = 34,
+		 * Packed unsigned normalized format, 10 bits for red, 10 bits for green, 10 bits for blue, and two bits for alpha.
+		 */
+		PF_RGB10A2				BS_SCRIPT_EXPORT(ex:true) = 34,
+		/** 8-bit 1-channel pixel format, signed integer. */
+		PF_R8I					BS_SCRIPT_EXPORT(n:R8I) = 35,
+		/** 8-bit 2-channel pixel format, signed integer. */
+		PF_RG8I					BS_SCRIPT_EXPORT(n:RG8I) = 36,
+		/** 8-bit 4-channel pixel format, signed integer. */
+		PF_RGBA8I				BS_SCRIPT_EXPORT(n:RGBA8I) = 37,
+		/** 8-bit 1-channel pixel format, signed normalized. */
+		PF_R8S					BS_SCRIPT_EXPORT(n:R8S) = 38,
+		/** 8-bit 2-channel pixel format, signed normalized. */
+		PF_RG8S					BS_SCRIPT_EXPORT(n:RG8S) = 39,
+		/** 8-bit 4-channel pixel format, signed normalized. */
+		PF_RGBA8S				BS_SCRIPT_EXPORT(n:RGBA8S) = 40,
+		/** 16-bit 1-channel pixel format, signed integer. */
+		PF_R16I					BS_SCRIPT_EXPORT(n:R16I) = 41,
+		/** 16-bit 2-channel pixel format, signed integer. */
+		PF_RG16I				BS_SCRIPT_EXPORT(n:RG16I) = 42,
+		/** 16-bit 4-channel pixel format, signed integer. */
+		PF_RGBA16I				BS_SCRIPT_EXPORT(n:RGBA16I) = 43,
+		/** 32-bit 1-channel pixel format, signed integer. */
+		PF_R32I					BS_SCRIPT_EXPORT(n:R32I) = 44,
+		/** 32-bit 2-channel pixel format, signed integer. */
+		PF_RG32I				BS_SCRIPT_EXPORT(n:RG32I) = 45,
+		/** 32-bit 3-channel pixel format, signed integer. */
+		PF_RGB32I				BS_SCRIPT_EXPORT(n:RGB32I) = 46,
+		/** 32-bit 4-channel pixel format, signed integer. */
+		PF_RGBA32I				BS_SCRIPT_EXPORT(n:RGBA32I) = 47,
+		/** 16-bit 1-channel pixel format, signed normalized. */
+		PF_R16S					BS_SCRIPT_EXPORT(n:R16S) = 48,
+		/** 16-bit 2-channel pixel format, signed normalized. */
+		PF_RG16S				BS_SCRIPT_EXPORT(n:RG16S) = 49,
+		/** 16-bit 4-channel pixel format, signed normalized. */
+		PF_RGBA16S				BS_SCRIPT_EXPORT(n:RGBA16S) = 50,
+		/** 16-bit 1-channel pixel format, unsigned normalized. */
+		PF_R16					BS_SCRIPT_EXPORT(n:R16) = 51,
+		/** 16-bit 2-channel pixel format, unsigned normalized. */
+		PF_RG16					BS_SCRIPT_EXPORT(n:RG16) = 52,
+		/** 16-bit 3-channel pixel format, unsigned normalized. */
+		PF_RGB16				BS_SCRIPT_EXPORT(n:RGB16) = 53,
+		/** 16-bit 4-channel pixel format, unsigned normalized. */
+		PF_RGBA16				BS_SCRIPT_EXPORT(n:RGBA16) = 54,
 		/** Number of pixel formats currently defined. */
-        PF_COUNT				BS_SCRIPT_EXPORT(ex:true) = 35
-    };
+		PF_COUNT				BS_SCRIPT_EXPORT(ex:true)
+	};
 
 	/**	Flags defining some properties of pixel formats. */
-    enum PixelFormatFlags {
-        /** This format has an alpha channel. */
-        PFF_HASALPHA = 0x00000001,      
-        /**
+	enum PixelFormatFlags {
+		/** This format has an alpha channel. */
+		PFF_HASALPHA = 0x1,
+		/**
 		 * This format is compressed. This invalidates the values in elemBytes, elemBits and the bit counts as these might
 		 * not be fixed in a compressed format.
 		 */
-        PFF_COMPRESSED = 0x00000002,
-        /** This is a floating point format. */
-        PFF_FLOAT = 0x00000004,         
-        /** This is a depth format (for depth textures). */
-        PFF_DEPTH = 0x00000008,
-        /** 
-		 * Format is in native endian. Generally true for the 16, 24 and 32 bits formats which can be represented as 
-		 * machine integers.
-		 */
-        PFF_NATIVEENDIAN = 0x00000010
-    };
-    
+		PFF_COMPRESSED = 0x2,
+		/** This is a floating point format. */
+		PFF_FLOAT = 0x4,
+		/** This is a depth format (for depth textures). */
+		PFF_DEPTH = 0x8,
+		/** This format stores data internally as integers. */
+		PFF_INTEGER = 0x10,
+		/** Format contains signed data. Absence of this flag implies unsigned data. */
+		PFF_SIGNED = 0x20,
+		/** Format contains normalized data. This will be [0, 1] for unsigned, and [-1,1] for signed formats. */
+		PFF_NORMALIZED = 0x40
+	};
+
 	/**	Types used for individual components of a pixel. */
-    enum PixelComponentType
-    {
-        PCT_BYTE = 0,    /**< Byte per component */
-        PCT_SHORT = 1,   /**< Short per component */
-        PCT_FLOAT16 = 2, /**< 16 bit float per component */
-        PCT_FLOAT32 = 3, /**< 32 bit float per component */
-		PCT_PACKED_R11G11B10 = 4, /**< 11 bits for first two components, 10 for third component. */
-		PCT_PACKED_R10G10B10A2 = 5, /**< 10 bits for first three components, 2 bits for last component */
-        PCT_COUNT = 4    /**< Number of pixel types */
-    };
+	enum PixelComponentType
+	{
+		PCT_BYTE = 0, /**< 8-bit integer per component */
+		PCT_SHORT = 1, /**< 16-bit integer per component. */
+		PCT_INT = 2, /**< 32-bit integer per component. */
+		PCT_FLOAT16 = 3, /**< 16 bit float per component */
+		PCT_FLOAT32 = 4, /**< 32 bit float per component */
+		PCT_PACKED_R11G11B10 = 5, /**< 11 bits for first two components, 10 for third component. */
+		PCT_PACKED_R10G10B10A2 = 6, /**< 10 bits for first three components, 2 bits for last component */
+		PCT_COUNT    /**< Number of pixel types */
+	};
 
 	/** Determines how are texture pixels filtered during sampling. */
 	enum TextureFilter
@@ -154,9 +185,9 @@ namespace bs
 	 *
 	 * @see		GpuResourceData
 	 */
-    class BS_CORE_EXPORT BS_SCRIPT_EXPORT() PixelData : public GpuResourceData
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT() PixelData : public GpuResourceData
 	{
-    public:
+	public:
 		PixelData();
 		~PixelData() {}
 
@@ -199,19 +230,19 @@ namespace bs
 		 * Sets the pitch (in pixels) that determines offset between depth slices of the pixel buffer. Call this before 
 		 * allocating the buffer.
 		 */
-        void setSlicePitch(UINT32 slicePitch) { mSlicePitch = slicePitch; }
+		void setSlicePitch(UINT32 slicePitch) { mSlicePitch = slicePitch; }
 
 		/**
 		 * Returns the number of extra pixels in a row (non-zero only if rows are not consecutive (row pitch is larger 
 		 * than width)).
 		 */
-        UINT32 getRowSkip() const { return mRowPitch - getWidth(); }
+		UINT32 getRowSkip() const { return mRowPitch - getWidth(); }
 
 		/**
 		 * Returns the number of extra pixels in a depth slice (non-zero only if slices aren't consecutive (slice pitch is 
 		 * larger than width*height).
 		 */
-        UINT32 getSliceSkip() const { return mSlicePitch - (getHeight() * mRowPitch); }
+		UINT32 getSliceSkip() const { return mSlicePitch - (getHeight() * mRowPitch); }
 
 		/** Returns the pixel format used by the internal buffer for storing the pixels. */
 		BS_SCRIPT_EXPORT(n:Format,pr:getter)
@@ -270,24 +301,24 @@ namespace bs
 		 * Return whether this buffer is laid out consecutive in memory (meaning the pitches are equal to the dimensions). 
 		 */
 		BS_SCRIPT_EXPORT(n:RawIsConsecutive,pr:getter)
-        bool isConsecutive() const 
+		bool isConsecutive() const
 		{ 
 			return mRowPitch == getWidth() && mSlicePitch == getWidth()*getHeight(); 
 		}
 
 		/** Return the size (in bytes) this image would take if it was laid out consecutive in memory. */
-      	UINT32 getConsecutiveSize() const;
+		UINT32 getConsecutiveSize() const;
 
 		/**	Return the size (in bytes) of the buffer this image requires. */
 		BS_SCRIPT_EXPORT(n:RawSize,pr:getter)
-      	UINT32 getSize() const;
+		UINT32 getSize() const;
 
 		/**
 		 * Returns pixel data containing a sub-volume of this object. Returned data will not have its own buffer, but will
 		 * instead point to this one. It is up to the caller to ensure this object outlives any sub-volume objects.
 		 */
-      	PixelData getSubVolume(const PixelVolume& volume) const;
-        
+		PixelData getSubVolume(const PixelVolume& volume) const;
+
 		/** 
 		 * Samples a color at the specified coordinates using a specific filter.
 		 * 
@@ -302,7 +333,7 @@ namespace bs
 		Color getColorAt(UINT32 x, UINT32 y, UINT32 z = 0) const;
 
 		/**	Sets the pixel color at the specified coordinates. */
-        void setColorAt(const Color& color, UINT32 x, UINT32 y, UINT32 z = 0);
+		void setColorAt(const Color& color, UINT32 x, UINT32 y, UINT32 z = 0);
 
 		/**
 		 * Converts all the internal data into an array of colors. Array is mapped as such: 
@@ -361,9 +392,9 @@ namespace bs
 
 	private:
 		PixelVolume mExtents;
-        PixelFormat mFormat;
-        UINT32 mRowPitch;
-        UINT32 mSlicePitch;
+		PixelFormat mFormat;
+		UINT32 mRowPitch;
+		UINT32 mSlicePitch;
 
 		/************************************************************************/
 		/* 								SERIALIZATION                      		*/
@@ -372,7 +403,7 @@ namespace bs
 		friend class PixelDataRTTI;
 		static RTTITypeBase* getRTTIStatic();
 		RTTITypeBase* getRTTI() const override;
-    };
+	};
 
 	/** @} */
 }

+ 0 - 3
Source/BansheeCore/Include/BsPixelUtil.h

@@ -126,9 +126,6 @@ namespace bs
 		/**	Checks is the provided pixel format a depth/stencil buffer format. */
 		static bool isDepth(PixelFormat format);
 
-		/**	Checks is the provided format in native endian format. */
-		static bool isNativeEndian(PixelFormat format);
-		
 		/** 
 		 * Checks is the provided format valid for the texture type and usage. 
 		 * 

+ 1 - 1
Source/BansheeCore/Include/BsTexture.h

@@ -48,7 +48,7 @@ namespace bs
 		TextureType type = TEX_TYPE_2D;
 
 		/** Format of pixels in the texture. */
-		PixelFormat format = PF_R8G8B8A8;
+		PixelFormat format = PF_RGBA8;
 
 		/** Width of the texture in pixels. */
 		UINT32 width = 1;

+ 1 - 1
Source/BansheeCore/Source/BsLightProbeVolume.cpp

@@ -323,7 +323,7 @@ namespace bs
 			{
 				TEXTURE_DESC cubemapDesc;
 				cubemapDesc.type = TEX_TYPE_CUBE_MAP;
-				cubemapDesc.format = PF_FLOAT16_RGB;
+				cubemapDesc.format = PF_RGBA16F;
 				cubemapDesc.width = IBLUtility::IRRADIANCE_CUBEMAP_SIZE;
 				cubemapDesc.height = IBLUtility::IRRADIANCE_CUBEMAP_SIZE;
 				cubemapDesc.usage = TU_STATIC | TU_RENDERTARGET;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 562 - 282
Source/BansheeCore/Source/BsPixelUtil.cpp


+ 1 - 1
Source/BansheeCore/Source/BsReflectionProbe.cpp

@@ -77,7 +77,7 @@ namespace bs
 
 		TEXTURE_DESC cubemapDesc;
 		cubemapDesc.type = TEX_TYPE_CUBE_MAP;
-		cubemapDesc.format = PF_FLOAT_R11G11B10;
+		cubemapDesc.format = PF_RG11B10F;
 		cubemapDesc.width = ct::IBLUtility::REFLECTION_CUBEMAP_SIZE;
 		cubemapDesc.height = ct::IBLUtility::REFLECTION_CUBEMAP_SIZE;
 		cubemapDesc.numMips = PixelUtil::getMaxMipmaps(cubemapDesc.width, cubemapDesc.height, 1, cubemapDesc.format);

+ 2 - 2
Source/BansheeCore/Source/BsRendererMeshData.cpp

@@ -118,7 +118,7 @@ namespace bs
 		Color* colorDst = buffer;
 		for (UINT32 i = 0; i < numElements; i++)
 		{
-			PixelUtil::unpackColor(colorDst, PF_R8G8B8A8, (void*)colorSrc);
+			PixelUtil::unpackColor(colorDst, PF_RGBA8, (void*)colorSrc);
 
 			colorSrc += stride;
 			colorDst++;
@@ -139,7 +139,7 @@ namespace bs
 		Color* colorSrc = buffer;
 		for (UINT32 i = 0; i < numElements; i++)
 		{
-			PixelUtil::packColor(*colorSrc, PF_R8G8B8A8, (void*)colorDst);
+			PixelUtil::packColor(*colorSrc, PF_RGBA8, (void*)colorDst);
 
 			colorSrc++;
 			colorDst += stride;

+ 2 - 2
Source/BansheeCore/Source/BsSkybox.cpp

@@ -49,7 +49,7 @@ namespace bs
 		{
 			TEXTURE_DESC cubemapDesc;
 			cubemapDesc.type = TEX_TYPE_CUBE_MAP;
-			cubemapDesc.format = PF_FLOAT_R11G11B10;
+			cubemapDesc.format = PF_RG11B10F;
 			cubemapDesc.width = ct::IBLUtility::REFLECTION_CUBEMAP_SIZE;
 			cubemapDesc.height = ct::IBLUtility::REFLECTION_CUBEMAP_SIZE;
 			cubemapDesc.numMips = PixelUtil::getMaxMipmaps(cubemapDesc.width, cubemapDesc.height, 1, cubemapDesc.format);
@@ -61,7 +61,7 @@ namespace bs
 		{
 			TEXTURE_DESC irradianceCubemapDesc;
 			irradianceCubemapDesc.type = TEX_TYPE_CUBE_MAP;
-			irradianceCubemapDesc.format = PF_FLOAT_R11G11B10;
+			irradianceCubemapDesc.format = PF_RG11B10F;
 			irradianceCubemapDesc.width = ct::IBLUtility::IRRADIANCE_CUBEMAP_SIZE;
 			irradianceCubemapDesc.height = ct::IBLUtility::IRRADIANCE_CUBEMAP_SIZE;
 			irradianceCubemapDesc.numMips = 0;

+ 1 - 1
Source/BansheeCore/Source/BsTextureImportOptions.cpp

@@ -6,7 +6,7 @@
 namespace bs
 {
 	TextureImportOptions::TextureImportOptions()
-		: mFormat(PF_R8G8B8A8), mGenerateMips(false), mMaxMip(0), mCPUCached(false), mSRGB(false), mCubemap(false)
+		: mFormat(PF_RGBA8), mGenerateMips(false), mMaxMip(0), mCPUCached(false), mSRGB(false), mCubemap(false)
 		, mCubemapSourceType(CubemapSourceType::Faces)
 	{ }
 

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

@@ -90,13 +90,13 @@ namespace bs
 		desc.type = TEX_TYPE_2D;
 		desc.width = 2;
 		desc.height = 2;
-		desc.format = PF_R8G8B8A8;
+		desc.format = PF_RGBA8;
 		desc.usage = TU_STATIC;
 
 		// White built-in texture
 		SPtr<Texture> whiteTexture = createTexture(desc);
 
-		SPtr<PixelData> whitePixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> whitePixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 		whitePixelData->setColorAt(Color::White, 0, 0);
 		whitePixelData->setColorAt(Color::White, 0, 1);
 		whitePixelData->setColorAt(Color::White, 1, 0);
@@ -108,7 +108,7 @@ namespace bs
 		// Black built-in texture
 		SPtr<Texture> blackTexture = createTexture(desc);
 
-		SPtr<PixelData> blackPixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> blackPixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 		blackPixelData->setColorAt(Color::Black, 0, 0);
 		blackPixelData->setColorAt(Color::Black, 0, 1);
 		blackPixelData->setColorAt(Color::Black, 1, 0);
@@ -119,7 +119,7 @@ namespace bs
 
 		// Normal (Y = Up) built-in texture
 		SPtr<Texture> normalTexture = createTexture(desc);
-		SPtr<PixelData> normalPixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> normalPixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 
 		Color encodedNormal(0.5f, 0.5f, 1.0f);
 		normalPixelData->setColorAt(encodedNormal, 0, 0);

+ 1 - 1
Source/BansheeCore/Source/Win32/BsWin32Platform.cpp

@@ -192,7 +192,7 @@ namespace bs
 
 	void Platform::setIcon(const PixelData& pixelData)
 	{
-		SPtr<PixelData> resizedData = PixelData::create(32, 32, 1, PF_R8G8B8A8);
+		SPtr<PixelData> resizedData = PixelData::create(32, 32, 1, PF_RGBA8);
 		PixelUtil::scale(pixelData, *resizedData);
 
 		Vector<Color> pixels = pixelData.getColors();

+ 93 - 58
Source/BansheeD3D11RenderAPI/Source/BsD3D11Mappings.cpp

@@ -413,39 +413,39 @@ namespace bs { namespace ct
 		case DXGI_FORMAT_R32G32B32A32_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32A32_FLOAT:
-			return PF_FLOAT32_RGBA;
+			return PF_RGBA32F;
 		case DXGI_FORMAT_R32G32B32A32_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32A32_SINT:
-			return PF_UNKNOWN;
+			return PF_RGBA32I;
 		case DXGI_FORMAT_R32G32B32_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32_FLOAT:
-			return PF_FLOAT32_RGB;
+			return PF_RGB32F;
 		case DXGI_FORMAT_R32G32B32_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32_SINT:
-			return PF_UNKNOWN;
+			return PF_RGB32I;
 		case DXGI_FORMAT_R16G16B16A16_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16B16A16_FLOAT:
-			return PF_FLOAT16_RGBA;
+			return PF_RGBA16F;
 		case DXGI_FORMAT_R16G16B16A16_UNORM:
-			return PF_UNKNOWN;
+			return PF_RGBA16;
 		case DXGI_FORMAT_R16G16B16A16_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16B16A16_SNORM:
-			return PF_UNKNOWN;
+			return PF_RGBA16S;
 		case DXGI_FORMAT_R16G16B16A16_SINT:
-			return PF_UNKNOWN;
+			return PF_RGBA16I;
 		case DXGI_FORMAT_R32G32_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32_FLOAT:
-			return PF_FLOAT32_RG;
+			return PF_RG32F;
 		case DXGI_FORMAT_R32G32_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32_SINT:
-			return PF_UNKNOWN;
+			return PF_RG32I;
 		case DXGI_FORMAT_R32G8X24_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
@@ -457,44 +457,44 @@ namespace bs { namespace ct
 		case DXGI_FORMAT_R10G10B10A2_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R10G10B10A2_UNORM:
-			return PF_UNORM_R10G10B10A2;
+			return PF_RGB10A2;
 		case DXGI_FORMAT_R10G10B10A2_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R11G11B10_FLOAT:
-			return PF_FLOAT_R11G11B10;
+			return PF_RG11B10F;
 		case DXGI_FORMAT_R8G8B8A8_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8G8B8A8_UNORM:
 		case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
-			return PF_R8G8B8A8;
+			return PF_RGBA8;
 		case DXGI_FORMAT_R8G8B8A8_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8G8B8A8_SNORM:
-			return PF_UNKNOWN;
+			return PF_RGBA8S;
 		case DXGI_FORMAT_R8G8B8A8_SINT:
-			return PF_UNKNOWN;
+			return PF_RGBA8I;
 		case DXGI_FORMAT_R16G16_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16_FLOAT:
-			return PF_FLOAT16_RG;
+			return PF_RG16F;
 		case DXGI_FORMAT_R16G16_UNORM:
-			return PF_UNKNOWN;
+			return PF_RG16;
 		case DXGI_FORMAT_R16G16_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16_SNORM:
-			return PF_UNKNOWN;
+			return PF_RG16S;
 		case DXGI_FORMAT_R16G16_SINT:
-			return PF_UNKNOWN;
+			return PF_RG16I;
 		case DXGI_FORMAT_R32_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_D32_FLOAT:
 			return PF_D32;
 		case DXGI_FORMAT_R32_FLOAT:
-			return PF_FLOAT32_R;
+			return PF_R32F;
 		case DXGI_FORMAT_R32_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32_SINT:
-			return PF_UNKNOWN;
+			return PF_R32I;
 		case DXGI_FORMAT_R24G8_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_D24_UNORM_S8_UINT:
@@ -506,27 +506,27 @@ namespace bs { namespace ct
 		case DXGI_FORMAT_R8G8_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8G8_UNORM:
-			return PF_R8G8;
+			return PF_RG8;
 		case DXGI_FORMAT_R8G8_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8G8_SNORM:
-			return PF_UNKNOWN;
+			return PF_RG8S;
 		case DXGI_FORMAT_R8G8_SINT:
-			return PF_UNKNOWN;
+			return PF_RG8I;
 		case DXGI_FORMAT_R16_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16_FLOAT:
-			return PF_FLOAT16_R;
+			return PF_R16F;
 		case DXGI_FORMAT_D16_UNORM:
 			return PF_D16;
 		case DXGI_FORMAT_R16_UNORM:
-			return PF_UNKNOWN;
+			return PF_R16;
 		case DXGI_FORMAT_R16_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16_SNORM:
-			return PF_UNKNOWN;
+			return PF_R16S;
 		case DXGI_FORMAT_R16_SINT:
-			return PF_UNKNOWN;
+			return PF_R16I;
 		case DXGI_FORMAT_R8_TYPELESS:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8_UNORM:
@@ -534,9 +534,9 @@ namespace bs { namespace ct
 		case DXGI_FORMAT_R8_UINT:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8_SNORM:
-			return PF_UNKNOWN;
+			return PF_R8S;
 		case DXGI_FORMAT_R8_SINT:
-			return PF_UNKNOWN;
+			return PF_R8I;
 		case DXGI_FORMAT_A8_UNORM:
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R1_UNORM:
@@ -589,9 +589,12 @@ namespace bs { namespace ct
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_B5G5R5A1_UNORM:
 			return PF_UNKNOWN;
+		case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+		case DXGI_FORMAT_B8G8R8X8_UNORM:
+			return PF_BGR8;
 		case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
 		case DXGI_FORMAT_B8G8R8A8_UNORM:
-			return PF_B8G8R8A8;
+			return PF_BGRA8;
 		default:
 			return PF_UNKNOWN;
 		}
@@ -603,35 +606,73 @@ namespace bs { namespace ct
 		{
 		case PF_R8:
 			return DXGI_FORMAT_R8_UNORM;
-		case PF_R8G8:
+		case PF_R8S:
+			return DXGI_FORMAT_R8_SNORM;
+		case PF_R8I:
+			return DXGI_FORMAT_R8_SINT;
+		case PF_RG8:
 			return DXGI_FORMAT_R8G8_UNORM; 
-		case PF_R8G8B8:
-		case PF_B8G8R8:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_R8G8B8A8:
+		case PF_RG8S:
+			return DXGI_FORMAT_R8G8_SNORM; 
+		case PF_RG8I:
+			return DXGI_FORMAT_R8G8_SINT; 
+		case PF_BGR8:
+			if (gamma)
+				return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
+			return DXGI_FORMAT_B8G8R8X8_UNORM;
+		case PF_RGB8:
+		case PF_RGBA8:
 			if (gamma)
 				return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
 			return DXGI_FORMAT_R8G8B8A8_UNORM;
-		case PF_B8G8R8A8:
+		case PF_RGBA8I:
+			return DXGI_FORMAT_R8G8B8A8_SINT;
+		case PF_RGBA8S:
+			return DXGI_FORMAT_R8G8B8A8_SNORM;
+		case PF_BGRA8:
 			if (gamma)
 				return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
 			return DXGI_FORMAT_B8G8R8A8_UNORM;
-		case PF_FLOAT16_R:
+		case PF_R16F:
 			return DXGI_FORMAT_R16_FLOAT;
-		case PF_FLOAT16_RG:
+		case PF_RG16F:
 			return DXGI_FORMAT_R16G16_FLOAT;
-		case PF_FLOAT16_RGB:
-			return DXGI_FORMAT_UNKNOWN;
-		case PF_FLOAT16_RGBA:
+		case PF_RGBA16F:
 			return DXGI_FORMAT_R16G16B16A16_FLOAT;
-		case PF_FLOAT32_R:
+		case PF_R32F:
 			return DXGI_FORMAT_R32_FLOAT;
-		case PF_FLOAT32_RG:
+		case PF_RG32F:
 			return DXGI_FORMAT_R32G32_FLOAT;
-		case PF_FLOAT32_RGB:
+		case PF_RGB32F:
 			return DXGI_FORMAT_R32G32B32_FLOAT;
-		case PF_FLOAT32_RGBA:
+		case PF_RGBA32F:
 			return DXGI_FORMAT_R32G32B32A32_FLOAT;
+		case PF_R16I:
+			return DXGI_FORMAT_R16_SINT;
+		case PF_RG16I:
+			return DXGI_FORMAT_R16G16_SINT;
+		case PF_RGBA16I:
+			return DXGI_FORMAT_R16G16B16A16_SINT;
+		case PF_R32I:
+			return DXGI_FORMAT_R32_SINT;
+		case PF_RG32I:
+			return DXGI_FORMAT_R32G32_SINT;
+		case PF_RGB32I:
+			return DXGI_FORMAT_R32G32B32_SINT;
+		case PF_RGBA32I:
+			return DXGI_FORMAT_R32G32B32A32_SINT;
+		case PF_R16S:
+			return DXGI_FORMAT_R16_SNORM;
+		case PF_RG16S:
+			return DXGI_FORMAT_R16G16_SNORM;
+		case PF_RGBA16S:
+			return DXGI_FORMAT_R16G16B16A16_SNORM;
+		case PF_R16:
+			return DXGI_FORMAT_R16_UNORM;
+		case PF_RG16:
+			return DXGI_FORMAT_R16G16_UNORM;
+		case PF_RGBA16:
+			return DXGI_FORMAT_R16G16B16A16_UNORM;
 		case PF_BC1:
 		case PF_BC1a:
 			if(gamma)
@@ -663,9 +704,9 @@ namespace bs { namespace ct
 			return DXGI_FORMAT_D32_FLOAT;
 		case PF_D16:
 			return DXGI_FORMAT_D16_UNORM;
-		case PF_FLOAT_R11G11B10:
+		case PF_RG11B10F:
 			return DXGI_FORMAT_R11G11B10_FLOAT;
-		case PF_UNORM_R10G10B10A2:
+		case PF_RGB10A2:
 			return DXGI_FORMAT_R10G10B10A2_UNORM;
 		case PF_UNKNOWN:
 		default:
@@ -765,14 +806,8 @@ namespace bs { namespace ct
 		// Check for formats that are not supported at all by DX11
 		switch(pf)
 		{
-		case PF_R8G8B8:
-			pf = PF_R8G8B8A8;
-			break;
-		case PF_B8G8R8:
-			pf = PF_B8G8R8A8;
-			break;
-		case PF_FLOAT16_RGB:
-			pf = PF_FLOAT16_RGBA;
+		case PF_RGB8:
+			pf = PF_RGBA8;
 			break;
 		default:
 			break;
@@ -783,8 +818,8 @@ namespace bs { namespace ct
 		{
 			switch (pf)
 			{
-			case PF_B8G8R8A8:
-				pf = PF_R8G8B8A8;
+			case PF_BGRA8:
+				pf = PF_RGBA8;
 				break;
 			default:
 				break;

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

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

+ 1 - 1
Source/BansheeEditor/Source/BsScenePicking.cpp

@@ -261,7 +261,7 @@ namespace bs
 		normalTexDesc.type = TEX_TYPE_2D;
 		normalTexDesc.width = outputTextureProperties.getWidth();
 		normalTexDesc.height = outputTextureProperties.getHeight();
-		normalTexDesc.format = PF_R8G8B8A8;
+		normalTexDesc.format = PF_RGBA8;
 		normalTexDesc.usage = TU_RENDERTARGET;
 
 		SPtr<Texture> normalsTexture = Texture::create(normalTexDesc);

+ 4 - 4
Source/BansheeEngine/Source/BsBuiltinResources.cpp

@@ -286,7 +286,7 @@ namespace bs
 		mShaderDiffuse = getShader(ShaderDiffuseFile);
 		mShaderTransparent = getShader(ShaderTransparentFile);
 
-		SPtr<PixelData> dummyPixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> dummyPixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 
 		dummyPixelData->setColorAt(Color::Red, 0, 0);
 		dummyPixelData->setColorAt(Color::Red, 0, 1);
@@ -1118,7 +1118,7 @@ namespace bs
 	{
 		StringStream ss;
 
-		SPtr<PixelData> blackPixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> blackPixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 		blackPixelData->setColorAt(Color::Black, 0, 0);
 		blackPixelData->setColorAt(Color::Black, 0, 1);
 		blackPixelData->setColorAt(Color::Black, 1, 0);
@@ -1126,7 +1126,7 @@ namespace bs
 
 		SPtr<Texture> blackTexture = Texture::_createPtr(blackPixelData);
 
-		SPtr<PixelData> whitePixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> whitePixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 		whitePixelData->setColorAt(Color::White, 0, 0);
 		whitePixelData->setColorAt(Color::White, 0, 1);
 		whitePixelData->setColorAt(Color::White, 1, 0);
@@ -1134,7 +1134,7 @@ namespace bs
 
 		SPtr<Texture> whiteTexture = Texture::_createPtr(whitePixelData);
 
-		SPtr<PixelData> normalPixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> normalPixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 
 		Color encodedNormal(0.5f, 0.5f, 1.0f);
 		normalPixelData->setColorAt(encodedNormal, 0, 0);

+ 2 - 2
Source/BansheeFontImporter/Source/BsFontImporter.cpp

@@ -184,7 +184,7 @@ namespace bs
 				UINT32 bufferSize = pageIter->width * pageIter->height * 2;
 
 				// TODO - I don't actually need a 2 channel texture
-				SPtr<PixelData> pixelData = bs_shared_ptr_new<PixelData>(pageIter->width, pageIter->height, 1, PF_R8G8);
+				SPtr<PixelData> pixelData = bs_shared_ptr_new<PixelData>(pageIter->width, pageIter->height, 1, PF_RG8);
 
 				pixelData->allocateInternalBuffer();
 				UINT8* pixelBuffer = pixelData->getData();
@@ -325,7 +325,7 @@ namespace bs
 				TEXTURE_DESC texDesc;
 				texDesc.width = pageIter->width;
 				texDesc.height = pageIter->height;
-				texDesc.format = PF_R8G8;
+				texDesc.format = PF_RG8;
 
 				HTexture newTex = Texture::create(texDesc);
 

+ 41 - 13
Source/BansheeFreeImgImporter/Source/BsFreeImgImporter.cpp

@@ -270,6 +270,7 @@ namespace bs
 		FREE_IMAGE_TYPE imageType = FreeImage_GetImageType(fiBitmap);
 		FREE_IMAGE_COLOR_TYPE colourType = FreeImage_GetColorType(fiBitmap);
 		unsigned bpp = FreeImage_GetBPP(fiBitmap);
+		unsigned srcElemSize = 0;
 
 		switch(imageType)
 		{
@@ -312,6 +313,7 @@ namespace bs
 			{
 			case 8:
 				format = PF_R8;
+				srcElemSize = 1;
 				break;
 			case 16:
 				// Determine 555 or 565 from green mask
@@ -327,23 +329,26 @@ namespace bs
 					return nullptr;
 					// FreeImage doesn't support 4444 format so must be 1555
 				}
+				srcElemSize = 2;
 				break;
 			case 24:
 				// FreeImage differs per platform
 				//     PF_BYTE_BGR[A] for little endian (== PF_ARGB native)
 				//     PF_BYTE_RGB[A] for big endian (== PF_RGBA native)
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-				format = PF_R8G8B8;
+				format = PF_RGB8;
 #else
-				format = PF_B8G8R8;
+				format = PF_BGR8;
 #endif
+				srcElemSize = 3;
 				break;
 			case 32:
 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-				format = PF_R8G8B8A8;
+				format = PF_RGBA8;
 #else
-				format = PF_B8G8R8A8;
+				format = PF_BGRA8;
 #endif
+				srcElemSize = 4;
 				break;
 
 
@@ -357,19 +362,24 @@ namespace bs
 			break;
 		case FIT_FLOAT:
 			// Single-component floating point data
-			format = PF_FLOAT32_R;
+			format = PF_R32F;
+			srcElemSize = 4;
 			break;
 		case FIT_RGB16:
-			format = PF_FLOAT16_RGB;
+			format = PF_RGBA16F;
+			srcElemSize = 2 * 3;
 			break;
 		case FIT_RGBA16:
-			format = PF_FLOAT16_RGBA;
+			format = PF_RGBA16F;
+			srcElemSize = 2 * 4;
 			break;
 		case FIT_RGBF:
-			format = PF_FLOAT32_RGB;
+			format = PF_RGB32F;
+			srcElemSize = 4 * 3;
 			break;
 		case FIT_RGBAF:
-			format = PF_FLOAT32_RGBA;
+			format = PF_RGBA32F;
+			srcElemSize = 4 * 4;
 			break;
 		};
 
@@ -377,6 +387,7 @@ namespace bs
 		unsigned srcPitch = FreeImage_GetPitch(fiBitmap);
 
 		// Final data - invert image and trim pitch at the same time
+		UINT32 dstElemSize = PixelUtil::getNumElemBytes(format);
 		UINT32 dstPitch = width * PixelUtil::getNumElemBytes(format);
 
 		// Bind output buffer
@@ -386,11 +397,28 @@ namespace bs
 
 		UINT8* pSrc;
 		UINT8* pDst = output;
-		for (UINT32 y = 0; y < height; ++y)
+
+		// Copy row by row, which is faster
+		if (srcElemSize == dstElemSize)
+		{
+			for (UINT32 y = 0; y < height; ++y)
+			{
+				pSrc = srcData + (height - y - 1) * srcPitch;
+				memcpy(pDst, pSrc, dstPitch);
+				pDst += dstPitch;
+			}
+		}
+		else
 		{
-			pSrc = srcData + (height - y - 1) * srcPitch;
-			memcpy(pDst, pSrc, dstPitch);
-			pDst += dstPitch;
+			for (UINT32 y = 0; y < height; ++y)
+			{
+				pSrc = srcData + (height - y - 1) * srcPitch;
+
+				for(UINT32 x = 0; x < width; ++x)
+					memcpy(pDst + x * dstElemSize, pSrc + x * srcElemSize, srcElemSize);
+
+				pDst += dstPitch;
+			}
 		}
 
 		FreeImage_Unload(fiBitmap);

+ 235 - 160
Source/BansheeGLRenderAPI/Source/BsGLPixelFormat.cpp

@@ -17,167 +17,242 @@ namespace bs { namespace ct
 		return pf;
 	}
 
-    GLenum GLPixelUtil::getGLOriginFormat(PixelFormat mFormat)
-    {
-        switch(mFormat)
-        {
-			case PF_R8:
-				return GL_RED;
-			case PF_R8G8:
-				return GL_RG;
-            case PF_R8G8B8:
-                return GL_RGB;
-            case PF_B8G8R8:
-                return GL_BGR;
-			case PF_R8G8B8A8:
-                return GL_RGBA;
-            case PF_B8G8R8A8:
-                return GL_BGRA;
-			case PF_FLOAT16_R:
-                return GL_RED;
-			case PF_FLOAT16_RG:
-				return GL_RG;
-            case PF_FLOAT16_RGB:
-                return GL_RGB;
-            case PF_FLOAT16_RGBA:
-                return GL_RGBA;
-			case PF_FLOAT32_R:
-                return GL_RED;
-			case PF_FLOAT32_RG:
-				return GL_RG;
-            case PF_FLOAT32_RGB:
-                return GL_RGB;
-            case PF_FLOAT32_RGBA:
-                return GL_RGBA;
-			case PF_FLOAT_R11G11B10:
-				return GL_RGB;
-			case PF_UNORM_R10G10B10A2:
-				return GL_RGBA;
-            case PF_BC1:
-            case PF_BC1a:
-            case PF_BC3:
-			case PF_BC7:
-				return GL_RGBA;
-			case PF_BC4:
-				return GL_RED;
-			case PF_BC5:
-				return GL_RG;
-			case PF_BC6H:
-				return GL_RGB;
-            default:
-                return 0;
-        }
-    }
+	GLenum GLPixelUtil::getGLOriginFormat(PixelFormat mFormat)
+	{
+		switch (mFormat)
+		{
+		case PF_R8:
+		case PF_R8I:
+		case PF_R8S:
+			return GL_RED;
+		case PF_RG8:
+		case PF_RG8I:
+		case PF_RG8S:
+			return GL_RG;
+		case PF_RGB8:
+			return GL_RGB;
+		case PF_BGR8:
+			return GL_BGR;
+		case PF_RGBA8:
+		case PF_RGBA8I:
+		case PF_RGBA8S:
+			return GL_RGBA;
+		case PF_BGRA8:
+			return GL_BGRA;
+		case PF_R16F:
+		case PF_R16I:
+		case PF_R16S:
+		case PF_R16:
+			return GL_RED;
+		case PF_RG16F:
+		case PF_RG16I:
+		case PF_RG16S:
+		case PF_RG16:
+			return GL_RG;
+		case PF_RGBA16F:
+		case PF_RGBA16I:
+		case PF_RGBA16S:
+		case PF_RGBA16:
+			return GL_RGBA;
+		case PF_R32F:
+		case PF_R32I:
+			return GL_RED;
+		case PF_RG32F:
+		case PF_RG32I:
+			return GL_RG;
+		case PF_RGB32F:
+		case PF_RGB32I:
+			return GL_RGB;
+		case PF_RGBA32F:
+		case PF_RGBA32I:
+			return GL_RGBA;
+		case PF_RG11B10F:
+			return GL_RGB;
+		case PF_RGB10A2:
+			return GL_RGBA;
+		case PF_BC1:
+		case PF_BC1a:
+		case PF_BC3:
+		case PF_BC7:
+			return GL_RGBA;
+		case PF_BC4:
+			return GL_RED;
+		case PF_BC5:
+			return GL_RG;
+		case PF_BC6H:
+			return GL_RGB;
+		default:
+			return 0;
+		}
+	}
 
-    GLenum GLPixelUtil::getGLOriginDataType(PixelFormat format)
-    {
-        switch(format)
-        {
-			case PF_R8:
-            case PF_R8G8B8:
-            case PF_B8G8R8:
-			case PF_R8G8:
-				return GL_UNSIGNED_BYTE;
-            case PF_B8G8R8A8:
-			case PF_R8G8B8A8:
-				return GL_UNSIGNED_INT_8_8_8_8_REV;
-			case PF_FLOAT16_R:
-			case PF_FLOAT16_RG:
-            case PF_FLOAT16_RGB:
-            case PF_FLOAT16_RGBA:
-                return GL_HALF_FLOAT;
-			case PF_FLOAT32_R:
-			case PF_FLOAT32_RG:
-            case PF_FLOAT32_RGB:
-            case PF_FLOAT32_RGBA:
-                return GL_FLOAT;
-			case PF_FLOAT_R11G11B10:
-				return GL_UNSIGNED_INT_10F_11F_11F_REV;
-			case PF_UNORM_R10G10B10A2:
-				return GL_UNSIGNED_INT_2_10_10_10_REV;
-            default:
-                return 0;
-        }
-    }
-    
-    GLenum GLPixelUtil::getGLInternalFormat(PixelFormat mFormat, bool hwGamma)
-    {
-        switch(mFormat) {
-            case PF_R8:
-                return GL_R8;
-			case PF_R8G8:
-				return GL_RG8;
-            case PF_R8G8B8:
-            case PF_B8G8R8:
-				if (hwGamma)
-					return GL_SRGB8;
-				else
-					return GL_RGB8;
-            case PF_B8G8R8A8:
-			case PF_R8G8B8A8:
-				if (hwGamma)
-					return GL_SRGB8_ALPHA8;
-				else
-					return GL_RGBA8;
-			case PF_FLOAT16_R:
-				return GL_R16F;
-            case PF_FLOAT16_RGB:
-                return GL_RGB16F;
-			case PF_FLOAT16_RG: 
-				return GL_RG16F;
-            case PF_FLOAT16_RGBA:
-                return GL_RGBA16F;
-			case PF_FLOAT32_R:
-				return GL_R32F;
-			case PF_FLOAT32_RG:
-				return GL_RG32F;
-            case PF_FLOAT32_RGB:
-                return GL_RGB32F;
-            case PF_FLOAT32_RGBA:
-                return GL_RGBA32F;
-			case PF_BC1a:
-			case PF_BC1:
-				if (hwGamma)
-					return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
-				else
-					return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
-            case PF_BC2:
-				if (hwGamma)
-					return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
-				else
-	                return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
-            case PF_BC3:
-				if (hwGamma)
-					return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
-				else
-	                return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-			case PF_BC4:
-				return GL_COMPRESSED_RED_RGTC1;
-			case PF_BC5:
-				return GL_COMPRESSED_RG_RGTC2;
-			case PF_BC6H:
-				return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT;
-			case PF_BC7:
-				if (hwGamma)
-					return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
-				else
-					return GL_COMPRESSED_RGBA_BPTC_UNORM;
-			case PF_D16:
-				return GL_DEPTH_COMPONENT16;
-			case PF_D32:
-				return GL_DEPTH_COMPONENT32F;
-			case PF_D24S8:
-				return GL_DEPTH24_STENCIL8;
-			case PF_D32_S8X24:
-				return GL_DEPTH32F_STENCIL8;
-			case PF_FLOAT_R11G11B10:
-				return GL_R11F_G11F_B10F;
-			case PF_UNORM_R10G10B10A2:
-				return GL_RGB10_A2;
-            default:
-                return GL_NONE;
-        }
-    }
+	GLenum GLPixelUtil::getGLOriginDataType(PixelFormat format)
+	{
+		switch (format)
+		{
+		case PF_R8:
+		case PF_RG8:
+		case PF_RGB8:
+		case PF_BGR8:
+			return GL_UNSIGNED_BYTE;
+		case PF_BGRA8:
+		case PF_RGBA8:
+			return GL_UNSIGNED_INT_8_8_8_8_REV;
+		case PF_R8I:
+		case PF_RG8I:
+		case PF_RGBA8I:
+		case PF_R8S:
+		case PF_RG8S:
+		case PF_RGBA8S:
+			return GL_BYTE;
+		case PF_R16I:
+		case PF_RG16I:
+		case PF_RGBA16I:
+		case PF_R16S:
+		case PF_RG16S:
+		case PF_RGBA16S:
+			return GL_SHORT;
+		case PF_R16:
+		case PF_RG16:
+		case PF_RGBA16:
+			return GL_UNSIGNED_SHORT;
+		case PF_R16F:
+		case PF_RG16F:
+		case PF_RGBA16F:
+			return GL_HALF_FLOAT;
+		case PF_R32I:
+		case PF_RG32I:
+		case PF_RGB32I:
+		case PF_RGBA32I:
+			return GL_INT;
+		case PF_R32F:
+		case PF_RG32F:
+		case PF_RGB32F:
+		case PF_RGBA32F:
+			return GL_FLOAT;
+		case PF_RG11B10F:
+			return GL_UNSIGNED_INT_10F_11F_11F_REV;
+		case PF_RGB10A2:
+			return GL_UNSIGNED_INT_2_10_10_10_REV;
+		default:
+			return 0;
+		}
+	}
+
+	GLenum GLPixelUtil::getGLInternalFormat(PixelFormat mFormat, bool hwGamma)
+	{
+		switch (mFormat) {
+		case PF_R8:
+			return GL_R8;
+		case PF_R8I:
+			return GL_R8I;
+		case PF_R8S:
+			return GL_R8_SNORM;
+		case PF_RG8:
+			return GL_RG8;
+		case PF_RG8I:
+			return GL_RG8I;
+		case PF_RG8S:
+			return GL_RG8_SNORM;
+		case PF_RGB8:
+		case PF_BGR8:
+			if (hwGamma)
+				return GL_SRGB8;
+			else
+				return GL_RGB8;
+		case PF_BGRA8:
+		case PF_RGBA8:
+			if (hwGamma)
+				return GL_SRGB8_ALPHA8;
+			else
+				return GL_RGBA8;
+		case PF_RGBA8I:
+			return GL_RGBA8I;
+		case PF_RGBA8S:
+			return GL_RGBA8_SNORM;
+		case PF_R16F:
+			return GL_R16F;
+		case PF_R16I:
+			return GL_R16I;
+		case PF_R16S:
+			return GL_R16_SNORM;
+		case PF_R16:
+			return GL_R16;
+		case PF_RG16F:
+			return GL_RG16F;
+		case PF_RG16I:
+			return GL_RG16I;
+		case PF_RG16S:
+			return GL_RG16_SNORM;
+		case PF_RG16:
+			return GL_RG16;
+		case PF_RGBA16F:
+			return GL_RGBA16F;
+		case PF_RGBA16I:
+			return GL_RGBA16I;
+		case PF_RGBA16S:
+			return GL_RGBA16_SNORM;
+		case PF_RGBA16:
+			return GL_RGBA16;
+		case PF_R32F:
+			return GL_R32F;
+		case PF_R32I:
+			return GL_R32I;
+		case PF_RG32F:
+			return GL_RG32F;
+		case PF_RG32I:
+			return GL_RG32I;
+		case PF_RGB32F:
+			return GL_RGB32F;
+		case PF_RGB32I:
+			return GL_RGB32I;
+		case PF_RGBA32F:
+			return GL_RGBA32F;
+		case PF_RGBA32I:
+			return GL_RGBA32I;
+		case PF_BC1a:
+		case PF_BC1:
+			if (hwGamma)
+				return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
+			else
+				return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+		case PF_BC2:
+			if (hwGamma)
+				return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
+			else
+				return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
+		case PF_BC3:
+			if (hwGamma)
+				return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
+			else
+				return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
+		case PF_BC4:
+			return GL_COMPRESSED_RED_RGTC1;
+		case PF_BC5:
+			return GL_COMPRESSED_RG_RGTC2;
+		case PF_BC6H:
+			return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT;
+		case PF_BC7:
+			if (hwGamma)
+				return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
+			else
+				return GL_COMPRESSED_RGBA_BPTC_UNORM;
+		case PF_D16:
+			return GL_DEPTH_COMPONENT16;
+		case PF_D32:
+			return GL_DEPTH_COMPONENT32F;
+		case PF_D24S8:
+			return GL_DEPTH24_STENCIL8;
+		case PF_D32_S8X24:
+			return GL_DEPTH32F_STENCIL8;
+		case PF_RG11B10F:
+			return GL_R11F_G11F_B10F;
+		case PF_RGB10A2:
+			return GL_RGB10_A2;
+		default:
+			return GL_NONE;
+		}
+	}
 
 	GLenum GLPixelUtil::getDepthStencilTypeFromPF(PixelFormat mFormat)
 	{

+ 4 - 4
Source/BansheeGLRenderAPI/Source/BsGLRenderTexture.cpp

@@ -364,9 +364,9 @@ namespace bs
         PixelComponentType pct = PixelUtil::getElementType(format);
         switch(pct)
         {
-        case PCT_BYTE: format = PF_R8G8B8A8; break;
-        case PCT_FLOAT16: format = PF_FLOAT16_RGBA; break;
-        case PCT_FLOAT32: format = PF_FLOAT32_RGBA; break;
+        case PCT_BYTE: format = PF_RGBA8; break;
+        case PCT_FLOAT16: format = PF_RGBA16F; break;
+        case PCT_FLOAT32: format = PF_RGBA32F; break;
         default: break;
         }
 
@@ -374,7 +374,7 @@ namespace bs
             return format;
 
         // If none at all, return to default
-        return PF_R8G8B8A8;
+        return PF_RGBA8;
     }
 	}
 }

+ 1 - 1
Source/BansheeSL/Source/BsSLFXCompiler.cpp

@@ -1547,7 +1547,6 @@ namespace bs
 			return true;
 		};
 
-
 		// Actually parse techniques
 		for (auto& entry : techniqueData)
 		{
@@ -1559,6 +1558,7 @@ namespace bs
 			if (!parseInherited(metaData, entry.second))
 			{
 				parseStateDelete(parseState);
+				bs_stack_free(techniqueWasParsed);
 				return output;
 			}
 

+ 20 - 5
Source/BansheeUtility/Include/BsBitwise.h

@@ -168,22 +168,37 @@ namespace bs
 		}
 
 		/** 
-		 * Convert floating point color channel value between 0.0 and 1.0 (otherwise clamped) to integer of a certain 
-		 * number of bits. Works for any value of bits between 0 and 31.
+		 * Converts floating point value in range [0, 1] to an unsigned integer of a certain number of bits. Works for any
+		 * value of bits between 0 and 31.
 		 */
-		static unsigned int floatToFixed(const float value, const unsigned int bits)
+		static unsigned int unormToUint(float value, unsigned int bits)
 		{
 			if (value <= 0.0f) return 0;
 			else if (value >= 1.0f) return (1 << bits) - 1;
 			else return (unsigned int)(value * (1 << bits));
 		}
 
-		/** Fixed point to float. */
-		static float fixedToFloat(unsigned value, unsigned int bits)
+		/** 
+		 * Converts floating point value in range [-1, 1] to an unsigned integer of a certain number of bits. Works for any
+		 * value of bits between 0 and 31.
+		 */
+		static unsigned int snormToUint(float value, unsigned int bits)
+		{
+			return unormToUint((value + 1.0f) * 0.5f, bits);
+		}
+
+		/** Converts an unsigned integer to a floating point in range [0, 1]. */
+		static float uintToUnorm(unsigned value, unsigned int bits)
 		{
 			return (float)value / (float)((1 << bits) - 1);
 		}
 
+		/** Converts an unsigned integer to a floating point in range [-1, 1]. */
+		static float uintToSnorm(unsigned value, unsigned int bits)
+		{
+			return uintToUnorm(value, bits) * 2.0f - 1.0f;
+		}
+
 		/** Write a n*8 bits integer value to memory in native endian. */
 		static void intWrite(void *dest, const int n, const unsigned int value)
 		{

+ 3 - 3
Source/BansheeVulkanRenderAPI/Source/BsVulkanTextureManager.cpp

@@ -40,7 +40,7 @@ namespace bs
 		PixelUtil::checkFormat(format, ttype, usage);
 
 		if (ct::VulkanUtility::getPixelFormat(format, hwGamma) == VK_FORMAT_UNDEFINED)
-			return PF_R8G8B8A8;
+			return PF_RGBA8;
 
 		return format;
 	}
@@ -54,7 +54,7 @@ namespace bs
 		int idx = 0;
 		for(auto& entry : DummyTexTypes)
 		{
-			SPtr<PixelData> pixelData = PixelData::create(entry.width, entry.height, entry.depth, PF_R8G8B8A8);
+			SPtr<PixelData> pixelData = PixelData::create(entry.width, entry.height, entry.depth, PF_RGBA8);
 
 			for(int depth = 0; depth < entry.depth; depth++)
 				for(int height = 0; height < entry.height; height++)
@@ -66,7 +66,7 @@ namespace bs
 			desc.width = entry.width;
 			desc.height = entry.height;
 			desc.depth = entry.depth;
-			desc.format = PF_R8G8B8A8;
+			desc.format = PF_RGBA8;
 			desc.usage = TU_STATIC;
 
 			mDummyReadTextures[idx] = std::static_pointer_cast<VulkanTexture>(createTexture(desc));

+ 54 - 18
Source/BansheeVulkanRenderAPI/Source/BsVulkanUtility.cpp

@@ -64,11 +64,11 @@ namespace bs { namespace ct
 				PixelUtil::getBitDepths(format, bitDepths);
 
 				if (bitDepths[0] == 16) // 16-bit format, fall back to 4-channel 16-bit, guaranteed to be supported
-					format = PF_FLOAT16_RGBA;
+					format = PF_RGBA16F;
 				else if(format == PF_BC6H) // Fall back to uncompressed alternative
-					format = PF_FLOAT16_RGBA;
+					format = PF_RGBA16F;
 				else // Must be 8-bit per channel format, compressed format or some uneven format
-					format = PF_R8G8B8A8;
+					format = PF_RGBA8;
 			}
 		}
 
@@ -84,42 +84,78 @@ namespace bs { namespace ct
 				return VK_FORMAT_R8_SRGB;
 
 			return VK_FORMAT_R8_UNORM;
-		case PF_R8G8:
+		case PF_RG8:
 			if (sRGB)
 				return VK_FORMAT_R8G8_SRGB;
 
 			return VK_FORMAT_R8G8_UNORM;
-		case PF_R8G8B8:
+		case PF_RGB8:
 			if (sRGB)
 				return VK_FORMAT_R8G8B8_SRGB;
 
 			return VK_FORMAT_R8G8B8_UNORM;
-		case PF_R8G8B8A8:
+		case PF_RGBA8:
 			if (sRGB)
 				return VK_FORMAT_R8G8B8A8_SRGB;
 
 			return VK_FORMAT_R8G8B8A8_UNORM;
-		case PF_B8G8R8A8:
+		case PF_BGRA8:
 			if (sRGB)
 				return VK_FORMAT_B8G8R8A8_SRGB;
 
 			return VK_FORMAT_B8G8R8A8_UNORM;
-		case PF_FLOAT16_R:
+		case PF_R8I:
+			return VK_FORMAT_R8_SINT;
+		case PF_RG8I:
+			return VK_FORMAT_R8G8_SINT;
+		case PF_RGBA8I:
+			return VK_FORMAT_R8G8B8A8_SINT;
+		case PF_R8S:
+			return VK_FORMAT_R8_SNORM;
+		case PF_RG8S:
+			return VK_FORMAT_R8G8_SNORM;
+		case PF_RGBA8S:
+			return VK_FORMAT_R8G8B8A8_SNORM;
+		case PF_R16F:
 			return VK_FORMAT_R16_SFLOAT;
-		case PF_FLOAT16_RG:
+		case PF_RG16F:
 			return VK_FORMAT_R16G16_SFLOAT;
-		case PF_FLOAT16_RGB:
-			return VK_FORMAT_R16G16B16_SFLOAT;
-		case PF_FLOAT16_RGBA:
+		case PF_RGBA16F:
 			return VK_FORMAT_R16G16B16A16_SFLOAT;
-		case PF_FLOAT32_R:
+		case PF_R32F:
 			return VK_FORMAT_R32_SFLOAT;
-		case PF_FLOAT32_RG:
+		case PF_RG32F:
 			return VK_FORMAT_R32G32_SFLOAT;
-		case PF_FLOAT32_RGB:
+		case PF_RGB32F:
 			return VK_FORMAT_R32G32B32_SFLOAT;
-		case PF_FLOAT32_RGBA:
+		case PF_RGBA32F:
 			return VK_FORMAT_R32G32B32A32_SFLOAT;
+		case PF_R16I:
+			return VK_FORMAT_R16_SINT;
+		case PF_RG16I:
+			return VK_FORMAT_R16G16_SINT;
+		case PF_RGBA16I:
+			return VK_FORMAT_R16G16B16A16_SINT;
+		case PF_R32I:
+			return VK_FORMAT_R32_SINT;
+		case PF_RG32I:
+			return VK_FORMAT_R32G32_SINT;
+		case PF_RGB32I:
+			return VK_FORMAT_R32G32B32_SINT;
+		case PF_RGBA32I:
+			return VK_FORMAT_R32G32B32A32_SINT;
+		case PF_R16S:
+			return VK_FORMAT_R16_SNORM;
+		case PF_RG16S:
+			return VK_FORMAT_R16G16_SNORM;
+		case PF_RGBA16S:
+			return VK_FORMAT_R16G16B16A16_SNORM;
+		case PF_R16:
+			return VK_FORMAT_R16_UNORM;
+		case PF_RG16:
+			return VK_FORMAT_R16G16_UNORM;
+		case PF_RGBA16:
+			return VK_FORMAT_R16G16B16A16_UNORM;
 		case PF_BC1:
 		case PF_BC1a:
 			if (sRGB)
@@ -155,9 +191,9 @@ namespace bs { namespace ct
 			return VK_FORMAT_D32_SFLOAT;
 		case PF_D16:
 			return VK_FORMAT_D16_UNORM;
-		case PF_FLOAT_R11G11B10:
+		case PF_RG11B10F:
 			return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
-		case PF_UNORM_R10G10B10A2:
+		case PF_RGB10A2:
 			return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
 		case PF_UNKNOWN:
 		default:

+ 2 - 2
Source/Examples/ExampleLowLevelRendering/Source/Main.cpp

@@ -247,7 +247,7 @@ namespace bs { namespace ct
 		gIndexBuffer->unlock();
 
 		// Create a simple 2x2 checkerboard texture to map to the object we're about to render
-		SPtr<PixelData> pixelData = PixelData::create(2, 2, 1, PF_R8G8B8A8);
+		SPtr<PixelData> pixelData = PixelData::create(2, 2, 1, PF_RGBA8);
 		pixelData->setColorAt(Color::White, 0, 0);
 		pixelData->setColorAt(Color::Black, 1, 0);
 		pixelData->setColorAt(Color::White, 1, 1);
@@ -266,7 +266,7 @@ namespace bs { namespace ct
 		TEXTURE_DESC colorAttDesc;
 		colorAttDesc.width = windowResWidth;
 		colorAttDesc.height = windowResHeight;
-		colorAttDesc.format = PF_R8G8B8A8;
+		colorAttDesc.format = PF_RGBA8;
 		colorAttDesc.usage = TU_RENDERTARGET;
 
 		SPtr<Texture> colorAtt = Texture::create(colorAttDesc);

+ 1 - 1
Source/Examples/ExamplePhysicallyBasedShading/Source/Main.cpp

@@ -240,7 +240,7 @@ namespace bs
 
                 // Importing using a HDR format if requested
                 if (isHDR)
-                    importOptions->setFormat(PF_FLOAT_R11G11B10);
+                    importOptions->setFormat(PF_RG11B10F);
 			}
 
 			// Import texture with specified import options

+ 1 - 1
Source/MBansheeEditor/Windows/GameWindow.cs

@@ -181,7 +181,7 @@ namespace BansheeEditor
                 }
             }
 
-            RenderTexture2D renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, rtWidth, rtHeight) { Priority = 1};
+            RenderTexture2D renderTexture = new RenderTexture2D(PixelFormat.RGBA8, rtWidth, rtHeight) { Priority = 1};
 
             EditorApplication.MainRenderTarget = renderTexture;
             renderTextureGUI.RenderTexture = renderTexture;

+ 1 - 1
Source/MBansheeEditor/Windows/Scene/SceneAxesGUI.cs

@@ -40,7 +40,7 @@ namespace BansheeEditor
         /// <param name="projType">Projection type to display on the GUI.</param>
         public SceneAxesGUI(SceneWindow window, GUIPanel panel, int width, int height, ProjectionType projType)
         {
-            renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, width, height);
+            renderTexture = new RenderTexture2D(PixelFormat.RGBA8, width, height);
             renderTexture.Priority = 1;
 
             SceneObject cameraSO = new SceneObject("SceneAxesCamera", true);

+ 1 - 1
Source/MBansheeEditor/Windows/Scene/SceneWindow.cs

@@ -854,7 +854,7 @@ namespace BansheeEditor
             height = MathEx.Max(20, height);
 
             // Note: Depth buffer and readable flags are required because ScenePicking uses it
-            Texture colorTex = Texture.Create2D(width, height, PixelFormat.R8G8B8A8, TextureUsage.Render | TextureUsage.CPUReadable);
+            Texture colorTex = Texture.Create2D(width, height, PixelFormat.RGBA8, TextureUsage.Render | TextureUsage.CPUReadable);
             Texture depthTex = Texture.Create2D(width, height, PixelFormat.D32_S8X24, TextureUsage.DepthStencil | TextureUsage.CPUReadable);
 
             renderTexture = new RenderTexture2D(colorTex, depthTex);

+ 3 - 3
Source/MBansheeEngine/Rendering/Texture.cs

@@ -24,7 +24,7 @@ namespace BansheeEngine
         /// <param name="gammaCorrection">If true the texture data is assumed to have be gamma corrected and will be
         ///                               converted back to linear space when sampled on GPU, and converted to gamma space
         ///                               before being written by the GPU.</param>
-        public static Texture Create2D(int width, int height, PixelFormat format = PixelFormat.R8G8B8A8, 
+        public static Texture Create2D(int width, int height, PixelFormat format = PixelFormat.RGBA8, 
             TextureUsage usage = TextureUsage.Default, int numSamples = 1, bool hasMipmaps = false, 
             bool gammaCorrection = false)
         {
@@ -45,7 +45,7 @@ namespace BansheeEngine
         /// <param name="usage">Describes planned texture use.</param>
         /// <param name="hasMipmaps">Should the texture allocate memory for the entire mip-map chain or only the top level.
         ///                          </param>
-        public static Texture Create3D(int width, int height, int depth, PixelFormat format = PixelFormat.R8G8B8A8,
+        public static Texture Create3D(int width, int height, int depth, PixelFormat format = PixelFormat.RGBA8,
             TextureUsage usage = TextureUsage.Default, bool hasMipmaps = false)
         {
             Texture texture = new Texture(true);
@@ -66,7 +66,7 @@ namespace BansheeEngine
         /// <param name="gammaCorrection">If true the texture data is assumed to have be gamma corrected and will be
         ///                               converted back to linear space when sampled on GPU, and converted to gamma space
         ///                               before being written by the GPU.</param>
-        public static Texture CreateCube(int size, PixelFormat format = PixelFormat.R8G8B8A8,
+        public static Texture CreateCube(int size, PixelFormat format = PixelFormat.RGBA8,
             TextureUsage usage = TextureUsage.Default, bool hasMipmaps = false, bool gammaCorrection = false)
         {
             Texture texture = new Texture(true);

+ 1 - 1
Source/RenderBeast/Source/BsLightProbes.cpp

@@ -200,7 +200,7 @@ namespace bs { namespace ct
 				for(UINT32 i = 0; i < 4; ++i)
 				{
 					// Check for outer vertices, which have no SH data associated with them
-					if (entry.volume.vertices[i] >= innerVertexCount)
+					if (entry.volume.vertices[i] >= (INT32)innerVertexCount)
 						entry.volume.vertices[i] = -1;
 					else
 						entry.volume.vertices[i] = mTempTetrahedronBufferIndices[i];

+ 4 - 4
Source/RenderBeast/Source/BsPostProcessing.cpp

@@ -175,7 +175,7 @@ namespace bs { namespace ct
 		Vector2I threadGroupCount = getThreadGroupCount(target);
 		UINT32 numHistograms = threadGroupCount.x * threadGroupCount.y;
 
-		return POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, HISTOGRAM_NUM_TEXELS, numHistograms,
+		return POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA16F, HISTOGRAM_NUM_TEXELS, numHistograms,
 			TU_LOADSTORE);
 	}
 
@@ -252,7 +252,7 @@ namespace bs { namespace ct
 
 	POOLED_RENDER_TEXTURE_DESC EyeAdaptHistogramReduceMat::getOutputDesc()
 	{
-		return POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, EyeAdaptHistogramMat::HISTOGRAM_NUM_TEXELS, 2,
+		return POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA16F, EyeAdaptHistogramMat::HISTOGRAM_NUM_TEXELS, 2,
 			TU_RENDERTARGET);
 	}
 
@@ -321,7 +321,7 @@ namespace bs { namespace ct
 
 	POOLED_RENDER_TEXTURE_DESC EyeAdaptationMat::getOutputDesc()
 	{
-		return POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT32_R, 1, 1, TU_RENDERTARGET);
+		return POOLED_RENDER_TEXTURE_DESC::create2D(PF_R32F, 1, 1, TU_RENDERTARGET);
 	}
 
 	CreateTonemapLUTParamDef gCreateTonemapLUTParamDef;
@@ -393,7 +393,7 @@ namespace bs { namespace ct
 
 	POOLED_RENDER_TEXTURE_DESC CreateTonemapLUTMat::getOutputDesc()
 	{
-		return POOLED_RENDER_TEXTURE_DESC::create3D(PF_R8G8B8A8, LUT_SIZE, LUT_SIZE, LUT_SIZE, TU_LOADSTORE);
+		return POOLED_RENDER_TEXTURE_DESC::create3D(PF_RGBA8, LUT_SIZE, LUT_SIZE, LUT_SIZE, TU_LOADSTORE);
 	}
 
 	TonemappingParamDef gTonemappingParamDef;

+ 1 - 1
Source/RenderBeast/Source/BsRenderBeast.cpp

@@ -467,7 +467,7 @@ namespace bs { namespace ct
 			{
 				TEXTURE_DESC cubeMapDesc;
 				cubeMapDesc.type = TEX_TYPE_CUBE_MAP;
-				cubeMapDesc.format = PF_FLOAT_R11G11B10;
+				cubeMapDesc.format = PF_RG11B10F;
 				cubeMapDesc.width = IBLUtility::REFLECTION_CUBEMAP_SIZE;
 				cubeMapDesc.height = IBLUtility::REFLECTION_CUBEMAP_SIZE;
 				cubeMapDesc.numMips = PixelUtil::getMaxMipmaps(cubeMapDesc.width, cubeMapDesc.height, 1, cubeMapDesc.format);

+ 10 - 10
Source/RenderBeast/Source/BsRenderCompositor.cpp

@@ -210,11 +210,11 @@ namespace bs { namespace ct
 		UINT32 numSamples = viewProps.numSamples;
 
 		// Note: Consider customizable formats. e.g. for testing if quality can be improved with higher precision normals.
-		albedoTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_R8G8B8A8, width, height, TU_RENDERTARGET,
+		albedoTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA8, width, height, TU_RENDERTARGET,
 			numSamples, true));
-		normalTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_UNORM_R10G10B10A2, width, height, TU_RENDERTARGET,
+		normalTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGB10A2, width, height, TU_RENDERTARGET,
 			numSamples, false));
-		roughMetalTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RG, width, height, TU_RENDERTARGET,
+		roughMetalTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_RG16F, width, height, TU_RENDERTARGET,
 			numSamples, false)); // Note: Metal doesn't need 16-bit float
 
 		RCNodeSceneDepth* sceneDepthNode = static_cast<RCNodeSceneDepth*>(inputs.inputNodes[0]);
@@ -359,7 +359,7 @@ namespace bs { namespace ct
 		UINT32 numSamples = viewProps.numSamples;
 
 		// Note: Consider customizable HDR format via options? e.g. smaller PF_FLOAT_R11G11B10 or larger 32-bit format
-		sceneColorTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, width, height, TU_RENDERTARGET | 
+		sceneColorTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA16F, width, height, TU_RENDERTARGET | 
 			TU_LOADSTORE, numSamples, false));
 
 		RCNodeSceneDepth* sceneDepthNode = static_cast<RCNodeSceneDepth*>(inputs.inputNodes[0]);
@@ -441,7 +441,7 @@ namespace bs { namespace ct
 		else
 			flattenedLightAccumBuffer = nullptr;
 
-		lightAccumulationTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, width,
+		lightAccumulationTex = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA16F, width,
 			height, TU_LOADSTORE | TU_RENDERTARGET, numSamples, false));
 
 		bool rebuildRT;
@@ -955,7 +955,7 @@ namespace bs { namespace ct
 
 		if(!mAllocated[mCurrentIdx])
 		{
-			mOutput[mCurrentIdx] = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_R8G8B8A8, width, height,
+			mOutput[mCurrentIdx] = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA8, width, height,
 					TU_RENDERTARGET, 1, false));
 
 			mAllocated[mCurrentIdx] = true;
@@ -1319,13 +1319,13 @@ namespace bs { namespace ct
 		UINT32 height = viewProps.viewRect.height;
 
 		UINT32 size = Bitwise::nextPow2(std::max(width, height));
-		UINT32 numMips = PixelUtil::getMaxMipmaps(size, size, 1, PF_FLOAT32_R);
+		UINT32 numMips = PixelUtil::getMaxMipmaps(size, size, 1, PF_R32F);
 		size = 1 << numMips;
 
 		// Note: Use the 32-bit buffer here as 16-bit causes too much banding (most of the scene gets assigned 4-5 different
 		// depth values). 
 		//  - When I add UNORM 16-bit format I should be able to switch to that
-		output = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT32_R, size, size, TU_RENDERTARGET, 1, false, 1, 
+		output = resPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_R32F, size, size, TU_RENDERTARGET, 1, false, 1, 
 			numMips));
 
 		Rect2 srcRect = viewProps.nrmViewRect;
@@ -1449,7 +1449,7 @@ namespace bs { namespace ct
 				std::max(1, Math::divideAndRoundUp((INT32)viewProps.viewRect.height, 2))
 			);
 
-			POOLED_RENDER_TEXTURE_DESC desc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, downsampledSize.x, 
+			POOLED_RENDER_TEXTURE_DESC desc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA16F, downsampledSize.x, 
 				downsampledSize.y, TU_RENDERTARGET);
 			setupTex0 = GpuResourcePool::instance().get(desc);
 
@@ -1464,7 +1464,7 @@ namespace bs { namespace ct
 				std::max(1, Math::divideAndRoundUp((INT32)viewProps.viewRect.height, 4))
 			);
 
-			POOLED_RENDER_TEXTURE_DESC desc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_FLOAT16_RGBA, downsampledSize.x, 
+			POOLED_RENDER_TEXTURE_DESC desc = POOLED_RENDER_TEXTURE_DESC::create2D(PF_RGBA16F, downsampledSize.x, 
 				downsampledSize.y, TU_RENDERTARGET);
 			setupTex1 = GpuResourcePool::instance().get(desc);
 

+ 2 - 2
Source/RenderBeast/Source/BsRendererTextures.cpp

@@ -20,7 +20,7 @@ namespace bs { namespace ct
 			bases[i].y = sin(angle);
 		}
 
-		SPtr<PixelData> pixelData = PixelData::create(4, 4, 1, PF_R8G8);
+		SPtr<PixelData> pixelData = PixelData::create(4, 4, 1, PF_RG8);
 		for(UINT32 y = 0; y < 4; ++y)
 			for(UINT32 x = 0; x < 4; ++x)
 			{
@@ -86,7 +86,7 @@ namespace bs { namespace ct
 	{
 		TEXTURE_DESC desc;
 		desc.type = TEX_TYPE_2D;
-		desc.format = PF_FLOAT16_RG;
+		desc.format = PF_RG16F;
 		desc.width = 128;
 		desc.height = 32;
 

+ 1 - 1
Source/SBansheeEditor/Source/BsScriptBuildManager.cpp

@@ -208,7 +208,7 @@ namespace bs
 
 				for (auto& entry : textures)
 				{
-					entry.pixels = PixelData::create(entry.size, entry.size, 1, PF_R8G8B8A8);
+					entry.pixels = PixelData::create(entry.size, entry.size, 1, PF_RGBA8);
 					PixelUtil::scale(*pixels, *entry.pixels);
 
 					icons[entry.size] = entry.pixels;

+ 2 - 2
Source/SBansheeEngine/Include/BsPixelDataEx.h

@@ -18,10 +18,10 @@ namespace bs
 	{
 	public:
 		BS_SCRIPT_EXPORT(ec:PixelData)
-		static SPtr<PixelData> create(const PixelVolume& volume, PixelFormat format = PF_B8G8R8A8);
+		static SPtr<PixelData> create(const PixelVolume& volume, PixelFormat format = PF_BGRA8);
 
 		BS_SCRIPT_EXPORT(ec:PixelData)
-		static SPtr<PixelData> create(UINT32 width, UINT32 height, UINT32 depth = 1, PixelFormat pixelFormat = PF_B8G8R8A8);
+		static SPtr<PixelData> create(UINT32 width, UINT32 height, UINT32 depth = 1, PixelFormat pixelFormat = PF_BGRA8);
 
 		/**
 		 * Returns a pixel at the specified location in the buffer.

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor