Ver Fonte

More work on improving documentation for Doxygen generation

BearishSun há 9 anos atrás
pai
commit
d7c0097d20
47 ficheiros alterados com 4220 adições e 4485 exclusões
  1. 28 26
      Source/BansheeCore/Include/BsRenderAPIFactory.h
  2. 34 35
      Source/BansheeD3D11RenderAPI/Include/BsD3D11BlendState.h
  3. 34 35
      Source/BansheeD3D11RenderAPI/Include/BsD3D11DepthStencilState.h
  4. 70 82
      Source/BansheeD3D11RenderAPI/Include/BsD3D11Device.h
  5. 60 77
      Source/BansheeD3D11RenderAPI/Include/BsD3D11Driver.h
  6. 37 43
      Source/BansheeD3D11RenderAPI/Include/BsD3D11DriverList.h
  7. 32 32
      Source/BansheeD3D11RenderAPI/Include/BsD3D11EventQuery.h
  8. 61 77
      Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuBuffer.h
  9. 61 59
      Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuBufferView.h
  10. 37 41
      Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuParamBlockBuffer.h
  11. 192 249
      Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuProgram.h
  12. 47 44
      Source/BansheeD3D11RenderAPI/Include/BsD3D11HLSLParamParser.h
  13. 35 38
      Source/BansheeD3D11RenderAPI/Include/BsD3D11HLSLProgramFactory.h
  14. 82 85
      Source/BansheeD3D11RenderAPI/Include/BsD3D11HardwareBuffer.h
  15. 40 44
      Source/BansheeD3D11RenderAPI/Include/BsD3D11HardwareBufferManager.h
  16. 51 59
      Source/BansheeD3D11RenderAPI/Include/BsD3D11IndexBuffer.h
  17. 84 92
      Source/BansheeD3D11RenderAPI/Include/BsD3D11InputLayoutManager.h
  18. 129 174
      Source/BansheeD3D11RenderAPI/Include/BsD3D11Mappings.h
  19. 60 60
      Source/BansheeD3D11RenderAPI/Include/BsD3D11MultiRenderTexture.h
  20. 47 53
      Source/BansheeD3D11RenderAPI/Include/BsD3D11OcclusionQuery.h
  21. 100 92
      Source/BansheeD3D11RenderAPI/Include/BsD3D11Prerequisites.h
  22. 28 30
      Source/BansheeD3D11RenderAPI/Include/BsD3D11QueryManager.h
  23. 32 31
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RasterizerState.h
  24. 201 283
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderAPI.h
  25. 48 50
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderAPIFactory.h
  26. 31 35
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderStateManager.h
  27. 59 53
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderTexture.h
  28. 55 53
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderUtility.h
  29. 188 182
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderWindow.h
  30. 42 44
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderWindowManager.h
  31. 34 31
      Source/BansheeD3D11RenderAPI/Include/BsD3D11SamplerState.h
  32. 148 142
      Source/BansheeD3D11RenderAPI/Include/BsD3D11Texture.h
  33. 45 55
      Source/BansheeD3D11RenderAPI/Include/BsD3D11TextureManager.h
  34. 122 122
      Source/BansheeD3D11RenderAPI/Include/BsD3D11TextureView.h
  35. 47 53
      Source/BansheeD3D11RenderAPI/Include/BsD3D11TimerQuery.h
  36. 51 61
      Source/BansheeD3D11RenderAPI/Include/BsD3D11VertexBuffer.h
  37. 59 67
      Source/BansheeD3D11RenderAPI/Include/BsD3D11VideoModeInfo.h
  38. 605 605
      Source/BansheeD3D9RenderAPI/Include/BsD3D9RenderAPI.h
  39. 34 34
      Source/BansheeFBXImporter/Include/BsFBXPrerequisites.h
  40. 28 28
      Source/BansheeFontImporter/Include/BsFontPrerequisites.h
  41. 28 28
      Source/BansheeFreeImgImporter/Include/BsFreeImgPrerequisites.h
  42. 616 616
      Source/BansheeGLRenderAPI/Include/BsGLRenderAPI.h
  43. 38 38
      Source/BansheeMono/Include/BsMonoPrerequisites.h
  44. 28 28
      Source/BansheeOISInput/Include/BsOISPrerequisites.h
  45. 110 110
      Source/BansheePhysX/Include/BsPhysXPrerequisites.h
  46. 210 209
      Source/MBansheeEditor/MBansheeEditor.csproj
  47. 12 0
      Source/MBansheeEditor/Scene/Gizmos/JointGizmos.cs

+ 28 - 26
Source/BansheeCore/Include/BsRenderAPIFactory.h

@@ -1,27 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RenderAPI
-	 *  @{
-	 */
-
-	/** Factory class that you may specialize in order to start up a specific render system. */
-	class RenderAPIFactory
-	{
-	public:
-		/**	Creates and starts up the render system managed by this factory.  */
-		virtual void create() = 0;
-
-		/**	Returns the name of the render system this factory creates. */
-		virtual const String& name() const = 0;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+namespace BansheeEngine
+{
+	/** @cond INTERNAL */
+	/** @addtogroup RenderAPI
+	 *  @{
+	 */
+
+	/** Factory class that you may specialize in order to start up a specific render system. */
+	class RenderAPIFactory
+	{
+	public:
+		virtual ~RenderAPIFactory() { }
+
+		/**	Creates and starts up the render system managed by this factory.  */
+		virtual void create() = 0;
+
+		/**	Returns the name of the render system this factory creates. */
+		virtual const String& name() const = 0;
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 34 - 35
Source/BansheeD3D11RenderAPI/Include/BsD3D11BlendState.h

@@ -1,36 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsBlendState.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of a blend state. 
-	 *			Corresponds directly with a DX11 blend state object.
-	 */
-	class BS_D3D11_EXPORT D3D11BlendStateCore : public BlendStateCore
-	{
-	public:
-		~D3D11BlendStateCore();
-
-		/**
-		 * @brief	Returns the internal DX11 blend state object.
-		 */
-		ID3D11BlendState* getInternal() const { return mBlendState; }
-
-	protected:
-		friend class D3D11RenderStateCoreManager;
-
-		D3D11BlendStateCore(const BLEND_STATE_DESC& desc, UINT32 id);
-
-		/**
-		 * @copydoc BlendStateCore::createInternal
-		 */
-		void createInternal() override;
-
-		ID3D11BlendState* mBlendState;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsBlendState.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** DirectX 11 implementation of a blend state. Corresponds directly with a DX11 blend state object. */
+	class BS_D3D11_EXPORT D3D11BlendStateCore : public BlendStateCore
+	{
+	public:
+		~D3D11BlendStateCore();
+
+		/**	Returns the internal DX11 blend state object. */
+		ID3D11BlendState* getInternal() const { return mBlendState; }
+
+	protected:
+		friend class D3D11RenderStateCoreManager;
+
+		D3D11BlendStateCore(const BLEND_STATE_DESC& desc, UINT32 id);
+
+		/** @copydoc BlendStateCore::createInternal */
+		void createInternal() override;
+
+		ID3D11BlendState* mBlendState;
+	};
+
+	/** @} */
 }
 }

+ 34 - 35
Source/BansheeD3D11RenderAPI/Include/BsD3D11DepthStencilState.h

@@ -1,36 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsDepthStencilState.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of a depth stencil state. 
-	 *			Corresponds directly with a DX11 depth stencil state object.
-	 */
-	class BS_D3D11_EXPORT D3D11DepthStencilStateCore : public DepthStencilStateCore
-	{
-	public:
-		~D3D11DepthStencilStateCore();
-
-		/**
-		 * @brief	Returns the internal DX11 depth stencil state object.
-		 */
-		ID3D11DepthStencilState* getInternal() const { return mDepthStencilState; }
-
-	protected:
-		friend class D3D11RenderStateCoreManager;
-
-		D3D11DepthStencilStateCore(const DEPTH_STENCIL_STATE_DESC& desc, UINT32 id);
-
-		/**
-		 * @copydoc DepthStencilStateCore::createInternal()
-		 */
-		void createInternal() override;
-
-		ID3D11DepthStencilState* mDepthStencilState;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsDepthStencilState.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** DirectX 11 implementation of a depth stencil state. Corresponds directly with a DX11 depth stencil state object. */
+	class BS_D3D11_EXPORT D3D11DepthStencilStateCore : public DepthStencilStateCore
+	{
+	public:
+		~D3D11DepthStencilStateCore();
+
+		/**	Returns the internal DX11 depth stencil state object. */
+		ID3D11DepthStencilState* getInternal() const { return mDepthStencilState; }
+
+	protected:
+		friend class D3D11RenderStateCoreManager;
+
+		D3D11DepthStencilStateCore(const DEPTH_STENCIL_STATE_DESC& desc, UINT32 id);
+
+		/** @copydoc DepthStencilStateCore::createInternal() */
+		void createInternal() override;
+
+		ID3D11DepthStencilState* mDepthStencilState;
+	};
+
+	/** @} */
 }
 }

+ 70 - 82
Source/BansheeD3D11RenderAPI/Include/BsD3D11Device.h

@@ -1,83 +1,71 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-
-namespace BansheeEngine
-{
-		/**
-		 * @brief	Available DX11 error levels.
-		 */
-		enum BS_D3D11_ERROR_LEVEL
-		{
-			D3D11ERR_NO_EXCEPTION,
-			D3D11ERR_CORRUPTION,
-			D3D11ERR_ERROR,
-			D3D11ERR_WARNING,
-			D3D11ERR_INFO
-		};
-
-	/**
-	 * @brief	Wrapper around DirectX 11 device object.
-	 */
-	class BS_D3D11_EXPORT D3D11Device
-	{
-	public:
-		/**
-		 * @brief	Constructs the object with a previously created DX11 device.
-		 */
-		D3D11Device(ID3D11Device* device);
-		~D3D11Device();
-
-		/**
-		 * @brief	Shuts down the device any releases any internal resources.
-		 */
-		void shutdown();
-
-		/**
-		 * @brief	Returns DX11 immediate context object.
-		 */
-		ID3D11DeviceContext* getImmediateContext() const { return mImmediateContext; }
-
-		/**
-		 * @brief	Returns DX11 class linkage object.
-		 */
-		ID3D11ClassLinkage* getClassLinkage() const { return mClassLinkage; }
-
-		/**
-		 * @brief	Returns internal DX11 device.
-		 */
-		ID3D11Device* getD3D11Device() const { return mD3D11Device; }		
-
-		/**
-		 * @brief	Resets error state & error messages.
-		 */
-		void clearErrors();
-
-		/**
-		 * @brief	Query if error occurred at any point since last "clearError" call.
-		 * 			Use getErrorDescription to get a string describing the error.
-		 */
-		bool hasError() const;
-
-		/**
-		 * @brief	Returns a string describing an error if one occurred.
-		 */
-		String getErrorDescription(bool clearErrors = true);
-		
-		/**
-		 * @brief	Sets the level for which we want to receive errors for. Errors will be reported
-		 *			for the provided level and any higher priority level.
-		 */
-		void setExceptionsErrorLevel(const BS_D3D11_ERROR_LEVEL exceptionsErrorLevel);
-
-	private:
-		D3D11Device();
-
-		ID3D11Device* mD3D11Device;
-		ID3D11DeviceContext* mImmediateContext;
-		ID3D11InfoQueue* mInfoQueue; 
-		ID3D11ClassLinkage* mClassLinkage;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Available DX11 error levels. */
+	enum BS_D3D11_ERROR_LEVEL
+	{
+		D3D11ERR_NO_EXCEPTION,
+		D3D11ERR_CORRUPTION,
+		D3D11ERR_ERROR,
+		D3D11ERR_WARNING,
+		D3D11ERR_INFO
+	};
+
+	/**	Wrapper around DirectX 11 device object. */
+	class BS_D3D11_EXPORT D3D11Device
+	{
+	public:
+		/**	Constructs the object with a previously created DX11 device. */
+		D3D11Device(ID3D11Device* device);
+		~D3D11Device();
+
+		/**	Shuts down the device any releases any internal resources. */
+		void shutdown();
+
+		/**	Returns DX11 immediate context object. */
+		ID3D11DeviceContext* getImmediateContext() const { return mImmediateContext; }
+
+		/**	Returns DX11 class linkage object. */
+		ID3D11ClassLinkage* getClassLinkage() const { return mClassLinkage; }
+
+		/**	Returns internal DX11 device. */
+		ID3D11Device* getD3D11Device() const { return mD3D11Device; }		
+
+		/**	Resets error state & error messages. */
+		void clearErrors();
+
+		/**
+		 * Query if error occurred at any point since last clearErrors() call. Use getErrorDescription to get a string
+		 * describing the error.
+		 */
+		bool hasError() const;
+
+		/**	Returns a string describing an error if one occurred. */
+		String getErrorDescription(bool clearErrors = true);
+		
+		/**
+		 * Sets the level for which we want to receive errors for. Errors will be reported for the provided level and any
+		 * higher priority level.
+		 */
+		void setExceptionsErrorLevel(const BS_D3D11_ERROR_LEVEL exceptionsErrorLevel);
+
+	private:
+		D3D11Device();
+
+		ID3D11Device* mD3D11Device;
+		ID3D11DeviceContext* mImmediateContext;
+		ID3D11InfoQueue* mInfoQueue; 
+		ID3D11ClassLinkage* mClassLinkage;
+	};
+
+	/** @} */
 }
 }

+ 60 - 77
Source/BansheeD3D11RenderAPI/Include/BsD3D11Driver.h

@@ -1,78 +1,61 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Provides information about a driver (e.g. hardware GPU driver or software emulated).
-	 */
-	class D3D11Driver
-	{
-	public:
-		/**
-		 * @brief	Constructs a new object from the adapter number provided by DX11 runtime, and
-		 *			DXGI adapter object.
-		 */
-		D3D11Driver(UINT32 adapterNumber, IDXGIAdapter* dxgiAdapter);
-		D3D11Driver(const D3D11Driver &ob);
-		~D3D11Driver();
-
-		D3D11Driver& operator=(const D3D11Driver& r);
-
-		/**
-		 * @brief	Returns the name of the driver.
-		 */
-		String getDriverName() const;
-
-		/**
-		 * @brief	Returns the description of the driver.
-		 */
-		String getDriverDescription() const;
-
-		/**
-		 * @brief	Returns adapter index of the adapter the driver is managing.
-		 */
-		UINT32 getAdapterNumber() const { return mAdapterNumber; }
-
-		/**
-		 * @brief	Returns number of outputs connected to the adapter the driver is managing.
-		 */
-		UINT32 getNumAdapterOutputs() const { return mNumOutputs; }
-
-		/**
-		 * @brief	Returns a description of the adapter the driver is managing.
-		 */
-		const DXGI_ADAPTER_DESC& getAdapterIdentifier() const { return mAdapterIdentifier; }
-
-		/**
-		 * @brief	Returns internal DXGI adapter object for the driver.
-		 */
-		IDXGIAdapter* getDeviceAdapter() { return mDXGIAdapter; }
-
-		/**
-		 * @brief	Returns description of an output device at the specified index.
-		 */
-		DXGI_OUTPUT_DESC getOutputDesc(UINT32 adapterOutputIdx) const;
-
-		/**
-		 * @brief	Returns a list of all available video modes for all output devices.
-		 */
-		VideoModeInfoPtr getVideoModeInfo() const { return mVideoModeInfo; }
-
-	private:
-		/**
-		 * @brief	Initializes the internal data.
-		 */
-		void construct();
-
-	private:
-		UINT32 mAdapterNumber;
-		UINT32 mNumOutputs;
-		DXGI_ADAPTER_DESC mAdapterIdentifier;
-		IDXGIAdapter* mDXGIAdapter;
-		VideoModeInfoPtr mVideoModeInfo;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Provides information about a driver (e.g. hardware GPU driver or software emulated). */
+	class D3D11Driver
+	{
+	public:
+		/** Constructs a new object from the adapter number provided by DX11 runtime, and DXGI adapter object. */
+		D3D11Driver(UINT32 adapterNumber, IDXGIAdapter* dxgiAdapter);
+		D3D11Driver(const D3D11Driver &ob);
+		~D3D11Driver();
+
+		D3D11Driver& operator=(const D3D11Driver& r);
+
+		/**	Returns the name of the driver. */
+		String getDriverName() const;
+
+		/**	Returns the description of the driver. */
+		String getDriverDescription() const;
+
+		/**	Returns adapter index of the adapter the driver is managing. */
+		UINT32 getAdapterNumber() const { return mAdapterNumber; }
+
+		/**	Returns number of outputs connected to the adapter the driver is managing. */
+		UINT32 getNumAdapterOutputs() const { return mNumOutputs; }
+
+		/**	Returns a description of the adapter the driver is managing. */
+		const DXGI_ADAPTER_DESC& getAdapterIdentifier() const { return mAdapterIdentifier; }
+
+		/**	Returns internal DXGI adapter object for the driver. */
+		IDXGIAdapter* getDeviceAdapter() const { return mDXGIAdapter; }
+
+		/**	Returns description of an output device at the specified index. */
+		DXGI_OUTPUT_DESC getOutputDesc(UINT32 adapterOutputIdx) const;
+
+		/**	Returns a list of all available video modes for all output devices. */
+		VideoModeInfoPtr getVideoModeInfo() const { return mVideoModeInfo; }
+
+	private:
+		/**	Initializes the internal data. */
+		void construct();
+
+	private:
+		UINT32 mAdapterNumber;
+		UINT32 mNumOutputs;
+		DXGI_ADAPTER_DESC mAdapterIdentifier;
+		IDXGIAdapter* mDXGIAdapter;
+		VideoModeInfoPtr mVideoModeInfo;
+	};
+
+	/** @} */
 }
 }

+ 37 - 43
Source/BansheeD3D11RenderAPI/Include/BsD3D11DriverList.h

@@ -1,44 +1,38 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains a list of all available drivers.
-	 */
-	class BS_D3D11_EXPORT D3D11DriverList
-	{
-	public:
-		/**
-		 * @brief	Constructs a new driver list from an existing DXGI factory object.
-		 */
-		D3D11DriverList(IDXGIFactory* dxgiFactory);
-		~D3D11DriverList();
-
-		/**
-		 * @brief	Returns the number of available drivers.
-		 */
-		UINT32 count() const;
-
-		/**
-		 * @brief	Returns a driver at the specified index.
-		 */
-		D3D11Driver* item(UINT32 idx) const;
-
-		/**
-		 * @brief	Returns a driver with the specified name, or null if it cannot be found.
-		 */
-		D3D11Driver* item(const String &name) const;
-
-	private:
-		/**
-		 * @brief	Enumerates the DXGI factory object and constructs a list of available drivers.
-		 */
-		void enumerate(IDXGIFactory* dxgiFactory);
-
-		Vector<D3D11Driver*> mDriverList;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Contains a list of all available drivers. */
+	class BS_D3D11_EXPORT D3D11DriverList
+	{
+	public:
+		/**	Constructs a new driver list from an existing DXGI factory object. */
+		D3D11DriverList(IDXGIFactory* dxgiFactory);
+		~D3D11DriverList();
+
+		/**	Returns the number of available drivers. */
+		UINT32 count() const;
+
+		/**	Returns a driver at the specified index. */
+		D3D11Driver* item(UINT32 idx) const;
+
+		/**	Returns a driver with the specified name, or null if it cannot be found. */
+		D3D11Driver* item(const String &name) const;
+
+	private:
+		/**	Enumerates the DXGI factory object and constructs a list of available drivers. */
+		void enumerate(IDXGIFactory* dxgiFactory);
+
+		Vector<D3D11Driver*> mDriverList;
+	};
+
+	/** @} */
 }
 }

+ 32 - 32
Source/BansheeD3D11RenderAPI/Include/BsD3D11EventQuery.h

@@ -1,33 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsEventQuery.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc EventQuery
-	 */
-	class BS_D3D11_EXPORT D3D11EventQuery : public EventQuery
-	{
-	public:
-		D3D11EventQuery();
-		~D3D11EventQuery();
-
-		/**
-		 * @copydoc EventQuery::begin
-		 */
-		virtual void begin();
-
-		/**
-		 * @copydoc EventQuery::isReady
-		 */
-		virtual bool isReady() const;
-
-	private:
-		ID3D11Query* mQuery;
-		ID3D11DeviceContext* mContext;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsEventQuery.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** @copydoc EventQuery */
+	class BS_D3D11_EXPORT D3D11EventQuery : public EventQuery
+	{
+	public:
+		D3D11EventQuery();
+		~D3D11EventQuery();
+
+		/** @copydoc EventQuery::begin */
+		void begin() override;
+
+		/** @copydoc EventQuery::isReady */
+		bool isReady() const override;
+
+	private:
+		ID3D11Query* mQuery;
+		ID3D11DeviceContext* mContext;
+	};
+
+	/** @} */
 }
 }

+ 61 - 77
Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuBuffer.h

@@ -1,77 +1,61 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsGpuBuffer.h"
-
-namespace BansheeEngine 
-{
-	/**
-	 * @brief	DirectX 11 implementation of a generic GPU buffer.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuBufferCore : public GpuBufferCore
-    {
-    public:
-		~D3D11GpuBufferCore();
-
-		/**
-		 * @copydoc GpuBufferCore::lock
-		 */
-		virtual void* lock(UINT32 offset, UINT32 length, GpuLockOptions options) override;
-
-		/**
-		 * @copydoc GpuBufferCore::unlock
-		 */
-		virtual void unlock() override;
-
-		/**
-		 * @copydoc GpuBufferCore::readData
-		 */
-		virtual void readData(UINT32 offset, UINT32 length, void* pDest) override;
-
-		/**
-		 * @copydoc GpuBufferCore::writeData
-		 */
-        virtual void writeData(UINT32 offset, UINT32 length, const void* pSource,
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
-
-		/**
-		 * @copydoc GpuBufferCore::copyData
-		 */
-		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset, 
-			UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
-
-		/**
-		 * @brief	Returns the internal DX11 GPU buffer object.
-		 */
-		ID3D11Buffer* getDX11Buffer() const;
-
-	protected:
-		friend class D3D11HardwareBufferCoreManager;
-
-		/**
-		 * @copydoc	GpuBufferCore::GpuBufferCore
-		 */
-		D3D11GpuBufferCore(UINT32 elementCount, UINT32 elementSize, GpuBufferType type, GpuBufferUsage usage,
-			bool randomGpuWrite = false, bool useCounter = false);
-
-		/**
-		 * @copydoc GpuBufferCore::createView
-		 */
-		virtual GpuBufferView* createView() override;
-
-		/**
-		 * @copydoc GpuBufferCore::destroyView
-		 */
-		virtual void destroyView(GpuBufferView* view) override;
-
-		/**
-		 * @copydoc GpuBufferCore::initialize
-		 */
-		void initialize() override;
-
-	private:
-		D3D11HardwareBuffer* mBuffer;
-    };
-}
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsGpuBuffer.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX 11 implementation of a generic GPU buffer. */
+	class BS_D3D11_EXPORT D3D11GpuBufferCore : public GpuBufferCore
+    {
+    public:
+		~D3D11GpuBufferCore();
+
+		/** @copydoc GpuBufferCore::lock */
+		virtual void* lock(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+
+		/** @copydoc GpuBufferCore::unlock */
+		virtual void unlock() override;
+
+		/** @copydoc GpuBufferCore::readData */
+		virtual void readData(UINT32 offset, UINT32 length, void* pDest) override;
+
+		/** @copydoc GpuBufferCore::writeData */
+        virtual void writeData(UINT32 offset, UINT32 length, const void* pSource,
+			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+
+		/** @copydoc GpuBufferCore::copyData */
+		void copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset, 
+			UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
+
+		/**	Returns the internal DX11 GPU buffer object. */
+		ID3D11Buffer* getDX11Buffer() const;
+
+	protected:
+		friend class D3D11HardwareBufferCoreManager;
+
+		/** @copydoc GpuBufferCore::GpuBufferCore */
+		D3D11GpuBufferCore(UINT32 elementCount, UINT32 elementSize, GpuBufferType type, GpuBufferUsage usage,
+			bool randomGpuWrite = false, bool useCounter = false);
+
+		/** @copydoc GpuBufferCore::createView */
+		virtual GpuBufferView* createView() override;
+
+		/** @copydoc GpuBufferCore::destroyView */
+		virtual void destroyView(GpuBufferView* view) override;
+
+		/** @copydoc GpuBufferCore::initialize */
+		void initialize() override;
+
+	private:
+		D3D11HardwareBuffer* mBuffer;
+    };
+
+	/** @} */
+}

+ 61 - 59
Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuBufferView.h

@@ -1,60 +1,62 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsGpuBufferView.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Represents a specific view of a GpuBuffer. Different views all of the same buffer be used
-	 *			in different situations (e.g. for reading from a shader, or for a unordered read/write operation).
-	 */
-	class BS_D3D11_EXPORT D3D11GpuBufferView : public GpuBufferView
-	{
-	public:
-		D3D11GpuBufferView();
-		virtual ~D3D11GpuBufferView();
-
-		/**
-		 * @copydoc	GpuBufferView::initialize
-		 */
-		void initialize(const SPtr<GpuBufferCore>& buffer, GPU_BUFFER_DESC& desc);
-
-	private:
-		/**
-		 * @brief	Creates a DX11 shader resource view that allows a buffer to be bound to a shader for reading (the most
-		 *			common option). 
-		 *
-		 * @param	buffer			Buffer to create the view for.
-		 * @param	firstElement	Index of the first element the view manages. Interpretation of this value depends on
-		 *							exact buffer type. It may be byte offset for raw buffers, or number of elements for
-		 *							structured buffers.
-		 * @param	elementWidth	Width of a single element in the buffer. Size of the structure in structured buffers and
-		 *							ignored for raw buffers as they always operate on single byte basis.
-		 * @param	numElements		Number of elements the view manages, starting after the "firstElement". This means number of
-		 *							bytes for raw buffers or number of structures for structured buffers.
-		 *
-		 * @returns	Constructed DX11 shader resource view object.
-		 */
-		ID3D11ShaderResourceView* createSRV(D3D11GpuBufferCore* buffer, UINT32 firstElement, UINT32 elementWidth, UINT32 numElements);
-
-		/**
-		 * @brief	Creates a DX11 unordered access view that allows a buffer to be bound to a shader for random reading or writing.
-		 *
-		 * @param	buffer			Buffer to create the view for.
-		 * @param	firstElement	Index of the first element the view manages. Interpretation of this value depends on
-		 *							exact buffer type. It may be byte offset for raw buffers, or number of elements for
-		 *							structured buffers.
-		 * @param	numElements		Number of elements the view manages, starting after the "firstElement". This means number of
-		 *							bytes for raw buffers or number of structures for structured buffers.
-		 *
-		 * @returns	Constructed DX11 unordered access view object.
-		 */
-		ID3D11UnorderedAccessView* createUAV(D3D11GpuBufferCore* buffer, UINT32 firstElement, UINT32 numElements, bool useCounter);
-
-		ID3D11ShaderResourceView* mSRV;
-		ID3D11UnorderedAccessView* mUAV;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsGpuBufferView.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**
+	 * Represents a specific view of a GpuBuffer. Different views all of the same buffer be used in different situations
+	 * (e.g. for reading from a shader, or for a unordered read/write operation).
+	 */
+	class BS_D3D11_EXPORT D3D11GpuBufferView : public GpuBufferView
+	{
+	public:
+		D3D11GpuBufferView();
+		virtual ~D3D11GpuBufferView();
+
+		/** @copydoc GpuBufferView::initialize */
+		void initialize(const SPtr<GpuBufferCore>& buffer, GPU_BUFFER_DESC& desc) override;
+
+	private:
+		/**
+		 * Creates a DX11 shader resource view that allows a buffer to be bound to a shader for reading (the most common
+		 * option). 
+		 *
+		 * @param[in]	buffer			Buffer to create the view for.
+		 * @param[in]	firstElement	Index of the first element the view manages. Interpretation of this value depends on
+		 *								exact buffer type. It may be byte offset for raw buffers, or number of elements for
+		 *								structured buffers.
+		 * @param[in]	elementWidth	Width of a single element in the buffer. Size of the structure in structured buffers
+		 *								and ignored for raw buffers as they always operate on single byte basis.
+		 * @param[in]	numElements		Number of elements the view manages, starting after the "firstElement". This means
+		 *								number of bytes for raw buffers or number of structures for structured buffers.
+		 * @return						Constructed DX11 shader resource view object.
+		 */
+		ID3D11ShaderResourceView* createSRV(D3D11GpuBufferCore* buffer, UINT32 firstElement, UINT32 elementWidth, UINT32 numElements);
+
+		/**
+		 * Creates a DX11 unordered access view that allows a buffer to be bound to a shader for random reading or writing.
+		 *
+		 * @param[in]	buffer			Buffer to create the view for.
+		 * @param[in]	firstElement	Index of the first element the view manages. Interpretation of this value depends on
+		 *								exact buffer type. It may be byte offset for raw buffers, or number of elements for
+		 *								structured buffers.
+		 * @param[in]	numElements		Number of elements the view manages, starting after the @p firstElement. This means
+		 *								number of bytes for raw buffers or number of structures for structured buffers.
+		 * @return						Constructed DX11 unordered access view object.
+		 */
+		ID3D11UnorderedAccessView* createUAV(D3D11GpuBufferCore* buffer, UINT32 firstElement, UINT32 numElements, bool useCounter);
+
+		ID3D11ShaderResourceView* mSRV;
+		ID3D11UnorderedAccessView* mUAV;
+	};
+
+	/** @} */
 }
 }

+ 37 - 41
Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuParamBlockBuffer.h

@@ -1,42 +1,38 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsGpuParamBlockBuffer.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of a parameter block buffer (constant buffer in DX11 lingo).
-	 */
-	class BS_D3D11_EXPORT D3D11GpuParamBlockBufferCore : public GpuParamBlockBufferCore
-	{
-	public:
-		D3D11GpuParamBlockBufferCore(UINT32 size, GpuParamBlockUsage usage);
-		~D3D11GpuParamBlockBufferCore();
-
-		/**
-		 * @copydoc GpuParamBlockBufferCore::writeData.
-		 */
-		void writeToGPU(const UINT8* data) override;
-
-		/**
-		 * @copydoc GpuParamBlockBufferCore::readData.
-		 */
-		void readFromGPU(UINT8* data) const override;
-
-		/**
-		 * @brief	Returns internal DX11 buffer object.
-		 */
-		ID3D11Buffer* getD3D11Buffer() const;
-	protected:
-		/**
-		 * @copydoc GpuParamBlockBufferCore::initialize
-		 */
-		virtual void initialize() override;
-
-	private:
-		D3D11HardwareBuffer* mBuffer;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsGpuParamBlockBuffer.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX 11 implementation of a parameter block buffer (constant buffer in DX11 lingo). */
+	class BS_D3D11_EXPORT D3D11GpuParamBlockBufferCore : public GpuParamBlockBufferCore
+	{
+	public:
+		D3D11GpuParamBlockBufferCore(UINT32 size, GpuParamBlockUsage usage);
+		~D3D11GpuParamBlockBufferCore();
+
+		/** @copydoc GpuParamBlockBufferCore::writeData */
+		void writeToGPU(const UINT8* data) override;
+
+		/** @copydoc GpuParamBlockBufferCore::readData */
+		void readFromGPU(UINT8* data) const override;
+
+		/**	Returns internal DX11 buffer object. */
+		ID3D11Buffer* getD3D11Buffer() const;
+	protected:
+		/** @copydoc GpuParamBlockBufferCore::initialize */
+		virtual void initialize() override;
+
+	private:
+		D3D11HardwareBuffer* mBuffer;
+	};
+
+	/** @} */
 }
 }

+ 192 - 249
Source/BansheeD3D11RenderAPI/Include/BsD3D11GpuProgram.h

@@ -1,250 +1,193 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsGpuProgram.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Abstraction of a DirectX 11 shader object.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuProgramCore : public GpuProgramCore
-	{
-	public:
-		virtual ~D3D11GpuProgramCore();
-
-		/**
-		 * @brief	Returns compiled shader microcode.
-		 */
-		const HLSLMicroCode& getMicroCode() const { return mMicrocode; }
-
-		/**
-		 * @brief	Returns unique GPU program ID.
-		 */
-		UINT32 getProgramId() const { return mProgramId; }
-
-	protected:
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
-			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
-
-		/**
-		 * @copydoc GpuProgramCore::initialize
-		 */
-		void initialize() override;
-
-		/**
-		 * @brief	Loads the shader from microcode.
-		 */
-		virtual void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) = 0;
-
-		/**
-		 * @brief	Compiles the shader from source and generates the microcode.
-		 */
-		ID3DBlob* compileMicrocode(const String& profile);
-
-		/**
-		 * @brief	Reflects the microcode and extracts input/output parameters, and constant
-		 * 			buffer structures used by the program.
-		 */
-		void populateParametersAndConstants(ID3DBlob* microcode);
-
-	protected:
-		static UINT32 GlobalProgramId;
-
-		bool mEnableBackwardsCompatibility;
-		UINT32 mProgramId;
-
-		HLSLMicroCode mMicrocode;
-	};
-
-	/**
-	 * @brief	Implementation of a DX11 vertex shader.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuVertexProgramCore : public D3D11GpuProgramCore
-	{
-	public:
-		~D3D11GpuVertexProgramCore();
-
-		/**
-		 * @brief	Returns internal DX11 vertex shader object.
-		 */
-		ID3D11VertexShader* getVertexShader() const;
-
-	protected:
-		friend class D3D11HLSLProgramFactory;
-
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuVertexProgramCore(const String& source, const String& entryPoint,
-			GpuProgramProfile profile);
-
-		/**
-		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
-		 */
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
-
-	protected:
-		ID3D11VertexShader* mVertexShader;
-	};
-
-	/**
-	 * @brief	Implementation of a DX11 pixel shader.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuFragmentProgramCore : public D3D11GpuProgramCore
-	{
-	public:
-		~D3D11GpuFragmentProgramCore();
-
-		/**
-		 * @brief	Returns internal DX11 pixel shader object.
-		 */
-		ID3D11PixelShader* getPixelShader() const;
-
-	protected:
-		friend class D3D11HLSLProgramFactory;
-
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuFragmentProgramCore(const String& source, const String& entryPoint,
-			GpuProgramProfile profile);
-
-		/**
-		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
-		 */
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
-
-	protected:
-		ID3D11PixelShader* mPixelShader;
-	};
-
-	/**
-	 * @brief	Implementation of a DX11 domain shader.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuDomainProgramCore : public D3D11GpuProgramCore
-	{
-	public:
-		~D3D11GpuDomainProgramCore();
-
-		/**
-		 * @brief	Returns internal DX11 domain shader object.
-		 */
-		ID3D11DomainShader* getDomainShader() const;
-
-	protected:
-		friend class D3D11HLSLProgramFactory;
-
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuDomainProgramCore(const String& source, const String& entryPoint,
-			GpuProgramProfile profile);
-
-		/**
-		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
-		 */
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
-
-	protected:
-		ID3D11DomainShader* mDomainShader;
-	};
-
-	/**
-	 * @brief	Implementation of a DX11 hull shader.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuHullProgramCore : public D3D11GpuProgramCore
-	{
-	public:
-		~D3D11GpuHullProgramCore();
-
-		/**
-		 * @brief	Returns internal DX11 hull shader object.
-		 */
-		ID3D11HullShader* getHullShader() const;
-
-	protected:
-		friend class D3D11HLSLProgramFactory;
-
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuHullProgramCore(const String& source, const String& entryPoint,
-			GpuProgramProfile profile);
-
-		/**
-		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
-		 */
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
-
-	protected:
-		ID3D11HullShader* mHullShader;
-	};
-
-	/**
-	 * @brief	Implementation of a DX11 geometry shader.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuGeometryProgramCore : public D3D11GpuProgramCore
-	{
-	public:
-		~D3D11GpuGeometryProgramCore();
-
-		/**
-		 * @brief	Returns internal DX11 geometry shader object.
-		 */
-		ID3D11GeometryShader* getGeometryShader() const;
-
-	protected:
-		friend class D3D11HLSLProgramFactory;
-
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuGeometryProgramCore(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
-
-		/**
-		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
-		 */
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
-
-	protected:
-		ID3D11GeometryShader* mGeometryShader;
-	};
-
-	/**
-	 * @brief	Implementation of a DX11 compute shader.
-	 */
-	class BS_D3D11_EXPORT D3D11GpuComputeProgramCore : public D3D11GpuProgramCore
-	{
-	public:
-		~D3D11GpuComputeProgramCore();
-
-		/**
-		 * @brief	Returns internal DX11 compute shader object.
-		 */
-		ID3D11ComputeShader* getComputeShader() const;
-
-	protected:
-		friend class D3D11HLSLProgramFactory;
-
-		/**
-		 * @copydoc	GpuProgramCore::GpuProgramCore
-		 */
-		D3D11GpuComputeProgramCore(const String& source, const String& entryPoint,
-			GpuProgramProfile profile);
-
-		/**
-		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
-		 */
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
-
-	protected:
-		ID3D11ComputeShader* mComputeShader;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsGpuProgram.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Abstraction of a DirectX 11 shader object. */
+	class BS_D3D11_EXPORT D3D11GpuProgramCore : public GpuProgramCore
+	{
+	public:
+		virtual ~D3D11GpuProgramCore();
+
+		/**	Returns compiled shader microcode. */
+		const HLSLMicroCode& getMicroCode() const { return mMicrocode; }
+
+		/**	Returns unique GPU program ID. */
+		UINT32 getProgramId() const { return mProgramId; }
+
+	protected:
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
+			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
+
+		/** @copydoc GpuProgramCore::initialize */
+		void initialize() override;
+
+		/**	Loads the shader from microcode. */
+		virtual void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) = 0;
+
+		/**	Compiles the shader from source and generates the microcode. */
+		ID3DBlob* compileMicrocode(const String& profile);
+
+		/**
+		 * Reflects the microcode and extracts input/output parameters, and constant buffer structures used by the program.
+		 */
+		void populateParametersAndConstants(ID3DBlob* microcode);
+
+	protected:
+		static UINT32 GlobalProgramId;
+
+		bool mEnableBackwardsCompatibility;
+		UINT32 mProgramId;
+
+		HLSLMicroCode mMicrocode;
+	};
+
+	/**	Implementation of a DX11 vertex shader. */
+	class BS_D3D11_EXPORT D3D11GpuVertexProgramCore : public D3D11GpuProgramCore
+	{
+	public:
+		~D3D11GpuVertexProgramCore();
+
+		/**	Returns internal DX11 vertex shader object. */
+		ID3D11VertexShader* getVertexShader() const;
+
+	protected:
+		friend class D3D11HLSLProgramFactory;
+
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuVertexProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
+
+		/** @copydoc D3D11GpuProgramCore::loadFromMicrocode */
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) override;
+
+	protected:
+		ID3D11VertexShader* mVertexShader;
+	};
+
+	/**	Implementation of a DX11 pixel shader. */
+	class BS_D3D11_EXPORT D3D11GpuFragmentProgramCore : public D3D11GpuProgramCore
+	{
+	public:
+		~D3D11GpuFragmentProgramCore();
+
+		/**	Returns internal DX11 pixel shader object. */
+		ID3D11PixelShader* getPixelShader() const;
+
+	protected:
+		friend class D3D11HLSLProgramFactory;
+
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuFragmentProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
+
+		/** @copydoc D3D11GpuProgramCore::loadFromMicrocode */
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) override;
+
+	protected:
+		ID3D11PixelShader* mPixelShader;
+	};
+
+	/**	Implementation of a DX11 domain shader. */
+	class BS_D3D11_EXPORT D3D11GpuDomainProgramCore : public D3D11GpuProgramCore
+	{
+	public:
+		~D3D11GpuDomainProgramCore();
+
+		/**	Returns internal DX11 domain shader object. */
+		ID3D11DomainShader* getDomainShader() const;
+
+	protected:
+		friend class D3D11HLSLProgramFactory;
+
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuDomainProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
+
+		/** @copydoc D3D11GpuProgramCore::loadFromMicrocode */
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) override;
+
+	protected:
+		ID3D11DomainShader* mDomainShader;
+	};
+
+	/**	Implementation of a DX11 hull shader. */
+	class BS_D3D11_EXPORT D3D11GpuHullProgramCore : public D3D11GpuProgramCore
+	{
+	public:
+		~D3D11GpuHullProgramCore();
+
+		/**	Returns internal DX11 hull shader object. */
+		ID3D11HullShader* getHullShader() const;
+
+	protected:
+		friend class D3D11HLSLProgramFactory;
+
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuHullProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
+
+		/** @copydoc D3D11GpuProgramCore::loadFromMicrocode */
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) override;
+
+	protected:
+		ID3D11HullShader* mHullShader;
+	};
+
+	/**	Implementation of a DX11 geometry shader. */
+	class BS_D3D11_EXPORT D3D11GpuGeometryProgramCore : public D3D11GpuProgramCore
+	{
+	public:
+		~D3D11GpuGeometryProgramCore();
+
+		/**	Returns internal DX11 geometry shader object. */
+		ID3D11GeometryShader* getGeometryShader() const;
+
+	protected:
+		friend class D3D11HLSLProgramFactory;
+
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuGeometryProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
+
+		/** @copydoc D3D11GpuProgramCore::loadFromMicrocode */
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) override;
+
+	protected:
+		ID3D11GeometryShader* mGeometryShader;
+	};
+
+	/**	Implementation of a DX11 compute shader. */
+	class BS_D3D11_EXPORT D3D11GpuComputeProgramCore : public D3D11GpuProgramCore
+	{
+	public:
+		~D3D11GpuComputeProgramCore();
+
+		/**	Returns internal DX11 compute shader object. */
+		ID3D11ComputeShader* getComputeShader() const;
+
+	protected:
+		friend class D3D11HLSLProgramFactory;
+
+		/** @copydoc GpuProgramCore::GpuProgramCore */
+		D3D11GpuComputeProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
+
+		/** @copydoc D3D11GpuProgramCore::loadFromMicrocode */
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) override;
+
+	protected:
+		ID3D11ComputeShader* mComputeShader;
+	};
+
+	/** @} */
 }
 }

+ 47 - 44
Source/BansheeD3D11RenderAPI/Include/BsD3D11HLSLParamParser.h

@@ -1,45 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsVertexDeclaration.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles parsing of GPU program microcode and extracting constant and input parameter data.
-	 */
-	class D3D11HLSLParamParser
-	{
-	public:
-		/**
-		 * @brief	Parses the provided microcode and outputs constant parameter descriptions, and optionally for
-		 *			vertex GPU programs a set of input parameters.
-		 *
-		 * @param	microcode	Compiled GPU program microcode to parse.
-		 * @param	desc		Output object that will contain parameter descriptions.
-		 * @param	inputParams	Output object that will contain a set of program input parameters. Can be null if not required.
-		 *						Only relevant for vertex programs.
-		 */
-		void parse(ID3DBlob* microcode, GpuParamDesc& desc, List<VertexElement>* inputParams);
-
-	private:
-		/**
-		 * @brief	Parses the provided constant buffer retrieving information about all of its members and storing
-		 *			them in the provided GPU params description object.
-		 */
-		void parseBuffer(ID3D11ShaderReflectionConstantBuffer* bufferReflection, GpuParamDesc& desc);
-
-		/**
-		 * @brief	Parses the resource description structure and stores it in the provided GPU params description object.
-		 */
-		void parseResource(D3D11_SHADER_INPUT_BIND_DESC& resourceDesc, GpuParamDesc& desc);
-
-		/**
-		 * @brief	Parses a variable with the specified type and variable description. Adds the variable in the provided
-		 *			GPU params description object and assigns it to the provided param block.
-		 */
-		void parseVariable(D3D11_SHADER_TYPE_DESC& varTypeDesc, D3D11_SHADER_VARIABLE_DESC& varDesc, GpuParamDesc& desc, GpuParamBlockDesc& paramBlock);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsVertexDeclaration.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles parsing of GPU program microcode and extracting constant and input parameter data. */
+	class D3D11HLSLParamParser
+	{
+	public:
+		/**
+		 * Parses the provided microcode and outputs constant parameter descriptions, and optionally for vertex GPU programs
+		 * a set of input parameters.
+		 *
+		 * @param[in]	microcode	Compiled GPU program microcode to parse.
+		 * @param[in]	desc		Output object that will contain parameter descriptions.
+		 * @param[in]	inputParams	Output object that will contain a set of program input parameters. Can be null if not 
+		 *							required. Only relevant for vertex programs.
+		 */
+		void parse(ID3DBlob* microcode, GpuParamDesc& desc, List<VertexElement>* inputParams);
+
+	private:
+		/**
+		 * Parses the provided constant buffer retrieving information about all of its members and storing them in the
+		 * provided GPU params description object.
+		 */
+		void parseBuffer(ID3D11ShaderReflectionConstantBuffer* bufferReflection, GpuParamDesc& desc);
+
+		/**	Parses the resource description structure and stores it in the provided GPU params description object. */
+		void parseResource(D3D11_SHADER_INPUT_BIND_DESC& resourceDesc, GpuParamDesc& desc);
+
+		/**
+		 * Parses a variable with the specified type and variable description. Adds the variable in the provided GPU params
+		 * description object and assigns it to the provided param block.
+		 */
+		void parseVariable(D3D11_SHADER_TYPE_DESC& varTypeDesc, D3D11_SHADER_VARIABLE_DESC& varDesc, GpuParamDesc& desc,
+			GpuParamBlockDesc& paramBlock);
+	};
+
+	/** @} */
 }
 }

+ 35 - 38
Source/BansheeD3D11RenderAPI/Include/BsD3D11HLSLProgramFactory.h

@@ -1,39 +1,36 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsGpuProgramManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation of DirectX 11 HLSL GPU programs.
-	 */
-	class BS_D3D11_EXPORT D3D11HLSLProgramFactory : public GpuProgramFactory
-	{
-	public:
-		D3D11HLSLProgramFactory();
-		~D3D11HLSLProgramFactory();
-
-		/**
-		 * @copydoc	GpuProgramFactory::getLanguage
-		 */
-		const String& getLanguage() const override;
-
-		/**
-		 * @copydoc	GpuProgramFactory::create(const String&, const String&, GpuProgramType,
-		 *			GpuProgramProfile, bool)
-		 */
-		SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, bool requireAdjacencyInfo) override;
-
-		/**
-		* @copydoc	GpuProgramFactory::create(GpuProgramType)
-		*/
-		SPtr<GpuProgramCore> create(GpuProgramType type) override;
-
-	protected:
-		static const String LANGUAGE_NAME;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsGpuProgramManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles creation of DirectX 11 HLSL GPU programs. */
+	class BS_D3D11_EXPORT D3D11HLSLProgramFactory : public GpuProgramFactory
+	{
+	public:
+		D3D11HLSLProgramFactory();
+		~D3D11HLSLProgramFactory();
+
+		/** @copydoc GpuProgramFactory::getLanguage */
+		const String& getLanguage() const override;
+
+		/** @copydoc GpuProgramFactory::create(const String&, const String&, GpuProgramType, GpuProgramProfile, bool) */
+		SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool requireAdjacencyInfo) override;
+
+		/** @copydoc GpuProgramFactory::create(GpuProgramType) */
+		SPtr<GpuProgramCore> create(GpuProgramType type) override;
+
+	protected:
+		static const String LANGUAGE_NAME;
+	};
+
+	/** @} */
 }
 }

+ 82 - 85
Source/BansheeD3D11RenderAPI/Include/BsD3D11HardwareBuffer.h

@@ -1,86 +1,83 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsHardwareBuffer.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Class containing common functionality for all DirectX 11 hardware buffers.
-	 */
-	class BS_D3D11_EXPORT D3D11HardwareBuffer : public HardwareBuffer
-	{
-	public:
-		/**
-		 * @brief	Available types of DX11 buffers
-		 */
-		enum BufferType
-		{
-			BT_VERTEX = 0x1, /**< Contains geometry vertices and their properties. */
-			BT_INDEX = 0x2, /**< Contains triangle to vertex mapping. */
-			BT_CONSTANT = 0x4, /**< Contains GPU program parameters. */
-			BT_GROUP_GENERIC = 0x8, /**< Special value signifying a buffer is of generic type. Not an actual buffer. */
-			BT_STRUCTURED = BT_GROUP_GENERIC | 0x10, /**< Generic buffer that holds one or more user-defined structures laid out sequentially. */
-			BT_RAW = BT_GROUP_GENERIC | 0x20, /**< Generic buffer that holds raw block of bytes with no defined structure. */
-			BT_INDIRECTARGUMENT = BT_GROUP_GENERIC | 0x40, /**< Generic buffer that is used for holding parameters used for indirect rendering. */
-			BT_APPENDCONSUME = BT_GROUP_GENERIC | 0x80 /**< Generic buffer that allows the GPU program to use append/consume functionality. */
-		};
-
-		/**
-		 * @copydoc	HardwareBuffer::HardwareBuffer
-		 */
-		D3D11HardwareBuffer(BufferType btype, GpuBufferUsage usage, UINT32 elementCount, UINT32 elementSize, 
-			D3D11Device& device, bool useSystemMem = false, bool streamOut = false, bool randomGpuWrite = false, bool useCounter = false);
-		~D3D11HardwareBuffer();
-
-		/**
-		 * @copydoc	HardwareBuffer::readData
-		 */
-		void readData(UINT32 offset, UINT32 length, void* pDest) override;
-
-		/**
-		 * @copydoc	HardwareBuffer::writeData
-		 */
-		void writeData(UINT32 offset, UINT32 length, const void* pSource, 
-			BufferWriteType writeFlags = BufferWriteType::Normal) override;
-
-		/**
-		 * @copydoc	HardwareBuffer::copyData
-		 */
-		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, 
-			UINT32 length, bool discardWholeBuffer = false) override;
-
-		/**
-		 * @brief	Returns the internal DX11 buffer object.
-		 */
-		ID3D11Buffer* getD3DBuffer() { return mD3DBuffer; }
-
-	protected:
-		/**
-		 * @copydoc	HardwareBuffer::lockImpl
-		 */
-		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
-
-		/**
-		 * @copydoc	HardwareBuffer::unlockImpl
-		 */
-		void unlockImpl() override;
-
-		BufferType mBufferType;
-		bool mRandomGpuWrite;
-		bool mUseCounter;
-		UINT32 mElementCount;
-		UINT32 mElementSize;
-
-		ID3D11Buffer* mD3DBuffer;
-
-		bool mUseTempStagingBuffer;
-		D3D11HardwareBuffer* mpTempStagingBuffer;
-		bool mStagingUploadNeeded;
-		
-		D3D11Device& mDevice;
-		D3D11_BUFFER_DESC mDesc;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsHardwareBuffer.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Class containing common functionality for all DirectX 11 hardware buffers. */
+	class BS_D3D11_EXPORT D3D11HardwareBuffer : public HardwareBuffer
+	{
+	public:
+		/**	Available types of DX11 buffers. */
+		enum BufferType
+		{
+			/** Contains geometry vertices and their properties. */
+			BT_VERTEX = 0x1, 
+			/** Contains triangle to vertex mapping. */
+			BT_INDEX = 0x2, 
+			/** Contains GPU program parameters. */
+			BT_CONSTANT = 0x4, 
+			/** Special value signifying a buffer is of generic type. Not an actual buffer. */
+			BT_GROUP_GENERIC = 0x8, 
+			/** Generic buffer that holds one or more user-defined structures laid out sequentially. */
+			BT_STRUCTURED = BT_GROUP_GENERIC | 0x10, 
+			/** Generic buffer that holds raw block of bytes with no defined structure. */
+			BT_RAW = BT_GROUP_GENERIC | 0x20, 
+			/** Generic buffer that is used for holding parameters used for indirect rendering. */
+			BT_INDIRECTARGUMENT = BT_GROUP_GENERIC | 0x40, 
+			/** Generic buffer that allows the GPU program to use append/consume functionality. */
+			BT_APPENDCONSUME = BT_GROUP_GENERIC | 0x80 
+		};
+
+		/** @copydoc HardwareBuffer::HardwareBuffer */
+		D3D11HardwareBuffer(BufferType btype, GpuBufferUsage usage, UINT32 elementCount, UINT32 elementSize, 
+			D3D11Device& device, bool useSystemMem = false, bool streamOut = false, bool randomGpuWrite = false, 
+			bool useCounter = false);
+		~D3D11HardwareBuffer();
+
+		/** @copydoc HardwareBuffer::readData */
+		void readData(UINT32 offset, UINT32 length, void* pDest) override;
+
+		/** @copydoc HardwareBuffer::writeData */
+		void writeData(UINT32 offset, UINT32 length, const void* pSource, 
+			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+
+		/** @copydoc HardwareBuffer::copyData */
+		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, 
+			UINT32 length, bool discardWholeBuffer = false) override;
+
+		/**	Returns the internal DX11 buffer object. */
+		ID3D11Buffer* getD3DBuffer() const { return mD3DBuffer; }
+
+	protected:
+		/** @copydoc HardwareBuffer::lockImpl */
+		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+
+		/** @copydoc HardwareBuffer::unlockImpl */
+		void unlockImpl() override;
+
+		BufferType mBufferType;
+		bool mRandomGpuWrite;
+		bool mUseCounter;
+		UINT32 mElementCount;
+		UINT32 mElementSize;
+
+		ID3D11Buffer* mD3DBuffer;
+
+		bool mUseTempStagingBuffer;
+		D3D11HardwareBuffer* mpTempStagingBuffer;
+		bool mStagingUploadNeeded;
+		
+		D3D11Device& mDevice;
+		D3D11_BUFFER_DESC mDesc;
+	};
+
+	/** @} */
 }
 }

+ 40 - 44
Source/BansheeD3D11RenderAPI/Include/BsD3D11HardwareBufferManager.h

@@ -1,45 +1,41 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsHardwareBufferManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation of DirectX 11 hardware buffers.
-	 */
-	class BS_D3D11_EXPORT D3D11HardwareBufferCoreManager : public HardwareBufferCoreManager
-	{
-	public:
-		D3D11HardwareBufferCoreManager(D3D11Device& device);
-
-	protected:     
-		/**
-		 * @copydoc HardwareBufferCoreManager::createVertexBufferImpl
-		 */
-		SPtr<VertexBufferCore> createVertexBufferInternal(UINT32 vertexSize, UINT32 numVerts, 
-			GpuBufferUsage usage, bool streamOut = false) override;
-
-		/**
-		 * @copydoc HardwareBufferCoreManager::createIndexBufferImpl
-		 */
-		SPtr<IndexBufferCore> createIndexBufferInternal(IndexType itype, UINT32 numIndexes, 
-			GpuBufferUsage usage) override;
-
-		/** 
-		 * @copydoc HardwareBufferCoreManager::createGpuParamBlockBufferInternal 
-		 */
-		SPtr<GpuParamBlockBufferCore> createGpuParamBlockBufferInternal(UINT32 size, 
-			GpuParamBlockUsage usage = GPBU_DYNAMIC) override;
-
-		/**
-		 * @copydoc HardwareBufferCoreManager::createGpuBufferInternal
-		 */
-		SPtr<GpuBufferCore> createGpuBufferInternal(UINT32 elementCount, UINT32 elementSize,
-			GpuBufferType type, GpuBufferUsage usage, bool randomGpuWrite = false, bool useCounter = false) override;
-
-		D3D11Device& mDevice;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsHardwareBufferManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles creation of DirectX 11 hardware buffers. */
+	class BS_D3D11_EXPORT D3D11HardwareBufferCoreManager : public HardwareBufferCoreManager
+	{
+	public:
+		D3D11HardwareBufferCoreManager(D3D11Device& device);
+
+	protected:     
+		/** @copydoc HardwareBufferCoreManager::createVertexBufferImpl */
+		SPtr<VertexBufferCore> createVertexBufferInternal(UINT32 vertexSize, UINT32 numVerts, 
+			GpuBufferUsage usage, bool streamOut = false) override;
+
+		/** @copydoc HardwareBufferCoreManager::createIndexBufferImpl */
+		SPtr<IndexBufferCore> createIndexBufferInternal(IndexType itype, UINT32 numIndexes, 
+			GpuBufferUsage usage) override;
+
+		/** @copydoc HardwareBufferCoreManager::createGpuParamBlockBufferInternal  */
+		SPtr<GpuParamBlockBufferCore> createGpuParamBlockBufferInternal(UINT32 size, 
+			GpuParamBlockUsage usage = GPBU_DYNAMIC) override;
+
+		/** @copydoc HardwareBufferCoreManager::createGpuBufferInternal */
+		SPtr<GpuBufferCore> createGpuBufferInternal(UINT32 elementCount, UINT32 elementSize,
+			GpuBufferType type, GpuBufferUsage usage, bool randomGpuWrite = false, bool useCounter = false) override;
+
+		D3D11Device& mDevice;
+	};
+
+	/** @} */
 }
 }

+ 51 - 59
Source/BansheeD3D11RenderAPI/Include/BsD3D11IndexBuffer.h

@@ -1,60 +1,52 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsIndexBuffer.h"
-#include "BsD3D11HardwareBuffer.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of an index buffer.
-	 */
-	class BS_D3D11_EXPORT D3D11IndexBufferCore : public IndexBufferCore
-	{
-	public:
-		D3D11IndexBufferCore(D3D11Device& device, IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
-
-		~D3D11IndexBufferCore();
-
-		/**
-		 * @copydoc IndexBufferCore::readData
-		 */
-		void readData(UINT32 offset, UINT32 length, void* pDest) override;
-
-		/**
-		 * @copydoc IndexBufferCore::writeData
-		 */
-		void writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags = BufferWriteType::Normal) override;
-
-		/**
-		 * @copydoc IndexBufferCore::copyData
-		 */
-		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
-
-		/**
-		 * @brief	Gets the internal DX11 index buffer object.
-		 */
-		ID3D11Buffer* getD3DIndexBuffer() const { return mBuffer->getD3DBuffer(); }		
-
-	protected:
-		/**
-		 * @copydoc IndexBufferCore::lockImpl
-		 */
-		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
-
-		/**
-		 * @copydoc IndexBufferCore::unlockImpl
-		 */
-		void unlockImpl() override;
-
-		/**
-		 * @copydoc IndexBufferCore::initialize
-		 */
-		void initialize() override;
-
-		D3D11HardwareBuffer* mBuffer;
-		D3D11Device& mDevice;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsIndexBuffer.h"
+#include "BsD3D11HardwareBuffer.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX 11 implementation of an index buffer. */
+	class BS_D3D11_EXPORT D3D11IndexBufferCore : public IndexBufferCore
+	{
+	public:
+		D3D11IndexBufferCore(D3D11Device& device, IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
+
+		~D3D11IndexBufferCore();
+
+		/** @copydoc IndexBufferCore::readData */
+		void readData(UINT32 offset, UINT32 length, void* pDest) override;
+
+		/** @copydoc IndexBufferCore::writeData */
+		void writeData(UINT32 offset, UINT32 length, const void* pSource, 
+			BufferWriteType writeFlags = BufferWriteType::Normal) override;
+
+		/** @copydoc IndexBufferCore::copyData */
+		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, 
+			bool discardWholeBuffer = false) override;
+
+		/**	Gets the internal DX11 index buffer object. */
+		ID3D11Buffer* getD3DIndexBuffer() const { return mBuffer->getD3DBuffer(); }		
+
+	protected:
+		/** @copydoc IndexBufferCore::lockImpl */
+		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+
+		/** @copydoc IndexBufferCore::unlockImpl */
+		void unlockImpl() override;
+
+		/** @copydoc IndexBufferCore::initialize */
+		void initialize() override;
+
+		D3D11HardwareBuffer* mBuffer;
+		D3D11Device& mDevice;
+	};
+
+	/** @} */
 }
 }

+ 84 - 92
Source/BansheeD3D11RenderAPI/Include/BsD3D11InputLayoutManager.h

@@ -1,93 +1,85 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsVertexDeclaration.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation and caching of DirectX 11 input layout objects.
-	 */
-	class D3D11InputLayoutManager
-	{
-	public:
-		/**
-		 * @brief	Key uniquely identifying vertex declaration and vertex shader combination.
-		 */
-		struct VertexDeclarationKey
-		{
-			UINT64 vertxDeclId;
-			UINT32 vertexProgramId;
-		};
-
-		/**
-		 * @brief	Creates a hash from vertex declaration key.
-		 */
-		class HashFunc 
-		{
-		public:
-			::std::size_t operator()(const VertexDeclarationKey &key) const;
-		};
-
-		/**
-		 * @brief	Compares two vertex declaration keys.
-		 */
-		class EqualFunc
-		{
-		public:
-			bool operator()(const VertexDeclarationKey &a, const VertexDeclarationKey &b) const;
-		};
-
-		/**
-		 * @brief	Contains data about a single instance of DX11 input layout object.
-		 */
-		struct InputLayoutEntry
-		{
-			InputLayoutEntry() {}
-
-			ID3D11InputLayout* inputLayout;
-			UINT32 lastUsedIdx;
-		};
-
-	public:
-		D3D11InputLayoutManager();
-		~D3D11InputLayoutManager();
-
-		/**
-		 * Finds an existing or creates a new D3D11 input layout. Input layout maps a vertex declaration
-		 * from a vertex buffer to vertex program input declaration
-		 *
-		 * @param	vertexShaderDecl	Vertex declaration describing vertex program input parameters.
-		 * @param	vertexBufferDecl	Vertex declaration describing structure of a vertex buffer to be bound as input
-		 *								to the GPU program.
-		 * @param	vertexProgram		Instance of the vertex program we are creating input layout for.
-		 *
-		 * @note	Error will be thrown if the vertex buffer doesn't provide all the necessary data that the shader expects.
-		 */
-		ID3D11InputLayout* retrieveInputLayout(const SPtr<VertexDeclarationCore>& vertexShaderDecl,
-			const SPtr<VertexDeclarationCore>& vertexBufferDecl, D3D11GpuProgramCore& vertexProgram);
-
-	private:
-		/**
-		 * @brief	Creates a new input layout using the specified parameters and stores it in the input layout map.
-		 */
-		void addNewInputLayout(const SPtr<VertexDeclarationCore>& vertexShaderDecl, const SPtr<VertexDeclarationCore>& vertexBufferDecl,
-			D3D11GpuProgramCore& vertexProgram);
-
-		/**
-		 * @brief	Destroys least used input layout.
-		 */
-		void removeLeastUsed();
-
-	private:
-		static const int DECLARATION_BUFFER_SIZE = 1024;
-		static const int NUM_ELEMENTS_TO_PRUNE = 64;
-
-		UnorderedMap<VertexDeclarationKey, InputLayoutEntry*, HashFunc, EqualFunc> mInputLayoutMap;
-
-		bool mWarningShown;
-		UINT32 mLastUsedCounter;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsVertexDeclaration.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles creation and caching of DirectX 11 input layout objects. */
+	class D3D11InputLayoutManager
+	{
+	public:
+		/**	Key uniquely identifying vertex declaration and vertex shader combination. */
+		struct VertexDeclarationKey
+		{
+			UINT64 vertxDeclId;
+			UINT32 vertexProgramId;
+		};
+
+		/**	Creates a hash from vertex declaration key. */
+		class HashFunc 
+		{
+		public:
+			::std::size_t operator()(const VertexDeclarationKey &key) const;
+		};
+
+		/**	Compares two vertex declaration keys. */
+		class EqualFunc
+		{
+		public:
+			bool operator()(const VertexDeclarationKey &a, const VertexDeclarationKey &b) const;
+		};
+
+		/**	Contains data about a single instance of DX11 input layout object. */
+		struct InputLayoutEntry
+		{
+			InputLayoutEntry() {}
+
+			ID3D11InputLayout* inputLayout;
+			UINT32 lastUsedIdx;
+		};
+
+	public:
+		D3D11InputLayoutManager();
+		~D3D11InputLayoutManager();
+
+		/**
+		 * Finds an existing or creates a new D3D11 input layout. Input layout maps a vertex declaration
+		 * from a vertex buffer to vertex program input declaration
+		 *
+		 * @param[in]	vertexShaderDecl	Vertex declaration describing vertex program input parameters.
+		 * @param[in]	vertexBufferDecl	Vertex declaration describing structure of a vertex buffer to be bound as input
+		 *									to the GPU program.
+		 * @param[in]	vertexProgram		Instance of the vertex program we are creating input layout for.
+		 *
+		 * @note	Error will be thrown if the vertex buffer doesn't provide all the necessary data that the shader expects.
+		 */
+		ID3D11InputLayout* retrieveInputLayout(const SPtr<VertexDeclarationCore>& vertexShaderDecl,
+			const SPtr<VertexDeclarationCore>& vertexBufferDecl, D3D11GpuProgramCore& vertexProgram);
+
+	private:
+		/**	Creates a new input layout using the specified parameters and stores it in the input layout map. */
+		void addNewInputLayout(const SPtr<VertexDeclarationCore>& vertexShaderDecl, const SPtr<VertexDeclarationCore>& vertexBufferDecl,
+			D3D11GpuProgramCore& vertexProgram);
+
+		/**	Destroys least used input layout. */
+		void removeLeastUsed();
+
+	private:
+		static const int DECLARATION_BUFFER_SIZE = 1024;
+		static const int NUM_ELEMENTS_TO_PRUNE = 64;
+
+		UnorderedMap<VertexDeclarationKey, InputLayoutEntry*, HashFunc, EqualFunc> mInputLayoutMap;
+
+		bool mWarningShown;
+		UINT32 mLastUsedCounter;
+	};
+
+	/** @} */
 }
 }

+ 129 - 174
Source/BansheeD3D11RenderAPI/Include/BsD3D11Mappings.h

@@ -1,175 +1,130 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsTexture.h"
-#include "BsPixelData.h"
-#include "BsIndexBuffer.h"
-#include "BsVertexData.h"
-#include "BsSamplerState.h"
-#include "BsDrawOps.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Helper class that maps engine types to DirectX 1 types
-	 */
-	class BS_D3D11_EXPORT D3D11Mappings
-	{
-	public:
-		/**
-		 * @brief	Converts engine to DX11 specific texture addressing mode.
-		 */
-		static D3D11_TEXTURE_ADDRESS_MODE get(TextureAddressingMode tam);
-
-		/**
-		 * @brief	Converts engine to DX11 specific blend factor.
-		 */
-		static D3D11_BLEND get(BlendFactor bf);
-
-		/**
-		 * @brief	Converts engine to DX11 specific blend operation.
-		 */
-		static D3D11_BLEND_OP get(BlendOperation bo);
-
-		/**
-		 * @brief	Converts engine to DX11 specific comparison function.
-		 */
-		static D3D11_COMPARISON_FUNC get(CompareFunction cf);
-
-		/**
-		 * @brief	Converts engine to DX11 specific culling mode.
-		 */
-		static D3D11_CULL_MODE get(CullingMode cm);
-
-		/**
-		 * @brief	Converts engine to DX11 specific polygon fill mode.
-		 */
-		static D3D11_FILL_MODE get(PolygonMode mode);
-
-		/**
-		 * @brief	Return DirectX 11 stencil operation and optionally 
-		 *			invert it (greater than becomes less than, etc.)
-		 */
-		static D3D11_STENCIL_OP get(StencilOperation op, bool invert = false);
-
-		/**
-		 * @brief	Converts engine texture filter type to DirectX 11 filter
-		 *			shift (used for combining to get actual min/mag/mip filter
-		 *			bit location).
-		 */
-		static DWORD get(FilterType ft);
-
-		/**
-		 * @brief	Returns DirectX 11 texture filter from the provided min, mag
-		 *			and mip filter options, and optionally a filter with comparison support.
-		 */
-		static D3D11_FILTER get(const FilterOptions min, const FilterOptions mag, 
-			const FilterOptions mip, const bool comparison = false);
-
-		/**
-		 * @brief	Converts engine to DX11 buffer usage.
-		 */
-		static DWORD get(GpuBufferUsage usage);
-
-		/**
-		 * @brief	Converts engine to DX11 lock options, while also constraining
-		 *			the options depending on provided usage type.
-		 */
-		static D3D11_MAP get(GpuLockOptions options, GpuBufferUsage usage);
-
-		/**
-		 * @brief	Converts engine to DX11 vertex element type.
-		 */
-		static DXGI_FORMAT get(VertexElementType type);
-
-		/**
-		 * @brief	Returns a string describing the provided vertex element semantic.
-		 */
-		static LPCSTR get(VertexElementSemantic sem);
-
-		/**
-		 * @brief	Returns engine semantic from the provided semantic string. Throws an exception
-		 *			for semantics that do not exist.
-		 */
-		static VertexElementSemantic get(LPCSTR sem);
-
-		/**
-		 * @brief	Converts DirectX 11 GPU parameter component type to engine vertex element type.
-		 */
-		static VertexElementType getInputType(D3D_REGISTER_COMPONENT_TYPE type);
-
-		/**
-		 * @brief	Returns DX11 primitive topology based on the provided draw operation type.
-		 */
-		static D3D11_PRIMITIVE_TOPOLOGY getPrimitiveType(DrawOperationType type);
-
-		/**
-		 * @brief	Converts engine color to DX11 color.
-		 */
-		static void get(const Color& inColor, float* outColor);
-
-		/**
-		 * @brief	Checks does the provided map value include writing.
-		 */
-		static bool isMappingWrite(D3D11_MAP map);
-
-		/**
-		 * @brief	Checks does the provided map value include reading.
-		 */
-		static bool isMappingRead(D3D11_MAP map);
-
-		/**
-		 * @brief	Converts DX11 pixel format to engine pixel format.
-		 */
-		static PixelFormat getPF(DXGI_FORMAT d3dPF);
-
-		/**
-		 * @brief	Converts engine pixel format to DX11 pixel format. Some formats
-		 *			depend on whether hardware gamma is used or not, in which case
-		 *			set the "hwGamma" parameter as needed.
-		 */
-		static DXGI_FORMAT getPF(PixelFormat format, bool hwGamma);
-		
-		/** 
-		 * Returns a typeless version of a depth stencil format. Required for creating a depth stencil texture it can be
-		 * bound both for shader reading and depth/stencil writing.
-		 */
-		static DXGI_FORMAT getTypelessDepthStencilPF(PixelFormat format);
-
-		/** Returns a format of a depth stencil texture that can be used for reading the texture in the shader. */
-		static DXGI_FORMAT getShaderResourceDepthStencilPF(PixelFormat format);
-
-		/**
-		 * @brief	Converts engine to DX11 buffer usage.
-		 */
-		static D3D11_USAGE getUsage(GpuBufferUsage mUsage);
-
-		/**
-		 * @brief	Converts engine to DX11 buffer access flags.
-		 */
-		static UINT getAccessFlags(GpuBufferUsage mUsage);
-
-		/**
-		 * @brief	Converts engine to DX11 lock options.
-		 */
-		static D3D11_MAP getLockOptions(GpuLockOptions lockOptions);
-
-		/**
-		 * @brief	Checks is the provided buffer usage dynamic.
-		 */
-		static bool isDynamic(GpuBufferUsage mUsage);
-
-		/**
-		 * @brief	Finds the closest pixel format that DX11 supports.
-		 */
-		static PixelFormat getClosestSupportedPF(PixelFormat format, bool hwGamma);
-
-		/**
-		 * @brief	Returns size in bytes of a pixel surface of the specified size and format, while
-		 *			using DX11 allocation rules for padding.
-		 */
-		static UINT32 getSizeInBytes(PixelFormat pf, UINT32 width = 1, UINT32 height = 1);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsTexture.h"
+#include "BsPixelData.h"
+#include "BsIndexBuffer.h"
+#include "BsVertexData.h"
+#include "BsSamplerState.h"
+#include "BsDrawOps.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Helper class that maps engine types to DirectX 11 types. */
+	class BS_D3D11_EXPORT D3D11Mappings
+	{
+	public:
+		/**	Converts engine to DX11 specific texture addressing mode. */
+		static D3D11_TEXTURE_ADDRESS_MODE get(TextureAddressingMode tam);
+
+		/**	Converts engine to DX11 specific blend factor. */
+		static D3D11_BLEND get(BlendFactor bf);
+
+		/**	Converts engine to DX11 specific blend operation. */
+		static D3D11_BLEND_OP get(BlendOperation bo);
+
+		/**	Converts engine to DX11 specific comparison function. */
+		static D3D11_COMPARISON_FUNC get(CompareFunction cf);
+
+		/**	Converts engine to DX11 specific culling mode. */
+		static D3D11_CULL_MODE get(CullingMode cm);
+
+		/**	Converts engine to DX11 specific polygon fill mode. */
+		static D3D11_FILL_MODE get(PolygonMode mode);
+
+		/** Return DirectX 11 stencil operation and optionally invert it (greater than becomes less than, etc.). */
+		static D3D11_STENCIL_OP get(StencilOperation op, bool invert = false);
+
+		/**
+		 * Converts engine texture filter type to DirectX 11 filter shift (used for combining to get actual min/mag/mip
+		 * filter bit location).
+		 */
+		static DWORD get(FilterType ft);
+
+		/**
+		 * Returns DirectX 11 texture filter from the provided min, mag and mip filter options, and optionally a filter
+		 * with comparison support.
+		 */
+		static D3D11_FILTER get(const FilterOptions min, const FilterOptions mag, 
+			const FilterOptions mip, const bool comparison = false);
+
+		/**	Converts engine to DX11 buffer usage. */
+		static DWORD get(GpuBufferUsage usage);
+
+		/** Converts engine to DX11 lock options, while also constraining the options depending on provided usage type. */
+		static D3D11_MAP get(GpuLockOptions options, GpuBufferUsage usage);
+
+		/**	Converts engine to DX11 vertex element type. */
+		static DXGI_FORMAT get(VertexElementType type);
+
+		/**	Returns a string describing the provided vertex element semantic. */
+		static LPCSTR get(VertexElementSemantic sem);
+
+		/**
+		 * Returns engine semantic from the provided semantic string. Throws an exception for semantics that do not exist.
+		 */
+		static VertexElementSemantic get(LPCSTR sem);
+
+		/**	Converts DirectX 11 GPU parameter component type to engine vertex element type. */
+		static VertexElementType getInputType(D3D_REGISTER_COMPONENT_TYPE type);
+
+		/**	Returns DX11 primitive topology based on the provided draw operation type. */
+		static D3D11_PRIMITIVE_TOPOLOGY getPrimitiveType(DrawOperationType type);
+
+		/**	Converts engine color to DX11 color. */
+		static void get(const Color& inColor, float* outColor);
+
+		/**	Checks does the provided map value include writing. */
+		static bool isMappingWrite(D3D11_MAP map);
+
+		/**	Checks does the provided map value include reading. */
+		static bool isMappingRead(D3D11_MAP map);
+
+		/**	Converts DX11 pixel format to engine pixel format. */
+		static PixelFormat getPF(DXGI_FORMAT d3dPF);
+
+		/**
+		 * Converts engine pixel format to DX11 pixel format. Some formats depend on whether hardware gamma is used or not,
+		 * in which case set the @p hwGamma parameter as needed.
+		 */
+		static DXGI_FORMAT getPF(PixelFormat format, bool hwGamma);
+		
+		/** 
+		 * Returns a typeless version of a depth stencil format. Required for creating a depth stencil texture it can be
+		 * bound both for shader reading and depth/stencil writing.
+		 */
+		static DXGI_FORMAT getTypelessDepthStencilPF(PixelFormat format);
+
+		/** Returns a format of a depth stencil texture that can be used for reading the texture in the shader. */
+		static DXGI_FORMAT getShaderResourceDepthStencilPF(PixelFormat format);
+
+		/**	Converts engine to DX11 buffer usage. */
+		static D3D11_USAGE getUsage(GpuBufferUsage mUsage);
+
+		/**	Converts engine to DX11 buffer access flags. */
+		static UINT getAccessFlags(GpuBufferUsage mUsage);
+
+		/**	Converts engine to DX11 lock options. */
+		static D3D11_MAP getLockOptions(GpuLockOptions lockOptions);
+
+		/**	Checks is the provided buffer usage dynamic. */
+		static bool isDynamic(GpuBufferUsage mUsage);
+
+		/**	Finds the closest pixel format that DX11 supports. */
+		static PixelFormat getClosestSupportedPF(PixelFormat format, bool hwGamma);
+
+		/**
+		 * Returns size in bytes of a pixel surface of the specified size and format, while using DX11 allocation rules for
+		 * padding.
+		 */
+		static UINT32 getSizeInBytes(PixelFormat pf, UINT32 width = 1, UINT32 height = 1);
+	};
+
+	/** @} */
 }
 }

+ 60 - 60
Source/BansheeD3D11RenderAPI/Include/BsD3D11MultiRenderTexture.h

@@ -1,61 +1,61 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsMultiRenderTexture.h"
-
-namespace BansheeEngine
-{
-	class D3D11MultiRenderTexture;
-
-	/**
-	 * @brief	DirectX 11 implementation of a render texture with multiple color surfaces.
-	 *
-	 * @note	Core thread only.
-	 */
-	class BS_D3D11_EXPORT D3D11MultiRenderTextureCore : public MultiRenderTextureCore
-	{
-	public:
-		D3D11MultiRenderTextureCore(const MULTI_RENDER_TEXTURE_CORE_DESC& desc);
-		virtual ~D3D11MultiRenderTextureCore();
-		
-		/**
-		 * @copydoc	MultiRenderTextureCore::getCustomAttribute
-		 */
-		void getCustomAttribute(const String& name, void* pData) const override;
-
-	protected:
-		friend class D3D11MultiRenderTexture;
-
-		/**
-		 * @copydoc	MultiRenderTextureCore::getProperties
-		 */
-		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
-
-		MultiRenderTextureProperties mProperties;
-	};
-
-	/**
-	 * @brief	DirectX 11 implementation of a render texture with multiple color surfaces.
-	 *
-	 * @note	Sim thread only.
-	 */
-	class BS_D3D11_EXPORT D3D11MultiRenderTexture : public MultiRenderTexture
-	{
-	public:
-		virtual ~D3D11MultiRenderTexture() { }
-
-	protected:
-		friend class D3D11TextureManager;
-
-		D3D11MultiRenderTexture(const MULTI_RENDER_TEXTURE_DESC& desc);
-
-		/**
-		 * @copydoc	MultiRenderTexture::getProperties
-		 */
-		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
-
-		MultiRenderTextureProperties mProperties;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsMultiRenderTexture.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	class D3D11MultiRenderTexture;
+
+	/**
+	 * DirectX 11 implementation of a render texture with multiple color surfaces.
+	 *
+	 * @note	Core thread only.
+	 */
+	class BS_D3D11_EXPORT D3D11MultiRenderTextureCore : public MultiRenderTextureCore
+	{
+	public:
+		D3D11MultiRenderTextureCore(const MULTI_RENDER_TEXTURE_CORE_DESC& desc);
+		virtual ~D3D11MultiRenderTextureCore();
+		
+		/** @copydoc MultiRenderTextureCore::getCustomAttribute */
+		void getCustomAttribute(const String& name, void* pData) const override;
+
+	protected:
+		friend class D3D11MultiRenderTexture;
+
+		/** @copydoc MultiRenderTextureCore::getProperties */
+		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
+
+		MultiRenderTextureProperties mProperties;
+	};
+
+	/**
+	 * DirectX 11 implementation of a render texture with multiple color surfaces.
+	 *
+	 * @note	Sim thread only.
+	 */
+	class BS_D3D11_EXPORT D3D11MultiRenderTexture : public MultiRenderTexture
+	{
+	public:
+		virtual ~D3D11MultiRenderTexture() { }
+
+	protected:
+		friend class D3D11TextureManager;
+
+		D3D11MultiRenderTexture(const MULTI_RENDER_TEXTURE_DESC& desc);
+
+		/** @copydoc MultiRenderTexture::getProperties */
+		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
+
+		MultiRenderTextureProperties mProperties;
+	};
+
+	/** @} */
 }
 }

+ 47 - 53
Source/BansheeD3D11RenderAPI/Include/BsD3D11OcclusionQuery.h

@@ -1,54 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsOcclusionQuery.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc OcclusionQuery
-	 */
-	class BS_D3D11_EXPORT D3D11OcclusionQuery : public OcclusionQuery
-	{
-	public:
-		D3D11OcclusionQuery(bool binary);
-		~D3D11OcclusionQuery();
-
-		/**
-		 * @copydoc OcclusionQuery::begin
-		 */
-		virtual void begin();
-
-		/**
-		 * @copydoc OcclusionQuery::end
-		 */
-		virtual void end();
-
-		/**
-		 * @copydoc OcclusionQuery::isReady
-		 */
-		virtual bool isReady() const;
-
-		/**
-		 * @copydoc OcclusionQuery::getNumFragments
-		 */
-		virtual UINT32 getNumSamples();
-
-	private:
-		friend class QueryManager;
-
-		/**
-		 * @brief	Resolves query results after it is ready.
-		 */
-		void finalize();
-
-		ID3D11Query* mQuery;
-		ID3D11DeviceContext* mContext;
-		bool mFinalized;
-		bool mQueryEndCalled;
-
-		UINT32 mNumSamples;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsOcclusionQuery.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** @copydoc OcclusionQuery */
+	class BS_D3D11_EXPORT D3D11OcclusionQuery : public OcclusionQuery
+	{
+	public:
+		D3D11OcclusionQuery(bool binary);
+		~D3D11OcclusionQuery();
+
+		/** @copydoc OcclusionQuery::begin */
+		void begin() override;
+
+		/** @copydoc OcclusionQuery::end */
+		void end() override;
+
+		/** @copydoc OcclusionQuery::isReady */
+		bool isReady() const override;
+
+		/** @copydoc OcclusionQuery::getNumFragments */
+		UINT32 getNumSamples() override;
+
+	private:
+		friend class QueryManager;
+
+		/** Resolves query results after it is ready. */
+		void finalize();
+
+		ID3D11Query* mQuery;
+		ID3D11DeviceContext* mContext;
+		bool mFinalized;
+		bool mQueryEndCalled;
+
+		UINT32 mNumSamples;
+	};
+
+	/** @} */
 }
 }

+ 100 - 92
Source/BansheeD3D11RenderAPI/Include/BsD3D11Prerequisites.h

@@ -1,93 +1,101 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-#define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
-
-#if BS_DEBUG_MODE
-#	define D3D_DEBUG_INFO
-#endif
-
-#define WIN32_LEAN_AND_MEAN
-#if !defined(NOMINMAX) && defined(_MSC_VER)
-#	define NOMINMAX // Required to stop windows.h messing up std::min
-#endif
-
-#include <d3d11.h>
-#include <d3d11shader.h>
-#include <D3Dcompiler.h>
-
-namespace BansheeEngine
-{
-	class D3D11RenderAPI;
-	class D3D11RenderWindow;
-	class D3D11Texture;
-	class D3D11TextureManager;
-	class D3D11DepthBuffer;
-	class D3D11Driver;
-	class D3D11DriverList;
-	class D3D11VideoMode;
-	class D3D11VideoModeList;
-	class D3D11GpuProgramManager;
-	class D3D11IndexBuffer;
-	class D3D11HardwareConstantBuffer;
-	class D3D11HLSLProgramFactory;
-	class D3D11HLSLProgram;
-	class D3D11VertexDeclaration;
-	class D3D11Device;
-	class D3D11HardwareBuffer;
-	class D3D11GpuVertexProgram;
-	class D3D11GpuFragmentProgram;
-	class D3D11GpuGeometryProgram;
-	class D3D11GpuHullProgram;
-	class D3D11GpuDomainProgram;
-	class D3D11BlendState;
-	class D3D11RasterizerState;
-	class D3D11SamplerState;
-	class D3D11DepthStencilState;
-	class D3D11InputLayoutManager;
-	class D3D11GpuBufferCore;
-	class D3D11RenderUtility;
-	class D3D11GpuProgramCore;
-
-	/**	DirectX 11 specific types to track resource statistics for. */
-	enum D3D11RenderStatResourceType
-	{
-		RenderStatObject_DepthStencilState = 100,
-		RenderStatObject_RasterizerState,
-		RenderStatObject_BlendState,
-		RenderStatObject_SamplerState,
-		RenderStatObject_InputLayout,
-		RenderStatObject_ResourceView,
-		RenderStatObject_SwapChain
-	};
-
-	typedef Vector<char*> HLSLMicroCode;
-
-	typedef std::shared_ptr<D3D11GpuVertexProgram> D3D11GpuVertexProgramPtr;
-	typedef std::shared_ptr<D3D11GpuFragmentProgram> D3D11GpuFragmentProgramPtr;
-	typedef std::shared_ptr<D3D11GpuGeometryProgram> D3D11GpuGeometryProgramPtr;
-	typedef std::shared_ptr<D3D11GpuHullProgram> D3D11GpuHullProgramPtr;
-	typedef std::shared_ptr<D3D11GpuDomainProgram> D3D11GpuDomainProgramPtr;
-	typedef std::shared_ptr<D3D11BlendState> D3D11BlendStatePtr;
-	typedef std::shared_ptr<D3D11RasterizerState> D3D11RasterizerStatePtr;
-	typedef std::shared_ptr<D3D11SamplerState> D3D11SamplerStatePtr;
-	typedef std::shared_ptr<D3D11DepthStencilState> D3D11DepthStencilStatePtr;
-	typedef std::shared_ptr<D3D11RenderWindow> D3D11RenderWindowPtr;
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
-#	ifdef BS_RSD3D11_EXPORTS
-#		define BS_D3D11_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_D3D11_EXPORT
-#       else
-#    		define BS_D3D11_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#else
-#	define BS_D3D11_EXPORT
-#endif
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+#define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
+
+#if BS_DEBUG_MODE
+#	define D3D_DEBUG_INFO
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // Required to stop windows.h messing up std::min
+#endif
+
+#include <d3d11.h>
+#include <d3d11shader.h>
+#include <D3Dcompiler.h>
+
+/** @addtogroup Plugins/
+
+/** @defgroup D3D11 BansheeD3D11RenderAPI
+ *	Wrapper around the DirectX 11 render API.
+ */
+
+/** @} */
+
+namespace BansheeEngine
+{
+	class D3D11RenderAPI;
+	class D3D11RenderWindow;
+	class D3D11Texture;
+	class D3D11TextureManager;
+	class D3D11DepthBuffer;
+	class D3D11Driver;
+	class D3D11DriverList;
+	class D3D11VideoMode;
+	class D3D11VideoModeList;
+	class D3D11GpuProgramManager;
+	class D3D11IndexBuffer;
+	class D3D11HardwareConstantBuffer;
+	class D3D11HLSLProgramFactory;
+	class D3D11HLSLProgram;
+	class D3D11VertexDeclaration;
+	class D3D11Device;
+	class D3D11HardwareBuffer;
+	class D3D11GpuVertexProgram;
+	class D3D11GpuFragmentProgram;
+	class D3D11GpuGeometryProgram;
+	class D3D11GpuHullProgram;
+	class D3D11GpuDomainProgram;
+	class D3D11BlendState;
+	class D3D11RasterizerState;
+	class D3D11SamplerState;
+	class D3D11DepthStencilState;
+	class D3D11InputLayoutManager;
+	class D3D11GpuBufferCore;
+	class D3D11RenderUtility;
+	class D3D11GpuProgramCore;
+
+	/**	DirectX 11 specific types to track resource statistics for. */
+	enum D3D11RenderStatResourceType
+	{
+		RenderStatObject_DepthStencilState = 100,
+		RenderStatObject_RasterizerState,
+		RenderStatObject_BlendState,
+		RenderStatObject_SamplerState,
+		RenderStatObject_InputLayout,
+		RenderStatObject_ResourceView,
+		RenderStatObject_SwapChain
+	};
+
+	typedef Vector<char*> HLSLMicroCode;
+
+	typedef std::shared_ptr<D3D11GpuVertexProgram> D3D11GpuVertexProgramPtr;
+	typedef std::shared_ptr<D3D11GpuFragmentProgram> D3D11GpuFragmentProgramPtr;
+	typedef std::shared_ptr<D3D11GpuGeometryProgram> D3D11GpuGeometryProgramPtr;
+	typedef std::shared_ptr<D3D11GpuHullProgram> D3D11GpuHullProgramPtr;
+	typedef std::shared_ptr<D3D11GpuDomainProgram> D3D11GpuDomainProgramPtr;
+	typedef std::shared_ptr<D3D11BlendState> D3D11BlendStatePtr;
+	typedef std::shared_ptr<D3D11RasterizerState> D3D11RasterizerStatePtr;
+	typedef std::shared_ptr<D3D11SamplerState> D3D11SamplerStatePtr;
+	typedef std::shared_ptr<D3D11DepthStencilState> D3D11DepthStencilStatePtr;
+	typedef std::shared_ptr<D3D11RenderWindow> D3D11RenderWindowPtr;
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
+#	ifdef BS_RSD3D11_EXPORTS
+#		define BS_D3D11_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_D3D11_EXPORT
+#       else
+#    		define BS_D3D11_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#else
+#	define BS_D3D11_EXPORT
+#endif
 }
 }

+ 28 - 30
Source/BansheeD3D11RenderAPI/Include/BsD3D11QueryManager.h

@@ -1,31 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsQueryManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation of DirectX 11 queries.
-	 */
-	class BS_D3D11_EXPORT D3D11QueryManager : public QueryManager
-	{
-	public:
-		/**
-		 * @copydoc		QueryManager::createEventQuery
-		 */
-		EventQueryPtr createEventQuery() const;
-
-		/**
-		 * @copydoc		QueryManager::createTimerQuery
-		 */
-		TimerQueryPtr createTimerQuery() const;
-
-		/**
-		 * @copydoc		QueryManager::createOcclusionQuery
-		 */
-		OcclusionQueryPtr createOcclusionQuery(bool binary) const;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsQueryManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles creation of DirectX 11 queries. */
+	class BS_D3D11_EXPORT D3D11QueryManager : public QueryManager
+	{
+	public:
+		/** @copydoc QueryManager::createEventQuery */
+		EventQueryPtr createEventQuery() const override;
+
+		/** @copydoc QueryManager::createTimerQuery */
+		TimerQueryPtr createTimerQuery() const override;
+
+		/** @copydoc QueryManager::createOcclusionQuery */
+		OcclusionQueryPtr createOcclusionQuery(bool binary) const override;
+	};
+
+	/** @} */
 }
 }

+ 32 - 31
Source/BansheeD3D11RenderAPI/Include/BsD3D11RasterizerState.h

@@ -1,32 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsRasterizerState.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of a rasterizer state. Wraps a DX11
-	 *			rasterizer state object.
-	 */
-	class BS_D3D11_EXPORT D3D11RasterizerStateCore : public RasterizerStateCore
-	{
-	public:
-		~D3D11RasterizerStateCore();
-		ID3D11RasterizerState* getInternal() const { return mRasterizerState; }
-
-	protected:
-		friend class D3D11RenderStateCoreManager;
-
-		D3D11RasterizerStateCore(const RASTERIZER_STATE_DESC& desc, UINT32 id);
-
-		/**
-		 * @copydoc RasterizerStateCore::createInternal
-		 */
-		void createInternal() override;
-
-		ID3D11RasterizerState* mRasterizerState;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsRasterizerState.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** DirectX 11 implementation of a rasterizer state. Wraps a DX11 rasterizer state object. */
+	class BS_D3D11_EXPORT D3D11RasterizerStateCore : public RasterizerStateCore
+	{
+	public:
+		~D3D11RasterizerStateCore();
+		ID3D11RasterizerState* getInternal() const { return mRasterizerState; }
+
+	protected:
+		friend class D3D11RenderStateCoreManager;
+
+		D3D11RasterizerStateCore(const RASTERIZER_STATE_DESC& desc, UINT32 id);
+
+		/** @copydoc RasterizerStateCore::createInternal */
+		void createInternal() override;
+
+		ID3D11RasterizerState* mRasterizerState;
+	};
+
+	/** @} */
 }
 }

+ 201 - 283
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderAPI.h

@@ -1,284 +1,202 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsRenderAPI.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Implementation of a render system using DirectX 11. Provides abstracted
-	 *			access to various low level DX11 methods.
-	 */
-	class BS_D3D11_EXPORT D3D11RenderAPI : public RenderAPICore
-	{
-	public:
-		D3D11RenderAPI();
-		~D3D11RenderAPI();
-
-		/**
-		 * @copydoc RenderAPICore::getName
-		 */
-		const StringID& getName() const override;
-		
-		/**
-		 * @copydoc RenderAPICore::getShadingLanguageName
-		 */
-		const String& getShadingLanguageName() const override;
-
-		/**
-		 * @copydoc	RenderAPICore::setBlendState
-		 */
-		void setBlendState(const SPtr<BlendStateCore>& blendState) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setRasterizerState
-		 */
-		void setRasterizerState(const SPtr<RasterizerStateCore>& rasterizerState) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setDepthStencilState
-		 */
-		void setDepthStencilState(const SPtr<DepthStencilStateCore>& depthStencilState, UINT32 stencilRefValue) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setSamplerState
-		 */
-		void setSamplerState(GpuProgramType gptype, UINT16 texUnit, const SPtr<SamplerStateCore>& samplerState) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setTexture
-		 */
-		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setLoadStoreTexture
-		 */
-		void setLoadStoreTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr,
-			const TextureSurface& surface) override;
-
-		/**
-		 * @copydoc	RenderAPICore::disableTextureUnit
-		 */
-		void disableTextureUnit(GpuProgramType gptype, UINT16 texUnit) override;
-
-		/**
-		 * @copydoc	RenderAPICore::beginFrame
-		 */
-		void beginFrame() override;
-
-		/**
-		 * @copydoc	RenderAPICore::endFrame
-		 */
-		void endFrame() override;
-
-		/**
-		 * @copydoc RenderAPICore::clearRenderTarget
-		 */
-		void clearRenderTarget(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
-			UINT8 targetMask = 0xFF) override;
-
-		/**
-		 * @copydoc RenderAPICore::clearViewport
-		 */
-		void clearViewport(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0,
-			UINT8 targetMask = 0xFF) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setRenderTarget
-		 */
-		void setRenderTarget(const SPtr<RenderTargetCore>& target, bool readOnlyDepthStencil = false) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setViewport
-		 */
-		void setViewport(const Rect2& vp) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setScissorRect
-		 */
-		void setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setVertexBuffers
-		 */
-		void setVertexBuffers(UINT32 index, SPtr<VertexBufferCore>* buffers, UINT32 numBuffers) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setIndexBuffer
-		 */
-		void setIndexBuffer(const SPtr<IndexBufferCore>& buffer) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setVertexDeclaration
-		 */
-		void setVertexDeclaration(const SPtr<VertexDeclarationCore>& vertexDeclaration) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setDrawOperation
-		 */
-		void setDrawOperation(DrawOperationType op) override;
-
-		/**
-		 * @copydoc	RenderAPICore::draw
-		 */
-		void draw(UINT32 vertexOffset, UINT32 vertexCount) override;
-
-		/**
-		 * @copydoc	RenderAPICore::drawIndexed
-		 */
-		void drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount) override;
-
-		/**
-		 * @copydoc RenderAPICore::drawIndexed()
-		 */
-		void dispatchCompute(UINT32 numGroupsX, UINT32 numGroupsY = 1, UINT32 numGroupsZ = 1) override;
-
-		/** 
-		 * @copydoc RenderAPICore::bindGpuProgram
-		 */
-		void bindGpuProgram(const SPtr<GpuProgramCore>& prg) override;
-
-		/** 
-		 * @copydoc RenderAPICore::unbindGpuProgram
-		 */
-		void unbindGpuProgram(GpuProgramType gptype) override;
-
-		/** 
-		 * @copydoc RenderAPICore::setConstantBuffers
-		 */
-		void setConstantBuffers(GpuProgramType gptype, const SPtr<GpuParamsCore>& params) override;
-		
-		/**
-		 * @copydoc	RenderAPICore::setClipPlanesImpl
-		 */
-		void setClipPlanesImpl(const PlaneList& clipPlanes) override;
-
-		/**
-		 * @copydoc	RenderAPICore::convertProjectionMatrix
-		 */
-		void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest) override;
-
-		/**
-		 * @copydoc	RenderAPICore::getColorVertexElementType
-		 */
-		VertexElementType getColorVertexElementType() const override;
-
-		/**
-		 * @copydoc	RenderAPICore::getHorizontalTexelOffset
-		 */
-		float getHorizontalTexelOffset() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getVerticalTexelOffset
-		 */
-		float getVerticalTexelOffset() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getMinimumDepthInputValue
-		 */
-		float getMinimumDepthInputValue() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getMaximumDepthInputValue
-		 */
-		float getMaximumDepthInputValue() override;
-
-		/**
-		 * @copydoc RenderAPICore::generateParamBlockDesc()
-		 */
-		GpuParamBlockDesc generateParamBlockDesc(const String& name, Vector<GpuParamDataDesc>& params) override;
-
-		/************************************************************************/
-		/* 				Internal use by DX11 RenderSystem only                  */
-		/************************************************************************/
-
-		/**
-		 * @brief	Determines DXGI multisample settings from the provided parameters.
-		 *
-		 * @param	multisampleCount	Number of requested samples.
-		 * @param	format				Pixel format used by the render target.
-		 * @param	outputSampleDesc	Output structure that will contain the requested multisample settings.
-		 */
-		void determineMultisampleSettings(UINT32 multisampleCount, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outputSampleDesc);
-
-		/**
-		 * @brief	Returns the main DXGI factory object.
-		 */
-		IDXGIFactory* getDXGIFactory() const { return mDXGIFactory; }
-
-		/**
-		 * @brief	Returns the primary DX11 device object.
-		 */
-		D3D11Device& getPrimaryDevice() const { return *mDevice; }
-		
-		/**
-		 * @brief	Returns information describing all available drivers.
-		 */
-		D3D11DriverList* getDriverList() const { return mDriverList; }
-
-	protected:
-		friend class D3D11RenderAPIFactory;
-
-		/**
-		 * @copydoc	RenderAPICore::initializePrepare
-		 */
-		void initializePrepare() override;
-
-		/**
-		 * @copydoc	RenderAPICore::initializeFinalize
-		 */
-		void initializeFinalize(const SPtr<RenderWindowCore>& primaryWindow) override;
-
-		/**
-		 * @copydoc	RenderAPICore::destroy_internal
-		 */
-		void destroyCore() override;
-
-		/**
-		 * @brief	Creates or retrieves a proper input layout depending on the currently set vertex shader
-		 * 			and vertex buffer.
-		 *
-		 *			Applies the input layout to the pipeline.
-		 */
-		void applyInputLayout();
-
-		/**
-		 * @brief	Recalculates actual viewport dimensions based on currently 
-		 *			set viewport normalized dimensions and render target and applies
-		 *			them for further rendering.
-		 */
-		void applyViewport();
-
-		/**
-		 * @brief	Creates and populates a set of render system capabilities describing which functionality
-		 *			is available.
-		 */
-		RenderAPICapabilities* createRenderSystemCapabilities() const;
-
-	private:
-		IDXGIFactory* mDXGIFactory;
-		D3D11Device* mDevice;
-
-		D3D11DriverList* mDriverList;
-		D3D11Driver* mActiveD3DDriver;
-
-		D3D_FEATURE_LEVEL mFeatureLevel;
-
-		D3D11HLSLProgramFactory* mHLSLFactory;
-		D3D11InputLayoutManager* mIAManager;
-
-		std::pair<SPtr<TextureCore>, TextureViewPtr> mBoundUAVs[D3D11_PS_CS_UAV_REGISTER_COUNT];
-
-		UINT32 mStencilRef;
-		Rect2 mViewportNorm;
-		D3D11_VIEWPORT mViewport;
-		D3D11_RECT mScissorRect;
-
-		SPtr<VertexDeclarationCore> mActiveVertexDeclaration;
-		SPtr<D3D11GpuProgramCore> mActiveVertexShader;
-
-		DrawOperationType mActiveDrawOp;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsRenderAPI.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** Implementation of a render system using DirectX 11. Provides abstracted access to various low level DX11 methods. */
+	class BS_D3D11_EXPORT D3D11RenderAPI : public RenderAPICore
+	{
+	public:
+		D3D11RenderAPI();
+		~D3D11RenderAPI();
+
+		/** @copydoc RenderAPICore::getName */
+		const StringID& getName() const override;
+		
+		/** @copydoc RenderAPICore::getShadingLanguageName */
+		const String& getShadingLanguageName() const override;
+
+		/** @copydoc RenderAPICore::setBlendState */
+		void setBlendState(const SPtr<BlendStateCore>& blendState) override;
+
+		/** @copydoc RenderAPICore::setRasterizerState */
+		void setRasterizerState(const SPtr<RasterizerStateCore>& rasterizerState) override;
+
+		/** @copydoc RenderAPICore::setDepthStencilState */
+		void setDepthStencilState(const SPtr<DepthStencilStateCore>& depthStencilState, UINT32 stencilRefValue) override;
+
+		/** @copydoc RenderAPICore::setSamplerState */
+		void setSamplerState(GpuProgramType gptype, UINT16 texUnit, const SPtr<SamplerStateCore>& samplerState) override;
+
+		/** @copydoc RenderAPICore::setTexture */
+		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr) override;
+
+		/** @copydoc RenderAPICore::setLoadStoreTexture */
+		void setLoadStoreTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr,
+			const TextureSurface& surface) override;
+
+		/** @copydoc RenderAPICore::disableTextureUnit */
+		void disableTextureUnit(GpuProgramType gptype, UINT16 texUnit) override;
+
+		/** @copydoc RenderAPICore::beginFrame */
+		void beginFrame() override;
+
+		/** @copydoc RenderAPICore::endFrame */
+		void endFrame() override;
+
+		/** @copydoc RenderAPICore::clearRenderTarget */
+		void clearRenderTarget(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
+			UINT8 targetMask = 0xFF) override;
+
+		/** @copydoc RenderAPICore::clearViewport */
+		void clearViewport(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0,
+			UINT8 targetMask = 0xFF) override;
+
+		/** @copydoc RenderAPICore::setRenderTarget */
+		void setRenderTarget(const SPtr<RenderTargetCore>& target, bool readOnlyDepthStencil = false) override;
+
+		/** @copydoc RenderAPICore::setViewport */
+		void setViewport(const Rect2& vp) override;
+
+		/** @copydoc RenderAPICore::setScissorRect */
+		void setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom) override;
+
+		/** @copydoc RenderAPICore::setVertexBuffers */
+		void setVertexBuffers(UINT32 index, SPtr<VertexBufferCore>* buffers, UINT32 numBuffers) override;
+
+		/** @copydoc RenderAPICore::setIndexBuffer */
+		void setIndexBuffer(const SPtr<IndexBufferCore>& buffer) override;
+
+		/** @copydoc RenderAPICore::setVertexDeclaration */
+		void setVertexDeclaration(const SPtr<VertexDeclarationCore>& vertexDeclaration) override;
+
+		/** @copydoc RenderAPICore::setDrawOperation */
+		void setDrawOperation(DrawOperationType op) override;
+
+		/** @copydoc RenderAPICore::draw */
+		void draw(UINT32 vertexOffset, UINT32 vertexCount) override;
+
+		/** @copydoc RenderAPICore::drawIndexed */
+		void drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount) override;
+
+		/** @copydoc RenderAPICore::dispatchCompute */
+		void dispatchCompute(UINT32 numGroupsX, UINT32 numGroupsY = 1, UINT32 numGroupsZ = 1) override;
+
+		/** @copydoc RenderAPICore::bindGpuProgram */
+		void bindGpuProgram(const SPtr<GpuProgramCore>& prg) override;
+
+		/** @copydoc RenderAPICore::unbindGpuProgram */
+		void unbindGpuProgram(GpuProgramType gptype) override;
+
+		/** @copydoc RenderAPICore::setConstantBuffers */
+		void setConstantBuffers(GpuProgramType gptype, const SPtr<GpuParamsCore>& params) override;
+		
+		/** @copydoc RenderAPICore::setClipPlanesImpl */
+		void setClipPlanesImpl(const PlaneList& clipPlanes) override;
+
+		/** @copydoc RenderAPICore::convertProjectionMatrix */
+		void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest) override;
+
+		/** @copydoc RenderAPICore::getColorVertexElementType */
+		VertexElementType getColorVertexElementType() const override;
+
+		/** @copydoc RenderAPICore::getHorizontalTexelOffset */
+		float getHorizontalTexelOffset() override;
+
+		/** @copydoc RenderAPICore::getVerticalTexelOffset */
+		float getVerticalTexelOffset() override;
+
+		/** @copydoc RenderAPICore::getMinimumDepthInputValue */
+		float getMinimumDepthInputValue() override;
+
+		/** @copydoc RenderAPICore::getMaximumDepthInputValue */
+		float getMaximumDepthInputValue() override;
+
+		/** @copydoc RenderAPICore::generateParamBlockDesc() */
+		GpuParamBlockDesc generateParamBlockDesc(const String& name, Vector<GpuParamDataDesc>& params) override;
+
+		/************************************************************************/
+		/* 				Internal use by DX11 RenderSystem only                  */
+		/************************************************************************/
+
+		/**
+		 * Determines DXGI multisample settings from the provided parameters.
+		 *
+		 * @param[in]	multisampleCount	Number of requested samples.
+		 * @param[in]	format				Pixel format used by the render target.
+		 * @param[out]	outputSampleDesc	Output structure that will contain the requested multisample settings.
+		 */
+		void determineMultisampleSettings(UINT32 multisampleCount, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outputSampleDesc);
+
+		/**	Returns the main DXGI factory object. */
+		IDXGIFactory* getDXGIFactory() const { return mDXGIFactory; }
+
+		/**	Returns the primary DX11 device object. */
+		D3D11Device& getPrimaryDevice() const { return *mDevice; }
+		
+		/**	Returns information describing all available drivers. */
+		D3D11DriverList* getDriverList() const { return mDriverList; }
+
+	protected:
+		friend class D3D11RenderAPIFactory;
+
+		/** @copydoc RenderAPICore::initializePrepare */
+		void initializePrepare() override;
+
+		/** @copydoc RenderAPICore::initializeFinalize */
+		void initializeFinalize(const SPtr<RenderWindowCore>& primaryWindow) override;
+
+		/** @copydoc RenderAPICore::destroy_internal */
+		void destroyCore() override;
+
+		/**
+		 * Creates or retrieves a proper input layout depending on the currently set vertex shader and vertex buffer.
+		 *
+		 * Applies the input layout to the pipeline.
+		 */
+		void applyInputLayout();
+
+		/**
+		 * Recalculates actual viewport dimensions based on currently set viewport normalized dimensions and render target
+		 * and applies them for further rendering.
+		 */
+		void applyViewport();
+
+		/** Creates and populates a set of render system capabilities describing which functionality is available. */
+		RenderAPICapabilities* createRenderSystemCapabilities() const;
+
+	private:
+		IDXGIFactory* mDXGIFactory;
+		D3D11Device* mDevice;
+
+		D3D11DriverList* mDriverList;
+		D3D11Driver* mActiveD3DDriver;
+
+		D3D_FEATURE_LEVEL mFeatureLevel;
+
+		D3D11HLSLProgramFactory* mHLSLFactory;
+		D3D11InputLayoutManager* mIAManager;
+
+		std::pair<SPtr<TextureCore>, TextureViewPtr> mBoundUAVs[D3D11_PS_CS_UAV_REGISTER_COUNT];
+
+		UINT32 mStencilRef;
+		Rect2 mViewportNorm;
+		D3D11_VIEWPORT mViewport;
+		D3D11_RECT mScissorRect;
+
+		SPtr<VertexDeclarationCore> mActiveVertexDeclaration;
+		SPtr<D3D11GpuProgramCore> mActiveVertexShader;
+
+		DrawOperationType mActiveDrawOp;
+	};
+
+	/** @} */
 }
 }

+ 48 - 50
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderAPIFactory.h

@@ -1,51 +1,49 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include <string>
-#include "BsRenderAPIFactory.h"
-#include "BsRenderAPIManager.h"
-#include "BsD3D11RenderAPI.h"
-
-namespace BansheeEngine
-{
-	const String SystemName = "BansheeD3D11RenderSystem";
-
-	/**
-	 * @brief	Handles creation of the DX11 render system.
-	 */
-	class D3D11RenderAPIFactory : public RenderAPIFactory
-	{
-	public:
-		/**
-		 * @copydoc	RenderSystemFactory::create
-		 */
-		virtual void create();
-
-		/**
-		 * @copydoc	RenderSystemFactory::name
-		 */
-		virtual const String& name() const { return SystemName; }
-
-	private:
-
-		/**
-		 * @brief	Registers the factory with the render system manager when constructed.
-		 */
-		class InitOnStart
-		{
-		public:
-			InitOnStart() 
-			{ 
-				static RenderAPIFactoryPtr newFactory;
-				if(newFactory == nullptr)
-				{
-					newFactory = bs_shared_ptr_new<D3D11RenderAPIFactory>();
-					RenderAPIManager::instance().registerFactory(newFactory);
-				}
-			}
-		};
-
-		static InitOnStart initOnStart; // Makes sure factory is registered on program start
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include <string>
+#include "BsRenderAPIFactory.h"
+#include "BsRenderAPIManager.h"
+#include "BsD3D11RenderAPI.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	const String SystemName = "BansheeD3D11RenderSystem";
+
+	/**	Handles creation of the DX11 render system. */
+	class D3D11RenderAPIFactory : public RenderAPIFactory
+	{
+	public:
+		/** @copydoc RenderSystemFactory::create */
+		void create() override;
+
+		/** @copydoc RenderSystemFactory::name */
+		const String& name() const override { return SystemName; }
+
+	private:
+
+		/**	Registers the factory with the render system manager when constructed. */
+		class InitOnStart
+		{
+		public:
+			InitOnStart() 
+			{ 
+				static RenderAPIFactoryPtr newFactory;
+				if(newFactory == nullptr)
+				{
+					newFactory = bs_shared_ptr_new<D3D11RenderAPIFactory>();
+					RenderAPIManager::instance().registerFactory(newFactory);
+				}
+			}
+		};
+
+		static InitOnStart initOnStart; // Makes sure factory is registered on program start
+	};
+
+	/** @} */
 }
 }

+ 31 - 35
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderStateManager.h

@@ -1,36 +1,32 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsRenderStateManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation of DirectX 11 pipeline states.
-	 */
-	class BS_D3D11_EXPORT D3D11RenderStateCoreManager : public RenderStateCoreManager
-	{
-	protected:
-		/**
-		 * @copydoc	RenderStateCoreManager::createSamplerStateInternal
-		 */
-		virtual SPtr<SamplerStateCore> createSamplerStateInternal(const SAMPLER_STATE_DESC& desc) const override;
-
-		/**
-		 * @copydoc	RenderStateCoreManager::createBlendStateInternal
-		 */
-		virtual SPtr<BlendStateCore> createBlendStateInternal(const BLEND_STATE_DESC& desc, UINT32 id) const override;
-
-		/**
-		 * @copydoc	RenderStateCoreManager::createRasterizerStateInternal
-		 */
-		virtual SPtr<RasterizerStateCore> createRasterizerStateInternal(const RASTERIZER_STATE_DESC& desc, UINT32 id) const override;
-
-		/**
-		 * @copydoc	RenderStateCoreManager::createDepthStencilStateInternal
-		 */
-		virtual SPtr<DepthStencilStateCore> createDepthStencilStateInternal(const DEPTH_STENCIL_STATE_DESC& desc, UINT32 id) const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsRenderStateManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles creation of DirectX 11 pipeline states. */
+	class BS_D3D11_EXPORT D3D11RenderStateCoreManager : public RenderStateCoreManager
+	{
+	protected:
+		/** @copydoc RenderStateCoreManager::createSamplerStateInternal */
+		virtual SPtr<SamplerStateCore> createSamplerStateInternal(const SAMPLER_STATE_DESC& desc) const override;
+
+		/** @copydoc RenderStateCoreManager::createBlendStateInternal */
+		virtual SPtr<BlendStateCore> createBlendStateInternal(const BLEND_STATE_DESC& desc, UINT32 id) const override;
+
+		/** @copydoc RenderStateCoreManager::createRasterizerStateInternal */
+		virtual SPtr<RasterizerStateCore> createRasterizerStateInternal(const RASTERIZER_STATE_DESC& desc, UINT32 id) const override;
+
+		/** @copydoc RenderStateCoreManager::createDepthStencilStateInternal */
+		virtual SPtr<DepthStencilStateCore> createDepthStencilStateInternal(const DEPTH_STENCIL_STATE_DESC& desc, UINT32 id) const override;
+	};
+
+	/** @} */
 }
 }

+ 59 - 53
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderTexture.h

@@ -1,54 +1,60 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsTexture.h"
-#include "BsRenderTexture.h"
-
-namespace BansheeEngine
-{
-	class D3D11RenderTexture;
-
-	/**
-	 * DirectX 11 implementation of a render texture.
-	 *
-	 * @note	Core thread only.
-	 */
-	class D3D11RenderTextureCore : public RenderTextureCore
-	{
-	public:
-		D3D11RenderTextureCore(const RENDER_TEXTURE_CORE_DESC& desc);
-		virtual ~D3D11RenderTextureCore() { }
-
-		/** @copydoc RenderTextureCore::getCustomAttribute */
-		void getCustomAttribute(const String& name, void* pData) const override;
-
-	protected:
-		/** @copydoc RenderTextureCore::getProperties */
-		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
-
-		RenderTextureProperties mProperties;
-	};
-
-	/**
-	 * DirectX 11 implementation of a render texture.
-	 *
-	 * @note	Sim thread only.
-	 */
-	class D3D11RenderTexture : public RenderTexture
-	{
-	public:
-		virtual ~D3D11RenderTexture() { }
-
-	protected:
-		friend class D3D11TextureManager;
-
-		D3D11RenderTexture(const RENDER_TEXTURE_DESC& desc);
-
-		/** @copydoc RenderTexture::getProperties */
-		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
-
-		RenderTextureProperties mProperties;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsTexture.h"
+#include "BsRenderTexture.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	class D3D11RenderTexture;
+
+	/**
+	 * DirectX 11 implementation of a render texture.
+	 *
+	 * @note	Core thread only.
+	 */
+	class D3D11RenderTextureCore : public RenderTextureCore
+	{
+	public:
+		D3D11RenderTextureCore(const RENDER_TEXTURE_CORE_DESC& desc);
+		virtual ~D3D11RenderTextureCore() { }
+
+		/** @copydoc RenderTextureCore::getCustomAttribute */
+		void getCustomAttribute(const String& name, void* pData) const override;
+
+	protected:
+		/** @copydoc RenderTextureCore::getProperties */
+		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
+
+		RenderTextureProperties mProperties;
+	};
+
+	/**
+	 * DirectX 11 implementation of a render texture.
+	 *
+	 * @note	Sim thread only.
+	 */
+	class D3D11RenderTexture : public RenderTexture
+	{
+	public:
+		virtual ~D3D11RenderTexture() { }
+
+	protected:
+		friend class D3D11TextureManager;
+
+		D3D11RenderTexture(const RENDER_TEXTURE_DESC& desc);
+
+		/** @copydoc RenderTexture::getProperties */
+		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
+
+		RenderTextureProperties mProperties;
+	};
+
+	/** @} */
 }
 }

+ 55 - 53
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderUtility.h

@@ -1,54 +1,56 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsModule.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Helper class for DX11 rendering.
-	 */
-	class D3D11RenderUtility : public Module<D3D11RenderUtility>
-	{
-	public:
-		D3D11RenderUtility(D3D11Device* device);
-		~D3D11RenderUtility();
-
-		/**
-		 * @brief	Draws a quad that clears the current viewport. This is supposed to emulate functionality
-		 *			available with other APIs like DX9 and OpenGL where you can clear only a part of the render target.
-		 *			(DX11 API only provides a way to clear the entire render target).
-		 *
-		 * @param	buffers			Combination of one or more elements of FrameBufferType
-		 *							denoting which buffers are to be cleared.
-		 * @param	color			(optional) The color to clear the color buffer with, if enabled.
-		 * @param	depth			(optional) The value to initialize the depth buffer with, if enabled.
-		 * @param	stencil			(optional) The value to initialize the stencil buffer with, if enabled.
-		 */
-		void drawClearQuad(UINT32 clearBuffers, const Color& color, float depth, UINT16 stencil);
-
-	protected:
-		/**
-		 * @brief	Initializes resources needed for drawing the clear quad. Should be called one time at start-up.
-		 */
-		void initClearQuadResources();
-
-		D3D11Device* mDevice;
-
-		ID3D11Buffer* mClearQuadIB;
-		ID3D11Buffer* mClearQuadVB;
-		ID3D11InputLayout* mClearQuadIL;
-		ID3D11VertexShader* mClearQuadVS;
-		ID3D11PixelShader* mClearQuadPS;
-
-		SPtr<BlendStateCore> mClearQuadBlendStateYesC;
-		SPtr<BlendStateCore> mClearQuadBlendStateNoC;
-		SPtr<RasterizerStateCore> mClearQuadRasterizerState;
-		SPtr<DepthStencilStateCore> mClearQuadDSStateNoD_NoS;
-		SPtr<DepthStencilStateCore> mClearQuadDSStateYesD_NoS;
-		SPtr<DepthStencilStateCore> mClearQuadDSStateYesD_YesS;
-		SPtr<DepthStencilStateCore> mClearQuadDSStateNoD_YesS;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Helper class for DX11 rendering. */
+	class D3D11RenderUtility : public Module<D3D11RenderUtility>
+	{
+	public:
+		D3D11RenderUtility(D3D11Device* device);
+		~D3D11RenderUtility();
+
+		/**
+		 * Draws a quad that clears the current viewport. This is supposed to emulate functionality available with other
+		 * APIs like DX9 and OpenGL where you can clear only a part of the render target. (DX11 API only provides a way to
+		 * clear the entire render target).
+		 *
+		 * @param[in]	buffers			Combination of one or more elements of FrameBufferType denoting which buffers are
+		 *								to be cleared.
+		 * @param[in]	color			(optional) The color to clear the color buffer with, if enabled.
+		 * @param[in]	depth			(optional) The value to initialize the depth buffer with, if enabled.
+		 * @param[in]	stencil			(optional) The value to initialize the stencil buffer with, if enabled.
+		 */
+		void drawClearQuad(UINT32 clearBuffers, const Color& color, float depth, UINT16 stencil);
+
+	protected:
+		/**	Initializes resources needed for drawing the clear quad. Should be called one time at start-up. */
+		void initClearQuadResources();
+
+		D3D11Device* mDevice;
+
+		ID3D11Buffer* mClearQuadIB;
+		ID3D11Buffer* mClearQuadVB;
+		ID3D11InputLayout* mClearQuadIL;
+		ID3D11VertexShader* mClearQuadVS;
+		ID3D11PixelShader* mClearQuadPS;
+
+		SPtr<BlendStateCore> mClearQuadBlendStateYesC;
+		SPtr<BlendStateCore> mClearQuadBlendStateNoC;
+		SPtr<RasterizerStateCore> mClearQuadRasterizerState;
+		SPtr<DepthStencilStateCore> mClearQuadDSStateNoD_NoS;
+		SPtr<DepthStencilStateCore> mClearQuadDSStateYesD_NoS;
+		SPtr<DepthStencilStateCore> mClearQuadDSStateYesD_YesS;
+		SPtr<DepthStencilStateCore> mClearQuadDSStateNoD_YesS;
+	};
+
+	/** @} */
 }
 }

+ 188 - 182
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderWindow.h

@@ -1,183 +1,189 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsRenderWindow.h"
-
-namespace BansheeEngine
-{
-	class D3D11RenderWindow;
-
-	/**	Contains various properties that describe a render window. */
-	class BS_D3D11_EXPORT D3D11RenderWindowProperties : public RenderWindowProperties
-	{
-	public:
-		D3D11RenderWindowProperties(const RENDER_WINDOW_DESC& desc);
-		virtual ~D3D11RenderWindowProperties() { }
-
-	private:
-		friend class D3D11RenderWindowCore;
-		friend class D3D11RenderWindow;
-	};
-
-	/**
-	 * Render window implementation for Windows and DirectX 11.
-	 *
-	 * @note	Core thread only.
-	 */
-	class BS_D3D11_EXPORT D3D11RenderWindowCore : public RenderWindowCore
-	{
-	public:
-		/** @copydoc RenderWindowCore::RenderWindowCore */
-		D3D11RenderWindowCore(const RENDER_WINDOW_DESC& desc, UINT32 windowId,
-			D3D11Device& device, IDXGIFactory* DXGIFactory);
-
-		~D3D11RenderWindowCore();
-
-		/** @copydoc RenderWindowCore::move */
-		void move(INT32 left, INT32 top) override;
-
-		/** @copydoc RenderWindowCore::resize */
-		void resize(UINT32 width, UINT32 height) override;
-
-		/** @copydoc RenderWindowCore::setHidden */
-		void setHidden(bool hidden) override;
-
-		/** @copydoc RenderWindowCore::setActive */
-		void setActive(bool state) override;
-
-		/** @copydoc RenderWindowCore::minimize */
-		void minimize() override;
-
-		/** @copydoc RenderWindowCore::maximize */
-		void maximize() override;
-
-		/** @copydoc RenderWindowCore::restore */
-		void restore() override;
-
-		/** @copydoc RenderWindowCore::setFullscreen(UINT32, UINT32, float, UINT32) */
-		void setFullscreen(UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0) override;
-
-		/** @copydoc RenderWindowCore::setFullscreen(const VideoMode&) */
-		void setFullscreen(const VideoMode& mode) override;
-
-		/** @copydoc RenderWindowCore::setWindowed */
-		void setWindowed(UINT32 width, UINT32 height) override;
-
-		/** @copydoc RenderWindowCore::copyContentsToMemory */
-		void copyToMemory(PixelData &dst, FrameBuffer buffer);
-
-		/** @copydoc RenderWindowCore::swapBuffers */
-		void swapBuffers() override;
-
-		/** @copydoc RenderWindowCore::getCustomAttribute */
-		void getCustomAttribute(const String& name, void* pData) const override;
-
-		/** @copydoc RenderWindowCore::_windowMovedOrResized */
-		void _windowMovedOrResized() override;
-
-		/**	Returns presentation parameters used for creating the window swap chain. */
-		DXGI_SWAP_CHAIN_DESC* _getPresentationParameters() { return &mSwapChainDesc; }
-
-		/**	Returns internal window handle. */
-		HWND _getWindowHandle() const;
-
-	protected:
-		friend class D3D11RenderWindow;
-
-		/** @copydoc CoreObjectCore::initialize */
-		virtual void initialize() override;
-
-		/**	Creates internal resources dependent on window size. */
-		void createSizeDependedD3DResources();
-
-		/**	Destroys internal resources dependent on window size. */
-		void destroySizeDependedD3DResources();
-
-		/**	Queries the current DXGI device. Make sure to release the returned object when done with it. */
-		IDXGIDevice* queryDxgiDevice(); 
-
-		/**	Creates a swap chain for the window. */
-		void createSwapChain();
-
-		/**	Resizes all buffers attached to the swap chain to the specified size. */
-		void resizeSwapChainBuffers(UINT32 width, UINT32 height);
-
-		/** @copydoc RenderWindowCore::getProperties */
-		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
-
-		/** @copydoc RenderWindowCore::getSyncedProperties */
-		RenderWindowProperties& getSyncedProperties() override { return mSyncedProperties; }
-
-		/** @copydoc RenderWindowCore::syncProperties */
-		void syncProperties() override;
-
-	protected:
-		D3D11Device& mDevice;
-		IDXGIFactory* mDXGIFactory;
-		bool mSizing;
-		bool mIsChild;
-		bool mShowOnSwap;
-
-		DXGI_SAMPLE_DESC mMultisampleType;
-		UINT32 mRefreshRateNumerator;
-		UINT32 mRefreshRateDenominator;
-
-		ID3D11Texture2D* mBackBuffer;
-		ID3D11RenderTargetView*	mRenderTargetView;
-		TextureViewPtr mDepthStencilView;
-		SPtr<TextureCore> mDepthStencilBuffer;
-
-		IDXGISwapChain*	mSwapChain;
-		DXGI_SWAP_CHAIN_DESC mSwapChainDesc;
-		Win32Window* mWindow;
-
-		D3D11RenderWindowProperties mProperties;
-		D3D11RenderWindowProperties mSyncedProperties;
-	};
-
-	/**
-	 * Render window implementation for Windows and DirectX 11.
-	 *
-	 * @note	Sim thread only.
-	 */
-	class BS_D3D11_EXPORT D3D11RenderWindow : public RenderWindow
-	{
-	public:
-		~D3D11RenderWindow() { }
-
-		/** @copydoc RenderWindow::screenToWindowPos */
-		void getCustomAttribute(const String& name, void* pData) const override;
-
-		/** @copydoc RenderWindow::screenToWindowPos */
-		Vector2I screenToWindowPos(const Vector2I& screenPos) const override;
-
-		/** @copydoc RenderWindow::windowToScreenPos */
-		Vector2I windowToScreenPos(const Vector2I& windowPos) const override;
-
-		/** @copydoc RenderWindow::getCore */
-		SPtr<D3D11RenderWindowCore> getCore() const;
-
-	protected:
-		friend class D3D11RenderWindowManager;
-		friend class D3D11RenderWindowCore;
-
-		D3D11RenderWindow(const RENDER_WINDOW_DESC& desc, UINT32 windowId, 
-			D3D11Device& device, IDXGIFactory* DXGIFactory);
-
-		/** @copydoc RenderWindowCore::getProperties */
-		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
-
-		/** @copydoc RenderWindow::syncProperties */
-		void syncProperties() override;
-
-		/**	Retrieves internal window handle. */
-		HWND getHWnd() const;
-
-	private:
-		D3D11Device& mDevice;
-		IDXGIFactory* mDXGIFactory;
-		D3D11RenderWindowProperties mProperties;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsRenderWindow.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	class D3D11RenderWindow;
+
+	/**	Contains various properties that describe a render window. */
+	class BS_D3D11_EXPORT D3D11RenderWindowProperties : public RenderWindowProperties
+	{
+	public:
+		D3D11RenderWindowProperties(const RENDER_WINDOW_DESC& desc);
+		virtual ~D3D11RenderWindowProperties() { }
+
+	private:
+		friend class D3D11RenderWindowCore;
+		friend class D3D11RenderWindow;
+	};
+
+	/**
+	 * Render window implementation for Windows and DirectX 11.
+	 *
+	 * @note	Core thread only.
+	 */
+	class BS_D3D11_EXPORT D3D11RenderWindowCore : public RenderWindowCore
+	{
+	public:
+		/** @copydoc RenderWindowCore::RenderWindowCore */
+		D3D11RenderWindowCore(const RENDER_WINDOW_DESC& desc, UINT32 windowId,
+			D3D11Device& device, IDXGIFactory* DXGIFactory);
+
+		~D3D11RenderWindowCore();
+
+		/** @copydoc RenderWindowCore::move */
+		void move(INT32 left, INT32 top) override;
+
+		/** @copydoc RenderWindowCore::resize */
+		void resize(UINT32 width, UINT32 height) override;
+
+		/** @copydoc RenderWindowCore::setHidden */
+		void setHidden(bool hidden) override;
+
+		/** @copydoc RenderWindowCore::setActive */
+		void setActive(bool state) override;
+
+		/** @copydoc RenderWindowCore::minimize */
+		void minimize() override;
+
+		/** @copydoc RenderWindowCore::maximize */
+		void maximize() override;
+
+		/** @copydoc RenderWindowCore::restore */
+		void restore() override;
+
+		/** @copydoc RenderWindowCore::setFullscreen(UINT32, UINT32, float, UINT32) */
+		void setFullscreen(UINT32 width, UINT32 height, float refreshRate = 60.0f, UINT32 monitorIdx = 0) override;
+
+		/** @copydoc RenderWindowCore::setFullscreen(const VideoMode&) */
+		void setFullscreen(const VideoMode& mode) override;
+
+		/** @copydoc RenderWindowCore::setWindowed */
+		void setWindowed(UINT32 width, UINT32 height) override;
+
+		/** @copydoc RenderWindowCore::copyContentsToMemory */
+		void copyToMemory(PixelData &dst, FrameBuffer buffer);
+
+		/** @copydoc RenderWindowCore::swapBuffers */
+		void swapBuffers() override;
+
+		/** @copydoc RenderWindowCore::getCustomAttribute */
+		void getCustomAttribute(const String& name, void* pData) const override;
+
+		/** @copydoc RenderWindowCore::_windowMovedOrResized */
+		void _windowMovedOrResized() override;
+
+		/**	Returns presentation parameters used for creating the window swap chain. */
+		DXGI_SWAP_CHAIN_DESC* _getPresentationParameters() { return &mSwapChainDesc; }
+
+		/**	Returns internal window handle. */
+		HWND _getWindowHandle() const;
+
+	protected:
+		friend class D3D11RenderWindow;
+
+		/** @copydoc CoreObjectCore::initialize */
+		virtual void initialize() override;
+
+		/**	Creates internal resources dependent on window size. */
+		void createSizeDependedD3DResources();
+
+		/**	Destroys internal resources dependent on window size. */
+		void destroySizeDependedD3DResources();
+
+		/**	Queries the current DXGI device. Make sure to release the returned object when done with it. */
+		IDXGIDevice* queryDxgiDevice(); 
+
+		/**	Creates a swap chain for the window. */
+		void createSwapChain();
+
+		/**	Resizes all buffers attached to the swap chain to the specified size. */
+		void resizeSwapChainBuffers(UINT32 width, UINT32 height);
+
+		/** @copydoc RenderWindowCore::getProperties */
+		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
+
+		/** @copydoc RenderWindowCore::getSyncedProperties */
+		RenderWindowProperties& getSyncedProperties() override { return mSyncedProperties; }
+
+		/** @copydoc RenderWindowCore::syncProperties */
+		void syncProperties() override;
+
+	protected:
+		D3D11Device& mDevice;
+		IDXGIFactory* mDXGIFactory;
+		bool mSizing;
+		bool mIsChild;
+		bool mShowOnSwap;
+
+		DXGI_SAMPLE_DESC mMultisampleType;
+		UINT32 mRefreshRateNumerator;
+		UINT32 mRefreshRateDenominator;
+
+		ID3D11Texture2D* mBackBuffer;
+		ID3D11RenderTargetView*	mRenderTargetView;
+		TextureViewPtr mDepthStencilView;
+		SPtr<TextureCore> mDepthStencilBuffer;
+
+		IDXGISwapChain*	mSwapChain;
+		DXGI_SWAP_CHAIN_DESC mSwapChainDesc;
+		Win32Window* mWindow;
+
+		D3D11RenderWindowProperties mProperties;
+		D3D11RenderWindowProperties mSyncedProperties;
+	};
+
+	/**
+	 * Render window implementation for Windows and DirectX 11.
+	 *
+	 * @note	Sim thread only.
+	 */
+	class BS_D3D11_EXPORT D3D11RenderWindow : public RenderWindow
+	{
+	public:
+		~D3D11RenderWindow() { }
+
+		/** @copydoc RenderWindow::screenToWindowPos */
+		void getCustomAttribute(const String& name, void* pData) const override;
+
+		/** @copydoc RenderWindow::screenToWindowPos */
+		Vector2I screenToWindowPos(const Vector2I& screenPos) const override;
+
+		/** @copydoc RenderWindow::windowToScreenPos */
+		Vector2I windowToScreenPos(const Vector2I& windowPos) const override;
+
+		/** @copydoc RenderWindow::getCore */
+		SPtr<D3D11RenderWindowCore> getCore() const;
+
+	protected:
+		friend class D3D11RenderWindowManager;
+		friend class D3D11RenderWindowCore;
+
+		D3D11RenderWindow(const RENDER_WINDOW_DESC& desc, UINT32 windowId, 
+			D3D11Device& device, IDXGIFactory* DXGIFactory);
+
+		/** @copydoc RenderWindowCore::getProperties */
+		const RenderTargetProperties& getPropertiesInternal() const override { return mProperties; }
+
+		/** @copydoc RenderWindow::syncProperties */
+		void syncProperties() override;
+
+		/**	Retrieves internal window handle. */
+		HWND getHWnd() const;
+
+	private:
+		D3D11Device& mDevice;
+		IDXGIFactory* mDXGIFactory;
+		D3D11RenderWindowProperties mProperties;
+	};
+	
+	/** @} */
 }
 }

+ 42 - 44
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderWindowManager.h

@@ -1,45 +1,43 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsRenderWindowManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc	RenderWindowManager
-	 */
-	class BS_D3D11_EXPORT D3D11RenderWindowManager : public RenderWindowManager
-	{
-	public:
-		D3D11RenderWindowManager(D3D11RenderAPI* renderSystem);
-
-	protected:
-		/**
-		 * @copydoc RenderWindowManager::createImpl
-		 */
-		RenderWindowPtr createImpl(RENDER_WINDOW_DESC& desc, UINT32 windowId, const RenderWindowPtr& parentWindow) override;
-
-	private:
-		D3D11RenderAPI* mRenderSystem;
-	};
-
-	/**
-	 * @copydoc	RenderWindowCoreManager
-	 */
-	class BS_D3D11_EXPORT D3D11RenderWindowCoreManager : public RenderWindowCoreManager
-	{
-	public:
-		D3D11RenderWindowCoreManager(D3D11RenderAPI* renderSystem);
-
-	protected:
-		/**
-		 * @copydoc RenderWindowCoreManager::createInternal
-		 */
-		virtual SPtr<RenderWindowCore> createInternal(RENDER_WINDOW_DESC& desc, UINT32 windowId) override;
-
-	private:
-		D3D11RenderAPI* mRenderSystem;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsRenderWindowManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** @copydoc RenderWindowManager */
+	class BS_D3D11_EXPORT D3D11RenderWindowManager : public RenderWindowManager
+	{
+	public:
+		D3D11RenderWindowManager(D3D11RenderAPI* renderSystem);
+
+	protected:
+		/** @copydoc RenderWindowManager::createImpl */
+		RenderWindowPtr createImpl(RENDER_WINDOW_DESC& desc, UINT32 windowId, const RenderWindowPtr& parentWindow) override;
+
+	private:
+		D3D11RenderAPI* mRenderSystem;
+	};
+
+	/** @copydoc RenderWindowCoreManager */
+	class BS_D3D11_EXPORT D3D11RenderWindowCoreManager : public RenderWindowCoreManager
+	{
+	public:
+		D3D11RenderWindowCoreManager(D3D11RenderAPI* renderSystem);
+
+	protected:
+		/** @copydoc RenderWindowCoreManager::createInternal */
+		virtual SPtr<RenderWindowCore> createInternal(RENDER_WINDOW_DESC& desc, UINT32 windowId) override;
+
+	private:
+		D3D11RenderAPI* mRenderSystem;
+	};
+
+	/** @} */
 }
 }

+ 34 - 31
Source/BansheeD3D11RenderAPI/Include/BsD3D11SamplerState.h

@@ -1,32 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsSamplerState.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of a sampler state. Wraps a DX11
-	 *			sampler state object.
-	 */
-	class BS_D3D11_EXPORT D3D11SamplerStateCore : public SamplerStateCore
-	{
-	public:
-		~D3D11SamplerStateCore();
-		ID3D11SamplerState* getInternal() const { return mSamplerState; }
-
-	protected:
-		friend class D3D11RenderStateCoreManager;
-
-		D3D11SamplerStateCore(const SAMPLER_STATE_DESC& desc);
-
-		/**
-		 * @copydoc SamplerStateCore::createInternal
-		 */
-		void createInternal() override;
-
-		ID3D11SamplerState* mSamplerState;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsSamplerState.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX 11 implementation of a sampler state. Wraps a DX11 sampler state object. */
+	class BS_D3D11_EXPORT D3D11SamplerStateCore : public SamplerStateCore
+	{
+	public:
+		~D3D11SamplerStateCore();
+		ID3D11SamplerState* getInternal() const { return mSamplerState; }
+
+	protected:
+		friend class D3D11RenderStateCoreManager;
+
+		D3D11SamplerStateCore(const SAMPLER_STATE_DESC& desc);
+
+		/**
+		 * @copydoc SamplerStateCore::createInternal
+		 */
+		void createInternal() override;
+
+		ID3D11SamplerState* mSamplerState;
+	};
+
+	/** @} */
 }
 }

+ 148 - 142
Source/BansheeD3D11RenderAPI/Include/BsD3D11Texture.h

@@ -1,143 +1,149 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsTexture.h"
-
-namespace BansheeEngine
-{
-	/**	DirectX 11 implementation of a texture. */
-	class D3D11TextureCore : public TextureCore
-	{
-	public:
-		~D3D11TextureCore();
-
-		/**	Returns internal DX11 texture resource object. */
-		ID3D11Resource* getDX11Resource() const { return mTex; }
-
-		/**	Returns shader resource view associated with the texture. */
-		ID3D11ShaderResourceView* getSRV() const { return mShaderResourceView; }
-
-		/** Returns DXGI pixel format that was used to create the texture. */
-		DXGI_FORMAT getDXGIFormat() const { return mDXGIFormat; }
-
-		/** Returns DXGI pixel used for reading the texture as a shader resource or writing as a render target. */
-		DXGI_FORMAT getColorFormat() const { return mDXGIColorFormat; }
-
-		/** Returns DXGI pixel used for writing to a depth stencil texture. */
-		DXGI_FORMAT getDepthStencilFormat() const { return mDXGIDepthStencilFormat; }
-
-	protected:
-		friend class D3D11TextureCoreManager;
-
-		D3D11TextureCore(TextureType textureType, UINT32 width, UINT32 height, UINT32 depth, UINT32 numMipmaps,
-			PixelFormat format, int usage, bool hwGamma, UINT32 multisampleCount, const PixelDataPtr& initialData);
-
-		/** @copydoc CoreObjectCore::initialize() */
-		void initialize() override;
-
-		/** @copydoc TextureCore::lockImpl */
-		PixelData lockImpl(GpuLockOptions options, UINT32 mipLevel = 0, UINT32 face = 0) override;
-
-		/** @copydoc TextureCore::unlockImpl */
-		void unlockImpl() override;
-
-		/** @copydoc TextureCore::copyImpl */
-		void copyImpl(UINT32 srcFace, UINT32 srcMipLevel, UINT32 destFace, UINT32 destMipLevel, const SPtr<TextureCore>& target) override;
-
-		/** @copydoc TextureCore::readData */
-		void readData(PixelData& dest, UINT32 mipLevel = 0, UINT32 face = 0) override;
-
-		/** @copydoc TextureCore::writeData */
-		void writeData(const PixelData& src, UINT32 mipLevel = 0, UINT32 face = 0, bool discardWholeBuffer = false) override;
-
-		/**	Creates a blank DX11 1D texture object. */
-		void create1DTex();
-
-		/**	Creates a blank DX11 2D texture object. */
-		void create2DTex();
-
-		/**	Creates a blank DX11 3D texture object. */
-		void create3DTex();
-
-		/**
-		 * Creates a staging buffer that is used as a temporary buffer for read operations on textures that do not support
-		 * direct reading.
-		 */
-		void createStagingBuffer();
-
-		/**
-		 * Maps the specified texture surface for reading/writing. 
-		 *
-		 * @param[in]	res			Texture resource to map.
-		 * @param[in]	flags		Mapping flags that let the API know what are we planning to do with mapped memory.
-		 * @param[in]	mipLevel	Mip level to map (0 being the base level).
-		 * @param[in]	face		Texture face to map, in case texture has more than one.
-		 * @param[out]	rowPitch	Output size of a single row in bytes.
-		 * @param[out]	slicePitch	Output size of a single slice in bytes (relevant only for 3D textures).
-		 * @return					Pointer to the mapped area of memory.
-		 *
-		 * @note	
-		 * Non-staging textures must be dynamic in order to be mapped directly and only for writing. No restrictions are
-		 * made on staging textures.
-		 */
-		void* map(ID3D11Resource* res, D3D11_MAP flags, UINT32 mipLevel, UINT32 face, UINT32& rowPitch, UINT32& slicePitch);
-
-		/**	Unmaps a previously mapped texture. */
-		void unmap(ID3D11Resource* res);
-
-		/**
-		 * Copies texture data into a staging buffer and maps the staging buffer. Will create a staging buffer if one 
-		 * doesn't already exist (potentially wasting a lot of memory).
-		 *
-		 * @param[in]	flags		Mapping flags that let the API know what are we planning to do with mapped memory.
-		 * @param[in]	mipLevel	Mip level to map (0 being the base level).
-		 * @param[in]	face		Texture face to map, in case texture has more than one.
-		 * @param[out]	rowPitch	Output size of a single row in bytes.
-		 * @param[out]	slicePitch	Output size of a single slice in bytes (relevant only for 3D textures).
-		 * @return					Pointer to the mapped area of memory.
-		 */
-		void* mapstagingbuffer(D3D11_MAP flags, UINT32 mipLevel, UINT32 face, UINT32& rowPitch, UINT32& slicePitch);
-
-		/**	Unmaps a previously mapped staging buffer. */
-		void unmapstagingbuffer();
-		
-		/**
-		 * Maps a static buffer, for writing only. Returned pointer points to temporary CPU memory that will be copied to
-		 * the mapped resource on "unmap" call.
-		 *
-		 * @param[in]	flags		Mapping flags that let the API know what are we planning to do with mapped memory.
-		 * @param[in]	mipLevel	Mip level to map (0 being the base level).
-		 * @param[in]	face		Texture face to map, in case texture has more than one.
-		 * @param[out]	rowPitch	Output size of a single row in bytes.
-		 * @param[out]	slicePitch	Output size of a single slice in bytes (relevant only for 3D textures).
-		 * @return					Pointer to the mapped area of memory.
-		 */
-		void* mapstaticbuffer(PixelData lock, UINT32 mipLevel, UINT32 slice);
-
-		/**	Unmaps a previously mapped static buffer and flushes its data to the actual GPU buffer. */
-		void unmapstaticbuffer();
-
-		/**	Creates an empty and uninitialized texture view object. */
-		TextureViewPtr createView(const SPtr<TextureCore>& texture, const TEXTURE_VIEW_DESC& desc) override;
-
-	protected:
-		ID3D11Texture1D* m1DTex;
-		ID3D11Texture2D* m2DTex;
-		ID3D11Texture3D* m3DTex;
-		ID3D11Resource* mTex;
-
-		ID3D11ShaderResourceView* mShaderResourceView;
-		D3D11_SHADER_RESOURCE_VIEW_DESC mSRVDesc;
-		D3D11_SRV_DIMENSION mDimension;
-		DXGI_FORMAT mDXGIFormat;
-		DXGI_FORMAT mDXGIColorFormat;
-		DXGI_FORMAT mDXGIDepthStencilFormat;
-
-		ID3D11Resource* mStagingBuffer;
-		PixelData* mStaticBuffer;
-		UINT32 mLockedSubresourceIdx;
-		bool mLockedForReading;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsTexture.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX 11 implementation of a texture. */
+	class D3D11TextureCore : public TextureCore
+	{
+	public:
+		~D3D11TextureCore();
+
+		/**	Returns internal DX11 texture resource object. */
+		ID3D11Resource* getDX11Resource() const { return mTex; }
+
+		/**	Returns shader resource view associated with the texture. */
+		ID3D11ShaderResourceView* getSRV() const { return mShaderResourceView; }
+
+		/** Returns DXGI pixel format that was used to create the texture. */
+		DXGI_FORMAT getDXGIFormat() const { return mDXGIFormat; }
+
+		/** Returns DXGI pixel used for reading the texture as a shader resource or writing as a render target. */
+		DXGI_FORMAT getColorFormat() const { return mDXGIColorFormat; }
+
+		/** Returns DXGI pixel used for writing to a depth stencil texture. */
+		DXGI_FORMAT getDepthStencilFormat() const { return mDXGIDepthStencilFormat; }
+
+	protected:
+		friend class D3D11TextureCoreManager;
+
+		D3D11TextureCore(TextureType textureType, UINT32 width, UINT32 height, UINT32 depth, UINT32 numMipmaps,
+			PixelFormat format, int usage, bool hwGamma, UINT32 multisampleCount, const PixelDataPtr& initialData);
+
+		/** @copydoc CoreObjectCore::initialize() */
+		void initialize() override;
+
+		/** @copydoc TextureCore::lockImpl */
+		PixelData lockImpl(GpuLockOptions options, UINT32 mipLevel = 0, UINT32 face = 0) override;
+
+		/** @copydoc TextureCore::unlockImpl */
+		void unlockImpl() override;
+
+		/** @copydoc TextureCore::copyImpl */
+		void copyImpl(UINT32 srcFace, UINT32 srcMipLevel, UINT32 destFace, UINT32 destMipLevel, const SPtr<TextureCore>& target) override;
+
+		/** @copydoc TextureCore::readData */
+		void readData(PixelData& dest, UINT32 mipLevel = 0, UINT32 face = 0) override;
+
+		/** @copydoc TextureCore::writeData */
+		void writeData(const PixelData& src, UINT32 mipLevel = 0, UINT32 face = 0, bool discardWholeBuffer = false) override;
+
+		/**	Creates a blank DX11 1D texture object. */
+		void create1DTex();
+
+		/**	Creates a blank DX11 2D texture object. */
+		void create2DTex();
+
+		/**	Creates a blank DX11 3D texture object. */
+		void create3DTex();
+
+		/**
+		 * Creates a staging buffer that is used as a temporary buffer for read operations on textures that do not support
+		 * direct reading.
+		 */
+		void createStagingBuffer();
+
+		/**
+		 * Maps the specified texture surface for reading/writing. 
+		 *
+		 * @param[in]	res			Texture resource to map.
+		 * @param[in]	flags		Mapping flags that let the API know what are we planning to do with mapped memory.
+		 * @param[in]	mipLevel	Mip level to map (0 being the base level).
+		 * @param[in]	face		Texture face to map, in case texture has more than one.
+		 * @param[out]	rowPitch	Output size of a single row in bytes.
+		 * @param[out]	slicePitch	Output size of a single slice in bytes (relevant only for 3D textures).
+		 * @return					Pointer to the mapped area of memory.
+		 *
+		 * @note	
+		 * Non-staging textures must be dynamic in order to be mapped directly and only for writing. No restrictions are
+		 * made on staging textures.
+		 */
+		void* map(ID3D11Resource* res, D3D11_MAP flags, UINT32 mipLevel, UINT32 face, UINT32& rowPitch, UINT32& slicePitch);
+
+		/**	Unmaps a previously mapped texture. */
+		void unmap(ID3D11Resource* res);
+
+		/**
+		 * Copies texture data into a staging buffer and maps the staging buffer. Will create a staging buffer if one 
+		 * doesn't already exist (potentially wasting a lot of memory).
+		 *
+		 * @param[in]	flags		Mapping flags that let the API know what are we planning to do with mapped memory.
+		 * @param[in]	mipLevel	Mip level to map (0 being the base level).
+		 * @param[in]	face		Texture face to map, in case texture has more than one.
+		 * @param[out]	rowPitch	Output size of a single row in bytes.
+		 * @param[out]	slicePitch	Output size of a single slice in bytes (relevant only for 3D textures).
+		 * @return					Pointer to the mapped area of memory.
+		 */
+		void* mapstagingbuffer(D3D11_MAP flags, UINT32 mipLevel, UINT32 face, UINT32& rowPitch, UINT32& slicePitch);
+
+		/**	Unmaps a previously mapped staging buffer. */
+		void unmapstagingbuffer();
+		
+		/**
+		 * Maps a static buffer, for writing only. Returned pointer points to temporary CPU memory that will be copied to
+		 * the mapped resource on "unmap" call.
+		 *
+		 * @param[in]	flags		Mapping flags that let the API know what are we planning to do with mapped memory.
+		 * @param[in]	mipLevel	Mip level to map (0 being the base level).
+		 * @param[in]	face		Texture face to map, in case texture has more than one.
+		 * @param[out]	rowPitch	Output size of a single row in bytes.
+		 * @param[out]	slicePitch	Output size of a single slice in bytes (relevant only for 3D textures).
+		 * @return					Pointer to the mapped area of memory.
+		 */
+		void* mapstaticbuffer(PixelData lock, UINT32 mipLevel, UINT32 slice);
+
+		/**	Unmaps a previously mapped static buffer and flushes its data to the actual GPU buffer. */
+		void unmapstaticbuffer();
+
+		/**	Creates an empty and uninitialized texture view object. */
+		TextureViewPtr createView(const SPtr<TextureCore>& texture, const TEXTURE_VIEW_DESC& desc) override;
+
+	protected:
+		ID3D11Texture1D* m1DTex;
+		ID3D11Texture2D* m2DTex;
+		ID3D11Texture3D* m3DTex;
+		ID3D11Resource* mTex;
+
+		ID3D11ShaderResourceView* mShaderResourceView;
+		D3D11_SHADER_RESOURCE_VIEW_DESC mSRVDesc;
+		D3D11_SRV_DIMENSION mDimension;
+		DXGI_FORMAT mDXGIFormat;
+		DXGI_FORMAT mDXGIColorFormat;
+		DXGI_FORMAT mDXGIDepthStencilFormat;
+
+		ID3D11Resource* mStagingBuffer;
+		PixelData* mStaticBuffer;
+		UINT32 mLockedSubresourceIdx;
+		bool mLockedForReading;
+	};
+
+	/** @} */
 }
 }

+ 45 - 55
Source/BansheeD3D11RenderAPI/Include/BsD3D11TextureManager.h

@@ -1,56 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsTextureManager.h"
-
-namespace BansheeEngine 
-{
-	/**
-	 * @brief	Handles creation of DirectX 11 textures.
-	 */
-	class BS_D3D11_EXPORT D3D11TextureManager : public TextureManager
-	{
-	public:
-		/**
-		 * @copydoc	TextureManager::getNativeFormat
-		 */
-		PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage, bool hwGamma) override;
-
-	protected:		
-		/**
-		 * @copydoc	TextureManager::createRenderTextureImpl
-		 */
-		RenderTexturePtr createRenderTextureImpl(const RENDER_TEXTURE_DESC& desc) override;
-
-		/**
-		 * @copydoc	TextureManager::createMultiRenderTextureImpl
-		 */
-		MultiRenderTexturePtr createMultiRenderTextureImpl(const MULTI_RENDER_TEXTURE_DESC& desc) override;
-	};
-
-	/**
-	 * @brief	Handles creation of DirectX 11 textures.
-	 */
-	class BS_D3D11_EXPORT D3D11TextureCoreManager : public TextureCoreManager
-	{
-	protected:
-		/**
-		 * @copydoc	TextureCoreManager::createTextureInternal
-		 */
-		SPtr<TextureCore> createTextureInternal(TextureType texType, UINT32 width, UINT32 height, UINT32 depth,
-			int numMips, PixelFormat format, int usage = TU_DEFAULT, bool hwGammaCorrection = false,
-			UINT32 multisampleCount = 0, const PixelDataPtr& initialData = nullptr) override;
-
-		/**
-		 * @copydoc	TextureCoreManager::createRenderTextureInternal
-		 */
-		SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_CORE_DESC& desc) override;
-
-		/**
-		 * @copydoc	TextureCoreManager::createMultiRenderTextureInternal
-		 */
-		SPtr<MultiRenderTextureCore> createMultiRenderTextureInternal(const MULTI_RENDER_TEXTURE_CORE_DESC& desc) override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsTextureManager.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	Handles creation of DirectX 11 textures. */
+	class BS_D3D11_EXPORT D3D11TextureManager : public TextureManager
+	{
+	public:
+		/** @copydoc TextureManager::getNativeFormat */
+		PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage, bool hwGamma) override;
+
+	protected:		
+		/** @copydoc TextureManager::createRenderTextureImpl */
+		RenderTexturePtr createRenderTextureImpl(const RENDER_TEXTURE_DESC& desc) override;
+
+		/** @copydoc TextureManager::createMultiRenderTextureImpl */
+		MultiRenderTexturePtr createMultiRenderTextureImpl(const MULTI_RENDER_TEXTURE_DESC& desc) override;
+	};
+
+	/**	Handles creation of DirectX 11 textures. */
+	class BS_D3D11_EXPORT D3D11TextureCoreManager : public TextureCoreManager
+	{
+	protected:
+		/** @copydoc	TextureCoreManager::createTextureInternal */
+		SPtr<TextureCore> createTextureInternal(TextureType texType, UINT32 width, UINT32 height, UINT32 depth,
+			int numMips, PixelFormat format, int usage = TU_DEFAULT, bool hwGammaCorrection = false,
+			UINT32 multisampleCount = 0, const PixelDataPtr& initialData = nullptr) override;
+
+		/** @copydoc TextureCoreManager::createRenderTextureInternal */
+		SPtr<RenderTextureCore> createRenderTextureInternal(const RENDER_TEXTURE_CORE_DESC& desc) override;
+
+		/** @copydoc TextureCoreManager::createMultiRenderTextureInternal */
+		SPtr<MultiRenderTextureCore> createMultiRenderTextureInternal(const MULTI_RENDER_TEXTURE_CORE_DESC& desc) override;
+	};
+
+	/** @} */
 }
 }

+ 122 - 122
Source/BansheeD3D11RenderAPI/Include/BsD3D11TextureView.h

@@ -1,123 +1,123 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsTextureView.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX implementation of a texture resource view.
-	 */
-	class BS_D3D11_EXPORT D3D11TextureView : public TextureView
-	{
-	public:
-		~D3D11TextureView();
-
-		/**
-		 * @brief	Returns a shader resource view. Caller must take care this texture view
-		 *			actually contains a shader resource view, otherwise it returns null.
-		 */
-		ID3D11ShaderResourceView* getSRV() const { return mSRV; }
-
-		/**
-		 * @brief	Returns a render target view. Caller must take care this texture view
-		 *			actually contains a render target view, otherwise it returns null.
-		 */
-		ID3D11RenderTargetView*	getRTV() const { return mRTV; }
-
-		/**
-		 * @brief	Returns a unordered access view. Caller must take care this texture view
-		 *			actually contains a unordered access view, otherwise it returns null.
-		 */
-		ID3D11UnorderedAccessView* getUAV() const { return mUAV; }
-
-		/**
-		 * @brief	Returns a depth stencil view. Caller must take care this texture view
-		 *			actually contains a depth stencil view, otherwise it returns null.
-		 *
-		 * @param[in]	readOnly	Should the depth stencil view only support read operations (allows the bound texture to
-		 *							be also used as a shader resource view while bound as a depth stencil target).
-		 */
-		ID3D11DepthStencilView*	getDSV(bool readOnly) const { return readOnly ? mRODSV : mDSV; }
-
-	protected:
-		friend class D3D11TextureCore;
-
-		D3D11TextureView(const SPtr<TextureCore>& texture, const TEXTURE_VIEW_DESC& desc);
-	private:
-		/**
-		 * @brief	Creates a shader resource view that allows the provided surfaces 
-		 *			to be bound as normal shader resources.
-		 *
-		 * @param	texture			Texture to create the resource view for.
-		 * @param	mostDetailMip	First mip level to create the resource view for (0 - base level). 
-		 * @param	numMips			Number of mip levels to create the view for.
-		 * @param	firstArraySlice	First array slice to create the view for. This will be array index 
-		 *							for 1D and 2D array textures, texture slice index for 3D textures, and face
-		 *							index for cube textures (cube index * 6).
-		 * @param	numArraySlices	Number of array slices to create the view for. This will be number of
-		 *							array elements for 1D and 2D array textures, number of slices for 3D textures,
-		 *							and number of cubes for cube textures.
-		 */
-		ID3D11ShaderResourceView* createSRV(D3D11TextureCore* texture, 
-			UINT32 mostDetailMip, UINT32 numMips, UINT32 firstArraySlice, UINT32 numArraySlices);
-
-		/**
-		 * @brief	Creates a shader resource view that allows the provided surfaces 
-		 *			to be bound as render targets.
-		 *
-		 * @param	texture			Texture to create the resource view for.
-		 * @param	mipSlice		Mip level to create the resource view for (0 - base level).
-		 * @param	firstArraySlice	First array slice to create the view for. This will be array index 
-		 *							for 1D and 2D array textures, texture slice index for 3D textures, and face
-		 *							index for cube textures (cube index * 6).
-		 * @param	numArraySlices	Number of array slices to create the view for. This will be number of
-		 *							array elements for 1D and 2D array textures, number of slices for 3D textures,
-		 *							and number of cubes for cube textures.
-		 */
-		ID3D11RenderTargetView* createRTV(D3D11TextureCore* texture, 
-			UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices);
-
-		/**
-		 * @brief	Creates a shader resource view that allows the provided surfaces 
-		 *			to be bound as unordered access buffers.
-		 *
-		 * @param	texture			Texture to create the resource view for.
-		 * @param	mipSlice		Mip level to create the resource view for (0 - base level).
-		 * @param	firstArraySlice	First array slice to create the view for. This will be array index
-		 *							for 1D and 2D array textures, texture slice index for 3D textures, and face
-		 *							index for cube textures (cube index * 6).
-		 * @param	numArraySlices	Number of array slices to create the view for. This will be number of
-		 *							array elements for 1D and 2D array textures, number of slices for 3D textures,
-		 *							and number of cubes for cube textures.
-		 */
-		ID3D11UnorderedAccessView* createUAV(D3D11TextureCore* texture, 
-			UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices);
-
-		/**
-		 * @brief	Creates a shader resource view that allows the provided surfaces 
-		 *			to be bound as depth stencil buffers.
-		 *
-		 * @param	texture			Texture to create the resource view for.
-		 * @param	mipSlice		Mip level to create the resource view for (0 - base level).
-		 * @param	firstArraySlice	First array slice to create the view for. This will be array index
-		 *							for 1D and 2D array textures, texture slice index for 3D textures, and face
-		 *							index for cube textures (cube index * 6).
-		 * @param	numArraySlices	Number of array slices to create the view for. This will be number of
-		 *							array elements for 1D and 2D array textures, number of slices for 3D textures,
-		 *							and number of cubes for cube textures.
-		 * @param	readOnly		Should the depth stencil view only support read operations (allows the bound texture to
-		 *							be also used as a shader resource view while bound as a depth stencil target).
-		 */
-		ID3D11DepthStencilView* createDSV(D3D11TextureCore* texture, 
-			UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices, bool readOnly);
-
-		ID3D11ShaderResourceView* mSRV;
-		ID3D11RenderTargetView* mRTV;
-		ID3D11UnorderedAccessView* mUAV;
-		ID3D11DepthStencilView*	mDSV;
-		ID3D11DepthStencilView*	mRODSV;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsTextureView.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX implementation of a texture resource view. */
+	class BS_D3D11_EXPORT D3D11TextureView : public TextureView
+	{
+	public:
+		~D3D11TextureView();
+
+		/**
+		 * Returns a shader resource view. Caller must take care this texture view actually contains a shader resource view,
+		 * otherwise it returns null.
+		 */
+		ID3D11ShaderResourceView* getSRV() const { return mSRV; }
+
+		/**
+		 * Returns a render target view. Caller must take care this texture view actually contains a render target view,
+		 * otherwise it returns null.
+		 */
+		ID3D11RenderTargetView*	getRTV() const { return mRTV; }
+
+		/**
+		 * Returns a unordered access view. Caller must take care this texture view actually contains a unordered access
+		 * view, otherwise it returns null.
+		 */
+		ID3D11UnorderedAccessView* getUAV() const { return mUAV; }
+
+		/**
+		 * Returns a depth stencil view. Caller must take care this texture view actually contains a depth stencil view,
+		 * otherwise it returns null.
+		 *
+		 * @param[in]	readOnly	Should the depth stencil view only support read operations (allows the bound texture to
+		 *							be also used as a shader resource view while bound as a depth stencil target).
+		 */
+		ID3D11DepthStencilView*	getDSV(bool readOnly) const { return readOnly ? mRODSV : mDSV; }
+
+	protected:
+		friend class D3D11TextureCore;
+
+		D3D11TextureView(const SPtr<TextureCore>& texture, const TEXTURE_VIEW_DESC& desc);
+	private:
+		/**
+		 * Creates a shader resource view that allows the provided surfaces to be bound as normal shader resources.
+		 *
+		 * @param[in]	texture			Texture to create the resource view for.
+		 * @param[in]	mostDetailMip	First mip level to create the resource view for (0 - base level). 
+		 * @param[in]	numMips			Number of mip levels to create the view for.
+		 * @param[in]	firstArraySlice	First array slice to create the view for. This will be array index for 1D and 2D
+		 *								array textures, texture slice index for 3D textures, and face index for cube
+		 *								textures (cube index * 6).
+		 * @param[in]	numArraySlices	Number of array slices to create the view for. This will be number of array elements
+		 *								for 1D and 2D array textures, number of slices for 3D textures, and number of cubes
+		 *								for cube textures.
+		 */
+		ID3D11ShaderResourceView* createSRV(D3D11TextureCore* texture, 
+			UINT32 mostDetailMip, UINT32 numMips, UINT32 firstArraySlice, UINT32 numArraySlices);
+
+		/**
+		 * Creates a shader resource view that allows the provided surfaces to be bound as render targets.
+		 *
+		 * @param[in]	texture			Texture to create the resource view for.
+		 * @param[in]	mipSlice		Mip level to create the resource view for (0 - base level).
+		 * @param[in]	firstArraySlice	First array slice to create the view for. This will be array index for 1D and 2D
+		 *								array textures, texture slice index for 3D textures, and face index for cube
+		 *								textures (cube index * 6).
+		 * @param[in]	numArraySlices	Number of array slices to create the view for. This will be number of array elements
+		 *								for 1D and 2D array textures, number of slices for 3D textures, and number of cubes
+		 *								for cube textures.
+		 */
+		ID3D11RenderTargetView* createRTV(D3D11TextureCore* texture, 
+			UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices);
+
+		/**
+		 * Creates a shader resource view that allows the provided surfaces to be bound as unordered access buffers.
+		 *
+		 * @param[in]	texture			Texture to create the resource view for.
+		 * @param[in]	mipSlice		Mip level to create the resource view for (0 - base level).
+		 * @param[in]	firstArraySlice	First array slice to create the view for. This will be array index for 1D and 2D
+		 *								array textures, texture slice index for 3D textures, and face index for cube
+		 *								textures (cube index * 6).
+		 * @param[in]	numArraySlices	Number of array slices to create the view for. This will be number of array elements
+		 *								for 1D and 2D array textures, number of slices for 3D textures, and number of cubes
+		 *								for cube textures.
+		 */
+		ID3D11UnorderedAccessView* createUAV(D3D11TextureCore* texture, 
+			UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices);
+
+		/**
+		 * Creates a shader resource view that allows the provided surfaces to be bound as depth stencil buffers.
+		 *
+		 * @param[in]	texture			Texture to create the resource view for.
+		 * @param[in]	mipSlice		Mip level to create the resource view for (0 - base level).
+		 * @param[in]	firstArraySlice	First array slice to create the view for. This will be array index for 1D and 2D
+		 *								array textures, texture slice index for 3D textures, and face index for cube
+		 *								textures (cube index * 6).
+		 * @param[in]	numArraySlices	Number of array slices to create the view for. This will be number of array elements
+		 *								for 1D and 2D array textures, number of slices for 3D textures, and number of cubes
+		 *								for cube textures.
+		 * @param[in]	readOnly		Should the depth stencil view only support read operations (allows the bound texture
+		 *								to be also used as a shader resource view while bound as a depth stencil target).
+		 */
+		ID3D11DepthStencilView* createDSV(D3D11TextureCore* texture, 
+			UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices, bool readOnly);
+
+		ID3D11ShaderResourceView* mSRV;
+		ID3D11RenderTargetView* mRTV;
+		ID3D11UnorderedAccessView* mUAV;
+		ID3D11DepthStencilView*	mDSV;
+		ID3D11DepthStencilView*	mRODSV;
+	};
+
+	/** @} */
 }
 }

+ 47 - 53
Source/BansheeD3D11RenderAPI/Include/BsD3D11TimerQuery.h

@@ -1,54 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsTimerQuery.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc TimerQuery
-	 */
-	class BS_D3D11_EXPORT D3D11TimerQuery : public TimerQuery
-	{
-	public:
-		D3D11TimerQuery();
-		~D3D11TimerQuery();
-
-		/**
-		 * @copydoc TimerQuery::begin
-		 */
-		virtual void begin();
-
-		/**
-		 * @copydoc TimerQuery::end
-		 */
-		virtual void end();
-
-		/**
-		 * @copydoc TimerQuery::isReady
-		 */
-		virtual bool isReady() const;
-
-		/**
-		 * @copydoc TimerQuery::getTimeMs
-		 */
-		virtual float getTimeMs();
-
-	private:
-		/**
-		 * @brief	Resolve timing information after the query has finished.
-		 */
-		void finalize();
-
-		bool mFinalized;
-		bool mQueryEndCalled;
-		float mTimeDelta;
-
-		ID3D11Query* mBeginQuery;
-		ID3D11Query* mEndQuery;
-		ID3D11Query* mDisjointQuery;
-		ID3D11DeviceContext* mContext;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsTimerQuery.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** @copydoc TimerQuery */
+	class BS_D3D11_EXPORT D3D11TimerQuery : public TimerQuery
+	{
+	public:
+		D3D11TimerQuery();
+		~D3D11TimerQuery();
+
+		/** @copydoc TimerQuery::begin */
+		void begin() override;
+
+		/** @copydoc TimerQuery::end */
+		void end() override;
+
+		/** @copydoc TimerQuery::isReady */
+		bool isReady() const override;
+
+		/** @copydoc TimerQuery::getTimeMs */
+		float getTimeMs() override;
+
+	private:
+		/**	Resolve timing information after the query has finished. */
+		void finalize();
+
+		bool mFinalized;
+		bool mQueryEndCalled;
+		float mTimeDelta;
+
+		ID3D11Query* mBeginQuery;
+		ID3D11Query* mEndQuery;
+		ID3D11Query* mDisjointQuery;
+		ID3D11DeviceContext* mContext;
+	};
+
+	/** @} */
 }
 }

+ 51 - 61
Source/BansheeD3D11RenderAPI/Include/BsD3D11VertexBuffer.h

@@ -1,62 +1,52 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsVertexBuffer.h"
-#include "BsD3D11HardwareBuffer.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	DirectX 11 implementation of a vertex buffer.
-	 */
-	class BS_D3D11_EXPORT D3D11VertexBufferCore : public VertexBufferCore
-	{
-	public:
-		D3D11VertexBufferCore(D3D11Device& device, UINT32 vertexSize, UINT32 numVertices, 
-			GpuBufferUsage usage, bool streamOut);
-
-		~D3D11VertexBufferCore();
-
-		/**
-		 * @copydoc VertexBufferCore::readData
-		 */
-		void readData(UINT32 offset, UINT32 length, void* pDest) override;
-
-		/**
-		 * @copydoc VertexBufferCore::writeData
-		 */
-		void writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags = BufferWriteType::Normal) override;
-
-		/**
-		 * @copydoc VertexBufferCore::copyData
-		 */
-		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
-
-		/**
-		 * @brief	Get the D3D-specific index buffer
-		 */
-		ID3D11Buffer* getD3DVertexBuffer() const { return mBuffer->getD3DBuffer(); }		
-
-	protected: 
-		/**
-		* @copydoc VertexBufferCore::lockImpl
-		 */
-		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
-
-		/**
-		 * @copydoc VertexBufferCore::unlockImpl
-		 */
-		void unlockImpl(void) override;
-
-		/**
-		 * @copydoc VertexBufferCore::initialize
-		 */
-		void initialize() override;
-
-		D3D11HardwareBuffer* mBuffer;
-		D3D11Device& mDevice;
-		bool mStreamOut;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsVertexBuffer.h"
+#include "BsD3D11HardwareBuffer.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/**	DirectX 11 implementation of a vertex buffer. */
+	class BS_D3D11_EXPORT D3D11VertexBufferCore : public VertexBufferCore
+	{
+	public:
+		D3D11VertexBufferCore(D3D11Device& device, UINT32 vertexSize, UINT32 numVertices, 
+			GpuBufferUsage usage, bool streamOut);
+
+		~D3D11VertexBufferCore();
+
+		/** @copydoc VertexBufferCore::readData */
+		void readData(UINT32 offset, UINT32 length, void* pDest) override;
+
+		/** @copydoc VertexBufferCore::writeData */
+		void writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags = BufferWriteType::Normal) override;
+
+		/** @copydoc VertexBufferCore::copyData */
+		void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
+
+		/**	Get the D3D-specific index buffer */
+		ID3D11Buffer* getD3DVertexBuffer() const { return mBuffer->getD3DBuffer(); }		
+
+	protected: 
+		/** @copydoc VertexBufferCore::lockImpl */
+		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
+
+		/** @copydoc VertexBufferCore::unlockImpl */
+		void unlockImpl(void) override;
+
+		/** @copydoc VertexBufferCore::initialize */
+		void initialize() override;
+
+		D3D11HardwareBuffer* mBuffer;
+		D3D11Device& mDevice;
+		bool mStreamOut;
+	};
+
+	/** @} */
 }
 }

+ 59 - 67
Source/BansheeD3D11RenderAPI/Include/BsD3D11VideoModeInfo.h

@@ -1,68 +1,60 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsVideoModeInfo.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc	VideoMode
-	 */
-	class BS_D3D11_EXPORT D3D11VideoMode : public VideoMode
-	{
-	public:
-		D3D11VideoMode(UINT32 width, UINT32 height, float refreshRate, UINT32 outputIdx, UINT32 refreshRateNumerator,
-			UINT32 refreshRateDenominator, DXGI_MODE_DESC mode);
-
-		/**
-		 * @brief	Returns an internal DXGI representation of this video mode.
-		 */
-		const DXGI_MODE_DESC& getDXGIModeDesc() const { return mD3D11Mode; }
-
-		/**
-		 * @brief	Gets internal DX11 refresh rate numerator.
-		 */
-		UINT32 getRefreshRateNumerator() const { return mRefreshRateNumerator; }
-
-		/**
-		 * @brief	Gets internal DX11 refresh rate denominator.
-		 */
-		UINT32 getRefreshRateDenominator() const { return mRefreshRateDenominator; }
-
-	private:
-		friend class D3D11VideoOutputInfo;
-
-		UINT32 mRefreshRateNumerator;
-		UINT32 mRefreshRateDenominator;
-		DXGI_MODE_DESC mD3D11Mode;
-	};
-
-	/**
-	* @copydoc	VideoOutputInfo
-	*/
-	class BS_D3D11_EXPORT D3D11VideoOutputInfo : public VideoOutputInfo
-	{
-	public:
-		D3D11VideoOutputInfo(IDXGIOutput* output, UINT32 outputIdx);
-		~D3D11VideoOutputInfo();
-
-		/**
-		 * @brief	Returns the internal DXGI object representing an output device.
-		 */
-		IDXGIOutput* getDXGIOutput() const { return mDXGIOutput;  }
-
-	private:
-		IDXGIOutput* mDXGIOutput;
-	};
-
-	/**
-	* @copydoc	VideoModeInfo
-	*/
-	class BS_D3D11_EXPORT D3D11VideoModeInfo : public VideoModeInfo
-	{
-	public:
-		D3D11VideoModeInfo(IDXGIAdapter* dxgiAdapter);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D11Prerequisites.h"
+#include "BsVideoModeInfo.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup D3D11
+	 *  @{
+	 */
+
+	/** @copydoc VideoMode */
+	class BS_D3D11_EXPORT D3D11VideoMode : public VideoMode
+	{
+	public:
+		D3D11VideoMode(UINT32 width, UINT32 height, float refreshRate, UINT32 outputIdx, UINT32 refreshRateNumerator,
+			UINT32 refreshRateDenominator, DXGI_MODE_DESC mode);
+
+		/**	Returns an internal DXGI representation of this video mode. */
+		const DXGI_MODE_DESC& getDXGIModeDesc() const { return mD3D11Mode; }
+
+		/**	Gets internal DX11 refresh rate numerator. */
+		UINT32 getRefreshRateNumerator() const { return mRefreshRateNumerator; }
+
+		/**	Gets internal DX11 refresh rate denominator. */
+		UINT32 getRefreshRateDenominator() const { return mRefreshRateDenominator; }
+
+	private:
+		friend class D3D11VideoOutputInfo;
+
+		UINT32 mRefreshRateNumerator;
+		UINT32 mRefreshRateDenominator;
+		DXGI_MODE_DESC mD3D11Mode;
+	};
+
+	/** @copydoc VideoOutputInfo */
+	class BS_D3D11_EXPORT D3D11VideoOutputInfo : public VideoOutputInfo
+	{
+	public:
+		D3D11VideoOutputInfo(IDXGIOutput* output, UINT32 outputIdx);
+		~D3D11VideoOutputInfo();
+
+		/**	Returns the internal DXGI object representing an output device. */
+		IDXGIOutput* getDXGIOutput() const { return mDXGIOutput;  }
+
+	private:
+		IDXGIOutput* mDXGIOutput;
+	};
+
+	/** @copydoc VideoModeInfo */
+	class BS_D3D11_EXPORT D3D11VideoModeInfo : public VideoModeInfo
+	{
+	public:
+		D3D11VideoModeInfo(IDXGIAdapter* dxgiAdapter);
+	};
+
+	/** @} */
 }
 }

+ 605 - 605
Source/BansheeD3D9RenderAPI/Include/BsD3D9RenderAPI.h

@@ -1,606 +1,606 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsD3D9Prerequisites.h"
-#include "BsRenderAPI.h"
-#include "BsRenderAPICapabilities.h"
-#include "BsD3D9Mappings.h"
-
-namespace BansheeEngine 
-{
-	/**
-	 * @brief	Implementation of a render system using DirectX 9. Provides abstracted
-	 *			access to various low level DX9 methods.
-	 */
-	class BS_D3D9_EXPORT D3D9RenderAPI : public RenderAPICore
-	{
-	public:
-		/**
-		 * @brief	Constructs a new instance of the render system using the provided module instance.
-		 */
-		D3D9RenderAPI(HINSTANCE hInstance);
-		~D3D9RenderAPI();
-
-		/**
-		 * @copydoc RenderAPICore::getName()
-		 */
-		const StringID& getName() const override;
-
-		/**
-		 * @copydoc RenderAPICore::getShadingLanguageName()
-		 */
-		const String& getShadingLanguageName() const override;
-
-		/**
-		 * @copydoc RenderAPICore::setRenderTarget()
-		 */
-		void setRenderTarget(const SPtr<RenderTargetCore>& target, bool readOnlyDepthStencil = false) override;
-
-		/**
-		 * @copydoc RenderAPICore::bindGpuProgram()
-		 */
-		void bindGpuProgram(const SPtr<GpuProgramCore>& prg) override;
-
-		/**
-		 * @copydoc RenderAPICore::unbindGpuProgram()
-		 */
-		void unbindGpuProgram(GpuProgramType gptype) override;
-
-		/**
-		 * @copydoc RenderAPICore::setConstantBuffers()
-		 */
-		void setConstantBuffers(GpuProgramType gptype, const SPtr<GpuParamsCore>& params) override;
-
-		/**
-		 * @copydoc RenderAPICore::setVertexBuffers()
-		 */
-		void setVertexBuffers(UINT32 index, SPtr<VertexBufferCore>* buffers, UINT32 numBuffers) override;
-
-		/**
-		 * @copydoc RenderAPICore::setIndexBuffer()
-		 */
-		void setIndexBuffer(const SPtr<IndexBufferCore>& buffer) override;
-
-		/**
-		 * @copydoc RenderAPICore::setVertexDeclaration()
-		 */
-		void setVertexDeclaration(const SPtr<VertexDeclarationCore>& vertexDeclaration) override;
-
-		/**
-		 * @copydoc RenderAPICore::setDrawOperation()
-		 */
-		void setDrawOperation(DrawOperationType op) override;
-
-		/**
-		 * @copydoc RenderAPICore::setTexture()
-		 */
-		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr) override;
-
-		/**
-		 * @copydoc RenderAPICore::setLoadStoreTexture()
-		 */
-		void setLoadStoreTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr,
-			const TextureSurface& surface) override;
-
-		/**
-		 * @copydoc RenderAPICore::setSamplerState()
-		 */
-		void setSamplerState(GpuProgramType gptype, UINT16 unit, const SPtr<SamplerStateCore>& state) override;
-
-		/**
-		 * @copydoc RenderAPICore::setBlendState()
-		 */
-		void setBlendState(const SPtr<BlendStateCore>& blendState) override;
-
-		/**
-		 * @copydoc RenderAPICore::setRasterizerState()
-		 */
-		void setRasterizerState(const SPtr<RasterizerStateCore>& rasterizerState) override;
-
-		/**
-		 * @copydoc RenderAPICore::setDepthStencilState()
-		 */
-		void setDepthStencilState(const SPtr<DepthStencilStateCore>& depthStencilState, UINT32 stencilRefValue) override;
-
-		/**
-		 * @copydoc RenderAPICore::setViewport()
-		 */
-		void setViewport(const Rect2& vp) override;
-
-		/**
-		 * @copydoc RenderAPICore::beginFrame()
-		 */
-		void beginFrame() override;
-
-		/**
-		 * @copydoc RenderAPICore::endFrame()
-		 */
-		void endFrame() override;
-
-		/**
-		 * @copydoc RenderAPICore::draw()
-		 */
-		void draw(UINT32 vertexOffset, UINT32 vertexCount) override;
-
-		/**
-		 * @copydoc RenderAPICore::drawIndexed()
-		 */
-		void drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount) override;
-
-		/**
-		 * @copydoc RenderAPICore::drawIndexed()
-		 */
-		void dispatchCompute(UINT32 numGroupsX, UINT32 numGroupsY = 1, UINT32 numGroupsZ = 1) override;
-
-		/**
-		 * @copydoc RenderAPICore::setScissorRect()
-		 */
-		void setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom) override;
-
-		/**
-		 * @copydoc RenderAPICore::clearRenderTarget()
-		 */
-		void clearRenderTarget(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
-			UINT8 targetMask = 0xFF) override;
-
-		/**
-		 * @copydoc RenderAPICore::clearViewport()
-		 */
-		void clearViewport(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
-			UINT8 targetMask = 0xFF) override;
-
-		/**
-		 * @copydoc RenderAPICore::convertProjectionMatrix()
-		 */
-		void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest) override;
-
-		/**
-		 * @copydoc	RenderAPICore::getHorizontalTexelOffset
-		 */
-		float getHorizontalTexelOffset() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getVerticalTexelOffset
-		 */
-		float getVerticalTexelOffset() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getMinimumDepthInputValue
-		 */
-		float getMinimumDepthInputValue() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getMaximumDepthInputValue
-		 */
-		float getMaximumDepthInputValue() override;
-
-		/**
-		 * @copydoc	RenderAPICore::getColorVertexElementType
-		 */
-		VertexElementType getColorVertexElementType() const override;
-
-		/**
-		 * @copydoc	RenderAPICore::getColorVertexElementType
-		 */
-		bool getVertexColorFlipRequired() const override { return true; }
-
-		/**
-		 * @copydoc RenderAPICore::generateParamBlockDesc()
-		 */
-		GpuParamBlockDesc generateParamBlockDesc(const String& name, Vector<GpuParamDataDesc>& params) override;
-
-		/************************************************************************/
-		/* 				Internal use by DX9 RenderAPI only                   */
-		/************************************************************************/
-
-		/**
-		 * @brief	Returns the resource manager instance.
-		 */
-		static D3D9ResourceManager* getResourceManager();
-
-		/**
-		 * @brief	Returns the device manager instance.
-		 */
-		static D3D9DeviceManager* getDeviceManager();
-
-		/**
-		 * @brief	Returns the internal DirectX 9 device object.
-		 */
-		static IDirect3D9* getDirect3D9();
-
-		/**
-		 * @brief	Returns the number of devices that resources should be created on.
-		 */
-		static UINT	getResourceCreationDeviceCount();
-
-		/**
-		 * @brief	Returns DirectX 9 device used for resource creation at the specified index.
-		 */
-		static IDirect3DDevice9* getResourceCreationDevice(UINT index);
-
-		/**
-		 * @brief	Returns the currently active DirectX 9 device.
-		 */
-		static IDirect3DDevice9* getActiveD3D9Device();
-
-		/**
-		 * @brief	Converts engine multisample options into DirectX 9 specific ones.
-		 *			Also test for multi-sample support on the device and returns nearest
-		 *			supported type if requested type is not available.
-		 *
-		 * @param	d3d9Device				Device to check for multisampling.
-		 * @param	multisampleCount		Number of requested samples.
-		 * @param	d3dPixelFormat			Pixel format used by the render target.
-		 * @param	fullscreen				Are we testing multisampling for a full-screen render target.
-		 * @param	outMultisampleType		Output parameter containing DirectX type representing valid multisample type.
-		 * @param	outMultisampleQuality	Output parameter containing multisample quality.
-		 */
-		void determineMultisampleSettings(IDirect3DDevice9* d3d9Device, UINT32 multisampleCount, D3DFORMAT d3dPixelFormat,
-			bool fullScreen, D3DMULTISAMPLE_TYPE* outMultisampleType, DWORD* outMultisampleQuality) const;
-
-		/**
-		 * @brief	Register a newly open window with the render system.
-		 */
-		void registerWindow(RenderWindowCore& renderWindow);
-
-	private:
-		friend class D3D9Texture;
-		friend class D3D9RenderWindow;
-		friend class D3D9Device;
-		friend class D3D9TextureManager;
-		friend class D3D9TextureCoreManager;
-		friend class D3D9DeviceManager;
-		friend class D3D9RenderWindowManager;
-		friend class D3D9RenderWindowCoreManager;
-
-		/**
-		 * @copydoc	RenderAPICore::initializePrepare
-		 */
-		void initializePrepare() override;
-
-		/**
-		 * @copydoc	RenderAPICore::initializeFinalize
-		 */
-		void initializeFinalize(const SPtr<RenderWindowCore>& primaryWindow) override;
-
-		/**
-		 * @copydoc	RenderAPICore::destroy_internal
-		 */
-		void destroyCore() override;
-
-		/**
-		 * @brief	Returns a list of available drivers and their properties.
-		 */
-		D3D9DriverList* getDirect3DDrivers() const;
-				
-		/**
-		 * @brief	Sets DirectX 9 render state option.
-		 */
-		HRESULT setRenderState(D3DRENDERSTATETYPE state, DWORD value);
-
-		/**
-		 * @brief	Sets DirectX 9 sampler state option for a sampler at the specified index.
-		 */
-		HRESULT setSamplerState(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value);
-
-		/**
-		 * @brief	Sets DirectX 9 texture state option for a texture unit at the specified index.
-		 */
-		HRESULT setTextureStageState(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value);
-
-		/**
-		 * @brief	Set a floating point render state option.
-		 */
-		HRESULT setFloatRenderState(D3DRENDERSTATETYPE state, float value)
-		{
-			return setRenderState(state, *((LPDWORD)(&value)));
-		}
-
-		/**
-		 * @brief	Returns currently active anisotropy level for the provided texture unit.
-		 */
-		DWORD getCurrentAnisotropy(UINT32 unit);
-
-		/**
-		 * @brief	Updates active render system capabilities. Requires active render window to check
-		 *			certain capabilities.
-		 *
-		 * @note	Also performs an initialization step when called the first time.
-		 */
-		RenderAPICapabilities* updateRenderSystemCapabilities(D3D9RenderWindowCore* renderWindow);
-
-		/**
-		 * @brief	Updates render system capabilities with vertex shader related data.
-		 */
-        void updateVertexShaderCaps(RenderAPICapabilities* rsc) const;
-
-		/**
-		 * @brief	Updates render system capabilities with pixel shader related data.
-		 */
-        void updatePixelShaderCaps(RenderAPICapabilities* rsc) const;
-
-		/**
-		 * @copydoc	RenderAPICore::setClipPlanesImpl
-		 */
-		void setClipPlanesImpl(const PlaneList& clipPlanes) override;
-
-		/**
-		 * @brief	Converts a HRESULT error number into an error description.
-		 */
-		String getErrorDescription(long errorNumber) const;
-
-		/**
-		 * @brief	Sets a clip plane with the specified index.
-		 */
-		void setClipPlane(UINT16 index, float A, float B, float C, float D);
-
-		/**
-		 * @brief	Enables or disables a clip plane at the specified index.
-		 */
-		void enableClipPlane(UINT16 index, bool enable);
-
-		/**
-		 * @brief	Returns current module instance.
-		 */
-		HINSTANCE getInstanceHandle() const { return mhInstance; }
-
-		/**
-		 * @brief	Returns the D3D9 specific mode used for drawing, depending on the
-		 * 			currently set draw operation.
-		 */
-		D3DPRIMITIVETYPE getD3D9PrimitiveType() const;
-
-		/************************************************************************/
-		/* 							Sampler states                     			*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Sets the texture addressing mode for a texture unit. This determines
-		 *			how are UV address values outside of [0, 1] range handled when sampling
-		 *			from texture.
-		 */
-		void setTextureAddressingMode(UINT16 stage, const UVWAddressingMode& uvw);
-
-		/**
-		 * @brief	Allows you to specify how is the texture bound to the specified texture unit filtered.
-		 *			Different filter types are used for different situations like magnifying or minifying a texture.
-		 */
-		void setTextureFiltering(UINT16 unit, FilterType ftype, FilterOptions filter);
-
-		/**
-		 * @brief	Sets anisotropy value for the specified texture unit.
-		 */
-		void setTextureAnisotropy(UINT16 unit, unsigned int maxAnisotropy);
-
-		/**
-		 * @brief	Sets the texture border color for a texture unit. Border color
-		 *			determines color returned by the texture sampler when border addressing mode
-		 *			is used and texture address is outside of [0, 1] range.
-		 */
-		void setTextureBorderColor(UINT16 stage, const Color& color);
-
-		/**
-		 * @brief	Sets the mipmap bias value for a given texture unit. Bias allows
-		 *			you to adjust the mipmap selection calculation. Negative values force a
-		 *			larger mipmap to be used, and positive values smaller. Units are in values
-		 *			of mip levels, so -1 means use a mipmap one level higher than default.
-		 */
-		void setTextureMipmapBias(UINT16 unit, float bias);
-
-		/************************************************************************/
-		/* 								Blend states                      		*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
-		 *			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor).
-		 */
-		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op);
-
-		/**
-		* @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
-		*			Allows you to set up separate blend operations for alpha values.
-		*	
-		*			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor). (And the same for alpha)
-		*/
-		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
-			BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp);
-
-		/**
-		 * @brief	Sets alpha test that allows you to reject pixels that fail the comparison function
-		 *			versus the provided reference value.
-		 */
-		void setAlphaTest(CompareFunction func, unsigned char value);
-
-		/**
-		 * @brief	Enable alpha to coverage. Alpha to coverage allows you to perform blending without needing 
-		 *			to worry about order of rendering like regular blending does. It requires multi-sampling to 
-		 *			be active in order to work, and you need to supply an alpha texture that determines object transparency.
-		 */
-		void setAlphaToCoverage(bool enabled);
-
-		/**
-		 * @brief	Enables or disables writing to certain color channels of the render target.
-		 */
-		void setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha);
-
-		/************************************************************************/
-		/* 								Rasterizer states                  		*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Sets vertex winding order. Normally you would use this to cull back facing
-		 *			polygons.
-		 */
-		void setCullingMode(CullingMode mode);
-
-		/**
-		 * @brief	Sets the polygon rasterization mode. Determines how are polygons interpreted.
-		 */
-		void setPolygonMode(PolygonMode level);
-
-		/**
-		 * @brief	Sets a depth bias that will offset the depth values of new pixels by the specified amount.
-		 *			Final depth bias value is a combination of the constant depth bias and slope depth bias.
-		 *			Slope depth bias has more effect the higher the slope of the rendered polygon.
-		 *
-		 * @note	This is useful if you want to avoid z fighting for objects at the same or similar depth.
-		 */
-		void setDepthBias(float constantBias, float slopeScaleBias);
-
-		/**
-		 * @brief	Scissor test allows you to mask off rendering in all but a given rectangular area
-		 * 			identified by the rectangle set by setScissorRect().
-		 */
-		void setScissorTestEnable(bool enable);
-
-		/**
-		 * @brief	Only applies when rendering to a multisample render target.
-		 * 			If disabled all of the samples will be taken from the center of the pixel,
-		 * 			effectively making the image aliased. Default value is true where samples are
-		 * 			picked randomly within the pixel.
-		 */
-		void setMultisampleAntialiasEnable(bool enable);
-
-		/**
-		 * @brief	Only applies when rendering to a non-multisample render target.
-		 * 			If enabled, lines will be antialiased. Default state is disabled.
-		 */
-		void setAntialiasedLineEnable(bool enable);
-
-		/************************************************************************/
-		/* 						Depth stencil state                      		*/
-		/************************************************************************/
-		
-		/**
-		 * @brief	Should new pixels perform depth testing using the set depth comparison function before
-		 *			being written.
-		 */
-		void setDepthBufferCheckEnabled(bool enabled = true);
-
-		/**
-		 * @brief	Should new pixels write to the depth buffer.
-		 */
-		void setDepthBufferWriteEnabled(bool enabled = true);
-
-		/**
-		 * @brief	Sets comparison function used for depth testing. Determines how are new and existing
-		 *			pixel values compared - if comparison function returns true the new pixel is written.
-		 */
-		void setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL);
-
-		/**
-		 * @brief	Turns stencil tests on or off. By default this is disabled.
-		 *			Stencil testing allow you to mask out a part of the rendered image by using
-		 *			various stencil operations provided.
-		 */
-		void setStencilCheckEnabled(bool enabled);
-
-		/**
-		 * @brief	Allows you to set stencil operations that are performed when stencil test passes or fails.
-		 *
-		 * @param	stencilFailOp	Operation executed when stencil test fails.
-		 * @param	depthFailOp		Operation executed when stencil test succeeds but depth test fails.
-		 * @param	passOp			Operation executed when stencil test succeeds and depth test succeeds.
-		 * @param	front			Should the stencil operations be applied to front or back facing polygons.
-		 */
-		void setStencilBufferOperations(StencilOperation stencilFailOp = SOP_KEEP,
-			StencilOperation depthFailOp = SOP_KEEP, StencilOperation passOp = SOP_KEEP,
-			bool ccw = true);
-
-		/**
-		 * @brief	Sets a stencil buffer comparison function. The result of this will cause one of 3 actions 
-		 *			depending on whether the test fails, succeeds but with the depth buffer check still failing, 
-		 *			or succeeds with the depth buffer check passing too.
-		 *
-		 * @param func	Comparison function that determines whether a stencil test fails or passes. Reference value
-		 *				gets compared to the value already in the buffer using this function.
-		 * @param ccw	If set to true, the stencil operations will be applied to counterclockwise
-		 *				faces. Otherwise they will be applied to clockwise faces.
-		 */
-		void setStencilBufferFunc(CompareFunction func = CMPF_ALWAYS_PASS, bool ccw = true);
-
-		/**
-		 * @brief	The bitmask applied to both the stencil value and the reference value
-		 *			before comparison.
-		 */
-		void setStencilBufferReadMask(UINT32 mask = 0xFFFFFFFF);
-
-		/**
-		 * @brief	The bitmask applied to the stencil value before writing it to the stencil buffer.
-		 */
-		void setStencilBufferWriteMask(UINT32 mask = 0xFFFFFFFF);
-
-		/**
-		 * @brief	Sets a reference values used for stencil buffer comparisons. 
-		 * 			Actual comparison function and stencil operations are set by setting the DepthStencilState.
-		 */
-		void setStencilRefValue(UINT32 refValue);
-
-		/**
-		 * @brief	Clears an area of the currently active render target.
-		 *
-		 * @param	buffers			Combination of one or more elements of FrameBufferType
-		 *							denoting which buffers are to be cleared.
-		 * @param	color			(optional) The color to clear the color buffer with, if enabled.
-		 * @param	depth			(optional) The value to initialize the depth buffer with, if enabled.
-		 * @param	stencil			(optional) The value to initialize the stencil buffer with, if enabled.
-		 * @param	clearArea		(optional) Area in pixels to clear.
-		 */
-		void clearArea(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, const Rect2I& clearArea = Rect2I::EMPTY);
-
-		/**
-		 * @brief	Recalculates actual viewport dimensions based on currently 
-		 *			set viewport normalized dimensions and render target and applies
-		 *			them for further rendering.
-		 */
-		void applyViewport();
-
-		/**
-		 * @brief	Triggered when device has been lost.
-		 */
-		void notifyOnDeviceLost(D3D9Device* device);
-
-		/**
-		 * @brief	Triggered when device is being reset.
-		 */
-		void notifyOnDeviceReset(D3D9Device* device);
-
-	private:
-		/**
-		 * @brief	Holds texture unit settings.
-		 */
-		struct sD3DTextureStageDesc
-		{
-			D3D9Mappings::D3DTexType texType;
-			size_t coordIndex;
-			IDirect3DBaseTexture9 *pTex;
-			IDirect3DBaseTexture9 *pVertexTex;
-		};
-
-		static D3D9RenderAPI* msD3D9RenderSystem;
-
-		IDirect3D9*	mpD3D;
-		D3D9HLSLProgramFactory* mHLSLProgramFactory;
-		D3D9ResourceManager* mResourceManager;
-		D3D9DeviceManager* mDeviceManager;
-
-		mutable D3D9DriverList* mDriverList;
-		D3D9Driver* mActiveD3DDriver;
-
-		UINT32 mNumTexStages;
-		sD3DTextureStageDesc* mTexStageDesc;
-
-		bool mIsFrameInProgress;
-		bool mRestoreFrameOnReset;
-
-		HINSTANCE mhInstance;
-
-		Rect2 mViewportNorm;
-		UINT32 mViewportLeft, mViewportTop, mViewportWidth, mViewportHeight;
-		RECT mScissorRect;
-
-		DrawOperationType mCurrentDrawOperation;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsD3D9Prerequisites.h"
+#include "BsRenderAPI.h"
+#include "BsRenderAPICapabilities.h"
+#include "BsD3D9Mappings.h"
+
+namespace BansheeEngine 
+{
+	/**
+	 * @brief	Implementation of a render system using DirectX 9. Provides abstracted
+	 *			access to various low level DX9 methods.
+	 */
+	class BS_D3D9_EXPORT D3D9RenderAPI : public RenderAPICore
+	{
+	public:
+		/**
+		 * @brief	Constructs a new instance of the render system using the provided module instance.
+		 */
+		D3D9RenderAPI(HINSTANCE hInstance);
+		~D3D9RenderAPI();
+
+		/**
+		 * @copydoc RenderAPICore::getName()
+		 */
+		const StringID& getName() const override;
+
+		/**
+		 * @copydoc RenderAPICore::getShadingLanguageName()
+		 */
+		const String& getShadingLanguageName() const override;
+
+		/**
+		 * @copydoc RenderAPICore::setRenderTarget()
+		 */
+		void setRenderTarget(const SPtr<RenderTargetCore>& target, bool readOnlyDepthStencil = false) override;
+
+		/**
+		 * @copydoc RenderAPICore::bindGpuProgram()
+		 */
+		void bindGpuProgram(const SPtr<GpuProgramCore>& prg) override;
+
+		/**
+		 * @copydoc RenderAPICore::unbindGpuProgram()
+		 */
+		void unbindGpuProgram(GpuProgramType gptype) override;
+
+		/**
+		 * @copydoc RenderAPICore::setConstantBuffers()
+		 */
+		void setConstantBuffers(GpuProgramType gptype, const SPtr<GpuParamsCore>& params) override;
+
+		/**
+		 * @copydoc RenderAPICore::setVertexBuffers()
+		 */
+		void setVertexBuffers(UINT32 index, SPtr<VertexBufferCore>* buffers, UINT32 numBuffers) override;
+
+		/**
+		 * @copydoc RenderAPICore::setIndexBuffer()
+		 */
+		void setIndexBuffer(const SPtr<IndexBufferCore>& buffer) override;
+
+		/**
+		 * @copydoc RenderAPICore::setVertexDeclaration()
+		 */
+		void setVertexDeclaration(const SPtr<VertexDeclarationCore>& vertexDeclaration) override;
+
+		/**
+		 * @copydoc RenderAPICore::setDrawOperation()
+		 */
+		void setDrawOperation(DrawOperationType op) override;
+
+		/**
+		 * @copydoc RenderAPICore::setTexture()
+		 */
+		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr) override;
+
+		/**
+		 * @copydoc RenderAPICore::setLoadStoreTexture()
+		 */
+		void setLoadStoreTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr,
+			const TextureSurface& surface) override;
+
+		/**
+		 * @copydoc RenderAPICore::setSamplerState()
+		 */
+		void setSamplerState(GpuProgramType gptype, UINT16 unit, const SPtr<SamplerStateCore>& state) override;
+
+		/**
+		 * @copydoc RenderAPICore::setBlendState()
+		 */
+		void setBlendState(const SPtr<BlendStateCore>& blendState) override;
+
+		/**
+		 * @copydoc RenderAPICore::setRasterizerState()
+		 */
+		void setRasterizerState(const SPtr<RasterizerStateCore>& rasterizerState) override;
+
+		/**
+		 * @copydoc RenderAPICore::setDepthStencilState()
+		 */
+		void setDepthStencilState(const SPtr<DepthStencilStateCore>& depthStencilState, UINT32 stencilRefValue) override;
+
+		/**
+		 * @copydoc RenderAPICore::setViewport()
+		 */
+		void setViewport(const Rect2& vp) override;
+
+		/**
+		 * @copydoc RenderAPICore::beginFrame()
+		 */
+		void beginFrame() override;
+
+		/**
+		 * @copydoc RenderAPICore::endFrame()
+		 */
+		void endFrame() override;
+
+		/**
+		 * @copydoc RenderAPICore::draw()
+		 */
+		void draw(UINT32 vertexOffset, UINT32 vertexCount) override;
+
+		/**
+		 * @copydoc RenderAPICore::drawIndexed()
+		 */
+		void drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount) override;
+
+		/**
+		 * @copydoc RenderAPICore::dispatchCompute()
+		 */
+		void dispatchCompute(UINT32 numGroupsX, UINT32 numGroupsY = 1, UINT32 numGroupsZ = 1) override;
+
+		/**
+		 * @copydoc RenderAPICore::setScissorRect()
+		 */
+		void setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom) override;
+
+		/**
+		 * @copydoc RenderAPICore::clearRenderTarget()
+		 */
+		void clearRenderTarget(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
+			UINT8 targetMask = 0xFF) override;
+
+		/**
+		 * @copydoc RenderAPICore::clearViewport()
+		 */
+		void clearViewport(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
+			UINT8 targetMask = 0xFF) override;
+
+		/**
+		 * @copydoc RenderAPICore::convertProjectionMatrix()
+		 */
+		void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest) override;
+
+		/**
+		 * @copydoc	RenderAPICore::getHorizontalTexelOffset
+		 */
+		float getHorizontalTexelOffset() override;
+
+		/**
+		 * @copydoc	RenderAPICore::getVerticalTexelOffset
+		 */
+		float getVerticalTexelOffset() override;
+
+		/**
+		 * @copydoc	RenderAPICore::getMinimumDepthInputValue
+		 */
+		float getMinimumDepthInputValue() override;
+
+		/**
+		 * @copydoc	RenderAPICore::getMaximumDepthInputValue
+		 */
+		float getMaximumDepthInputValue() override;
+
+		/**
+		 * @copydoc	RenderAPICore::getColorVertexElementType
+		 */
+		VertexElementType getColorVertexElementType() const override;
+
+		/**
+		 * @copydoc	RenderAPICore::getColorVertexElementType
+		 */
+		bool getVertexColorFlipRequired() const override { return true; }
+
+		/**
+		 * @copydoc RenderAPICore::generateParamBlockDesc()
+		 */
+		GpuParamBlockDesc generateParamBlockDesc(const String& name, Vector<GpuParamDataDesc>& params) override;
+
+		/************************************************************************/
+		/* 				Internal use by DX9 RenderAPI only                   */
+		/************************************************************************/
+
+		/**
+		 * @brief	Returns the resource manager instance.
+		 */
+		static D3D9ResourceManager* getResourceManager();
+
+		/**
+		 * @brief	Returns the device manager instance.
+		 */
+		static D3D9DeviceManager* getDeviceManager();
+
+		/**
+		 * @brief	Returns the internal DirectX 9 device object.
+		 */
+		static IDirect3D9* getDirect3D9();
+
+		/**
+		 * @brief	Returns the number of devices that resources should be created on.
+		 */
+		static UINT	getResourceCreationDeviceCount();
+
+		/**
+		 * @brief	Returns DirectX 9 device used for resource creation at the specified index.
+		 */
+		static IDirect3DDevice9* getResourceCreationDevice(UINT index);
+
+		/**
+		 * @brief	Returns the currently active DirectX 9 device.
+		 */
+		static IDirect3DDevice9* getActiveD3D9Device();
+
+		/**
+		 * @brief	Converts engine multisample options into DirectX 9 specific ones.
+		 *			Also test for multi-sample support on the device and returns nearest
+		 *			supported type if requested type is not available.
+		 *
+		 * @param	d3d9Device				Device to check for multisampling.
+		 * @param	multisampleCount		Number of requested samples.
+		 * @param	d3dPixelFormat			Pixel format used by the render target.
+		 * @param	fullscreen				Are we testing multisampling for a full-screen render target.
+		 * @param	outMultisampleType		Output parameter containing DirectX type representing valid multisample type.
+		 * @param	outMultisampleQuality	Output parameter containing multisample quality.
+		 */
+		void determineMultisampleSettings(IDirect3DDevice9* d3d9Device, UINT32 multisampleCount, D3DFORMAT d3dPixelFormat,
+			bool fullScreen, D3DMULTISAMPLE_TYPE* outMultisampleType, DWORD* outMultisampleQuality) const;
+
+		/**
+		 * @brief	Register a newly open window with the render system.
+		 */
+		void registerWindow(RenderWindowCore& renderWindow);
+
+	private:
+		friend class D3D9Texture;
+		friend class D3D9RenderWindow;
+		friend class D3D9Device;
+		friend class D3D9TextureManager;
+		friend class D3D9TextureCoreManager;
+		friend class D3D9DeviceManager;
+		friend class D3D9RenderWindowManager;
+		friend class D3D9RenderWindowCoreManager;
+
+		/**
+		 * @copydoc	RenderAPICore::initializePrepare
+		 */
+		void initializePrepare() override;
+
+		/**
+		 * @copydoc	RenderAPICore::initializeFinalize
+		 */
+		void initializeFinalize(const SPtr<RenderWindowCore>& primaryWindow) override;
+
+		/**
+		 * @copydoc	RenderAPICore::destroy_internal
+		 */
+		void destroyCore() override;
+
+		/**
+		 * @brief	Returns a list of available drivers and their properties.
+		 */
+		D3D9DriverList* getDirect3DDrivers() const;
+				
+		/**
+		 * @brief	Sets DirectX 9 render state option.
+		 */
+		HRESULT setRenderState(D3DRENDERSTATETYPE state, DWORD value);
+
+		/**
+		 * @brief	Sets DirectX 9 sampler state option for a sampler at the specified index.
+		 */
+		HRESULT setSamplerState(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value);
+
+		/**
+		 * @brief	Sets DirectX 9 texture state option for a texture unit at the specified index.
+		 */
+		HRESULT setTextureStageState(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value);
+
+		/**
+		 * @brief	Set a floating point render state option.
+		 */
+		HRESULT setFloatRenderState(D3DRENDERSTATETYPE state, float value)
+		{
+			return setRenderState(state, *((LPDWORD)(&value)));
+		}
+
+		/**
+		 * @brief	Returns currently active anisotropy level for the provided texture unit.
+		 */
+		DWORD getCurrentAnisotropy(UINT32 unit);
+
+		/**
+		 * @brief	Updates active render system capabilities. Requires active render window to check
+		 *			certain capabilities.
+		 *
+		 * @note	Also performs an initialization step when called the first time.
+		 */
+		RenderAPICapabilities* updateRenderSystemCapabilities(D3D9RenderWindowCore* renderWindow);
+
+		/**
+		 * @brief	Updates render system capabilities with vertex shader related data.
+		 */
+        void updateVertexShaderCaps(RenderAPICapabilities* rsc) const;
+
+		/**
+		 * @brief	Updates render system capabilities with pixel shader related data.
+		 */
+        void updatePixelShaderCaps(RenderAPICapabilities* rsc) const;
+
+		/**
+		 * @copydoc	RenderAPICore::setClipPlanesImpl
+		 */
+		void setClipPlanesImpl(const PlaneList& clipPlanes) override;
+
+		/**
+		 * @brief	Converts a HRESULT error number into an error description.
+		 */
+		String getErrorDescription(long errorNumber) const;
+
+		/**
+		 * @brief	Sets a clip plane with the specified index.
+		 */
+		void setClipPlane(UINT16 index, float A, float B, float C, float D);
+
+		/**
+		 * @brief	Enables or disables a clip plane at the specified index.
+		 */
+		void enableClipPlane(UINT16 index, bool enable);
+
+		/**
+		 * @brief	Returns current module instance.
+		 */
+		HINSTANCE getInstanceHandle() const { return mhInstance; }
+
+		/**
+		 * @brief	Returns the D3D9 specific mode used for drawing, depending on the
+		 * 			currently set draw operation.
+		 */
+		D3DPRIMITIVETYPE getD3D9PrimitiveType() const;
+
+		/************************************************************************/
+		/* 							Sampler states                     			*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Sets the texture addressing mode for a texture unit. This determines
+		 *			how are UV address values outside of [0, 1] range handled when sampling
+		 *			from texture.
+		 */
+		void setTextureAddressingMode(UINT16 stage, const UVWAddressingMode& uvw);
+
+		/**
+		 * @brief	Allows you to specify how is the texture bound to the specified texture unit filtered.
+		 *			Different filter types are used for different situations like magnifying or minifying a texture.
+		 */
+		void setTextureFiltering(UINT16 unit, FilterType ftype, FilterOptions filter);
+
+		/**
+		 * @brief	Sets anisotropy value for the specified texture unit.
+		 */
+		void setTextureAnisotropy(UINT16 unit, unsigned int maxAnisotropy);
+
+		/**
+		 * @brief	Sets the texture border color for a texture unit. Border color
+		 *			determines color returned by the texture sampler when border addressing mode
+		 *			is used and texture address is outside of [0, 1] range.
+		 */
+		void setTextureBorderColor(UINT16 stage, const Color& color);
+
+		/**
+		 * @brief	Sets the mipmap bias value for a given texture unit. Bias allows
+		 *			you to adjust the mipmap selection calculation. Negative values force a
+		 *			larger mipmap to be used, and positive values smaller. Units are in values
+		 *			of mip levels, so -1 means use a mipmap one level higher than default.
+		 */
+		void setTextureMipmapBias(UINT16 unit, float bias);
+
+		/************************************************************************/
+		/* 								Blend states                      		*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
+		 *			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor).
+		 */
+		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op);
+
+		/**
+		* @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
+		*			Allows you to set up separate blend operations for alpha values.
+		*	
+		*			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor). (And the same for alpha)
+		*/
+		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
+			BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp);
+
+		/**
+		 * @brief	Sets alpha test that allows you to reject pixels that fail the comparison function
+		 *			versus the provided reference value.
+		 */
+		void setAlphaTest(CompareFunction func, unsigned char value);
+
+		/**
+		 * @brief	Enable alpha to coverage. Alpha to coverage allows you to perform blending without needing 
+		 *			to worry about order of rendering like regular blending does. It requires multi-sampling to 
+		 *			be active in order to work, and you need to supply an alpha texture that determines object transparency.
+		 */
+		void setAlphaToCoverage(bool enabled);
+
+		/**
+		 * @brief	Enables or disables writing to certain color channels of the render target.
+		 */
+		void setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha);
+
+		/************************************************************************/
+		/* 								Rasterizer states                  		*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Sets vertex winding order. Normally you would use this to cull back facing
+		 *			polygons.
+		 */
+		void setCullingMode(CullingMode mode);
+
+		/**
+		 * @brief	Sets the polygon rasterization mode. Determines how are polygons interpreted.
+		 */
+		void setPolygonMode(PolygonMode level);
+
+		/**
+		 * @brief	Sets a depth bias that will offset the depth values of new pixels by the specified amount.
+		 *			Final depth bias value is a combination of the constant depth bias and slope depth bias.
+		 *			Slope depth bias has more effect the higher the slope of the rendered polygon.
+		 *
+		 * @note	This is useful if you want to avoid z fighting for objects at the same or similar depth.
+		 */
+		void setDepthBias(float constantBias, float slopeScaleBias);
+
+		/**
+		 * @brief	Scissor test allows you to mask off rendering in all but a given rectangular area
+		 * 			identified by the rectangle set by setScissorRect().
+		 */
+		void setScissorTestEnable(bool enable);
+
+		/**
+		 * @brief	Only applies when rendering to a multisample render target.
+		 * 			If disabled all of the samples will be taken from the center of the pixel,
+		 * 			effectively making the image aliased. Default value is true where samples are
+		 * 			picked randomly within the pixel.
+		 */
+		void setMultisampleAntialiasEnable(bool enable);
+
+		/**
+		 * @brief	Only applies when rendering to a non-multisample render target.
+		 * 			If enabled, lines will be antialiased. Default state is disabled.
+		 */
+		void setAntialiasedLineEnable(bool enable);
+
+		/************************************************************************/
+		/* 						Depth stencil state                      		*/
+		/************************************************************************/
+		
+		/**
+		 * @brief	Should new pixels perform depth testing using the set depth comparison function before
+		 *			being written.
+		 */
+		void setDepthBufferCheckEnabled(bool enabled = true);
+
+		/**
+		 * @brief	Should new pixels write to the depth buffer.
+		 */
+		void setDepthBufferWriteEnabled(bool enabled = true);
+
+		/**
+		 * @brief	Sets comparison function used for depth testing. Determines how are new and existing
+		 *			pixel values compared - if comparison function returns true the new pixel is written.
+		 */
+		void setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL);
+
+		/**
+		 * @brief	Turns stencil tests on or off. By default this is disabled.
+		 *			Stencil testing allow you to mask out a part of the rendered image by using
+		 *			various stencil operations provided.
+		 */
+		void setStencilCheckEnabled(bool enabled);
+
+		/**
+		 * @brief	Allows you to set stencil operations that are performed when stencil test passes or fails.
+		 *
+		 * @param	stencilFailOp	Operation executed when stencil test fails.
+		 * @param	depthFailOp		Operation executed when stencil test succeeds but depth test fails.
+		 * @param	passOp			Operation executed when stencil test succeeds and depth test succeeds.
+		 * @param	front			Should the stencil operations be applied to front or back facing polygons.
+		 */
+		void setStencilBufferOperations(StencilOperation stencilFailOp = SOP_KEEP,
+			StencilOperation depthFailOp = SOP_KEEP, StencilOperation passOp = SOP_KEEP,
+			bool ccw = true);
+
+		/**
+		 * @brief	Sets a stencil buffer comparison function. The result of this will cause one of 3 actions 
+		 *			depending on whether the test fails, succeeds but with the depth buffer check still failing, 
+		 *			or succeeds with the depth buffer check passing too.
+		 *
+		 * @param func	Comparison function that determines whether a stencil test fails or passes. Reference value
+		 *				gets compared to the value already in the buffer using this function.
+		 * @param ccw	If set to true, the stencil operations will be applied to counterclockwise
+		 *				faces. Otherwise they will be applied to clockwise faces.
+		 */
+		void setStencilBufferFunc(CompareFunction func = CMPF_ALWAYS_PASS, bool ccw = true);
+
+		/**
+		 * @brief	The bitmask applied to both the stencil value and the reference value
+		 *			before comparison.
+		 */
+		void setStencilBufferReadMask(UINT32 mask = 0xFFFFFFFF);
+
+		/**
+		 * @brief	The bitmask applied to the stencil value before writing it to the stencil buffer.
+		 */
+		void setStencilBufferWriteMask(UINT32 mask = 0xFFFFFFFF);
+
+		/**
+		 * @brief	Sets a reference values used for stencil buffer comparisons. 
+		 * 			Actual comparison function and stencil operations are set by setting the DepthStencilState.
+		 */
+		void setStencilRefValue(UINT32 refValue);
+
+		/**
+		 * @brief	Clears an area of the currently active render target.
+		 *
+		 * @param	buffers			Combination of one or more elements of FrameBufferType
+		 *							denoting which buffers are to be cleared.
+		 * @param	color			(optional) The color to clear the color buffer with, if enabled.
+		 * @param	depth			(optional) The value to initialize the depth buffer with, if enabled.
+		 * @param	stencil			(optional) The value to initialize the stencil buffer with, if enabled.
+		 * @param	clearArea		(optional) Area in pixels to clear.
+		 */
+		void clearArea(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, const Rect2I& clearArea = Rect2I::EMPTY);
+
+		/**
+		 * @brief	Recalculates actual viewport dimensions based on currently 
+		 *			set viewport normalized dimensions and render target and applies
+		 *			them for further rendering.
+		 */
+		void applyViewport();
+
+		/**
+		 * @brief	Triggered when device has been lost.
+		 */
+		void notifyOnDeviceLost(D3D9Device* device);
+
+		/**
+		 * @brief	Triggered when device is being reset.
+		 */
+		void notifyOnDeviceReset(D3D9Device* device);
+
+	private:
+		/**
+		 * @brief	Holds texture unit settings.
+		 */
+		struct sD3DTextureStageDesc
+		{
+			D3D9Mappings::D3DTexType texType;
+			size_t coordIndex;
+			IDirect3DBaseTexture9 *pTex;
+			IDirect3DBaseTexture9 *pVertexTex;
+		};
+
+		static D3D9RenderAPI* msD3D9RenderSystem;
+
+		IDirect3D9*	mpD3D;
+		D3D9HLSLProgramFactory* mHLSLProgramFactory;
+		D3D9ResourceManager* mResourceManager;
+		D3D9DeviceManager* mDeviceManager;
+
+		mutable D3D9DriverList* mDriverList;
+		D3D9Driver* mActiveD3DDriver;
+
+		UINT32 mNumTexStages;
+		sD3DTextureStageDesc* mTexStageDesc;
+
+		bool mIsFrameInProgress;
+		bool mRestoreFrameOnReset;
+
+		HINSTANCE mhInstance;
+
+		Rect2 mViewportNorm;
+		UINT32 mViewportLeft, mViewportTop, mViewportWidth, mViewportHeight;
+		RECT mScissorRect;
+
+		DrawOperationType mCurrentDrawOperation;
+	};
 }
 }

+ 34 - 34
Source/BansheeFBXImporter/Include/BsFBXPrerequisites.h

@@ -1,35 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
-#	ifdef BS_FBX_EXPORTS
-#		define BS_FBX_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_FBX_EXPORT
-#       else
-#    		define BS_FBX_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#elif defined ( BS_GCC_VISIBILITY )
-#    define BS_FBX_EXPORT  __attribute__ ((visibility("default")))
-#else
-#    define BS_FBX_EXPORT
-#endif
-
-/** @addtogroup Plugins/
-
-/** @defgroup FBX FBX
- *	Mesh importer for FBX file format.
- */
-
-/** @} */
-
-#define FBXSDK_NEW_API
-#include <fbxsdk.h>
-
-#define FBX_IMPORT_MAX_UV_LAYERS 2
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
+#	ifdef BS_FBX_EXPORTS
+#		define BS_FBX_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_FBX_EXPORT
+#       else
+#    		define BS_FBX_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#elif defined ( BS_GCC_VISIBILITY )
+#    define BS_FBX_EXPORT  __attribute__ ((visibility("default")))
+#else
+#    define BS_FBX_EXPORT
+#endif
+
+/** @addtogroup Plugins/
+
+/** @defgroup FBX BansheeFBXImporter
+ *	Mesh importer for FBX file format.
+ */
+
+/** @} */
+
+#define FBXSDK_NEW_API
+#include <fbxsdk.h>
+
+#define FBX_IMPORT_MAX_UV_LAYERS 2
 #define FBX_IMPORT_MAX_BONE_INFLUENCES 4
 #define FBX_IMPORT_MAX_BONE_INFLUENCES 4

+ 28 - 28
Source/BansheeFontImporter/Include/BsFontPrerequisites.h

@@ -1,29 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
-#	ifdef BS_FONT_EXPORTS
-#		define BS_FONT_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_FONT_EXPORT
-#       else
-#    		define BS_FONT_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#elif defined ( BS_GCC_VISIBILITY )
-#    define BS_FONT_EXPORT  __attribute__ ((visibility("default")))
-#else
-#    define BS_FONT_EXPORT
-#endif
-
-/** @addtogroup Plugins/
-
-/** @defgroup Font Font
- *	FreeType importer for font file formats (TTF, OTF).
- */
-
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
+#	ifdef BS_FONT_EXPORTS
+#		define BS_FONT_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_FONT_EXPORT
+#       else
+#    		define BS_FONT_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#elif defined ( BS_GCC_VISIBILITY )
+#    define BS_FONT_EXPORT  __attribute__ ((visibility("default")))
+#else
+#    define BS_FONT_EXPORT
+#endif
+
+/** @addtogroup Plugins/
+
+/** @defgroup Font BansheeFontImporter
+ *	FreeType importer for font file formats (TTF, OTF).
+ */
+
 /** @} */
 /** @} */

+ 28 - 28
Source/BansheeFreeImgImporter/Include/BsFreeImgPrerequisites.h

@@ -1,29 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
-#	ifdef BS_FREEIMG_EXPORTS
-#		define BS_FREEIMG_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_FREEIMG_EXPORT
-#       else
-#    		define BS_FREEIMG_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#elif defined ( BS_GCC_VISIBILITY )
-#    define BS_FREEIMG_EXPORT  __attribute__ ((visibility("default")))
-#else
-#    define BS_FREEIMG_EXPORT
-#endif
-
-/** @addtogroup Plugins/
-
-/** @defgroup FreeImg FreeImg
- *	FreeImg importer for importing most popular image formats (e.g. PSD, PNG, JPG, etc.).
- */
-
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
+#	ifdef BS_FREEIMG_EXPORTS
+#		define BS_FREEIMG_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_FREEIMG_EXPORT
+#       else
+#    		define BS_FREEIMG_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#elif defined ( BS_GCC_VISIBILITY )
+#    define BS_FREEIMG_EXPORT  __attribute__ ((visibility("default")))
+#else
+#    define BS_FREEIMG_EXPORT
+#endif
+
+/** @addtogroup Plugins/
+
+/** @defgroup FreeImg BansheeFreeImgImporter
+ *	FreeImg importer for importing most popular image formats (e.g. PSD, PNG, JPG, etc.).
+ */
+
 /** @} */
 /** @} */

+ 616 - 616
Source/BansheeGLRenderAPI/Include/BsGLRenderAPI.h

@@ -1,616 +1,616 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsGLPrerequisites.h"
-#include "BsRenderAPI.h"
-#include "BsGLHardwareBufferManager.h"
-#include "BsGLSLProgramFactory.h"
-#include "BsMatrix4.h"
-
-namespace BansheeEngine 
-{
-	/**
-	 * @brief	Implementation of a render system using OpenGL. Provides abstracted
-	 *			access to various low level OpenGL methods.
-	 */
-    class BS_RSGL_EXPORT GLRenderAPI : public RenderAPICore
-    {
-    public:
-        GLRenderAPI();
-        ~GLRenderAPI();
-
-		/**
-		 * @copydoc RenderAPICore::getName()
-		 */
-		const StringID& getName() const override;
-
-		/**
-		 * @copydoc RenderAPICore::getShadingLanguageName()
-		 */
-		const String& getShadingLanguageName() const override;
-
-		/**
-		 * @copydoc RenderAPICore::setRenderTarget()
-		 */
-		void setRenderTarget(const SPtr<RenderTargetCore>& target, bool readOnlyDepthStencil = false) override;
-
-        /**
-		 * @copydoc RenderAPICore::setVertexBuffers()
-		 */
-		void setVertexBuffers(UINT32 index, SPtr<VertexBufferCore>* buffers, UINT32 numBuffers) override;
-
-		/**
-		 * @copydoc RenderAPICore::setIndexBuffer()
-		 */
-		void setIndexBuffer(const SPtr<IndexBufferCore>& buffer) override;
-
-		/**
-		 * @copydoc RenderAPICore::setVertexDeclaration()
-		 */
-		void setVertexDeclaration(const SPtr<VertexDeclarationCore>& vertexDeclaration) override;
-
-		/**
-		 * @copydoc RenderAPICore::setDrawOperation()
-		 */
-		void setDrawOperation(DrawOperationType op) override;
-
-        /**
-		 * @copydoc RenderAPICore::setScissorRect()
-		 */
-		void setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom) override;
-
-		/**
-		 * @copydoc RenderAPICore::setTexture()
-		 */
-		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& tex) override;
-
-		/**
-		 * @copydoc	RenderAPICore::setLoadStoreTexture
-		 */
-		void setLoadStoreTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr,
-			const TextureSurface& surface) override;
-        
-		/**
-		 * @copydoc RenderAPICore::setSamplerState()
-		 */
-		void setSamplerState(GpuProgramType gptype, UINT16 unit, const SPtr<SamplerStateCore>& state) override;
-
-		/**
-		 * @copydoc RenderAPICore::setBlendState()
-		 */
-		void setBlendState(const SPtr<BlendStateCore>& blendState) override;
-
-		/**
-		 * @copydoc RenderAPICore::setRasterizerState()
-		 */
-		void setRasterizerState(const SPtr<RasterizerStateCore>& rasterizerState) override;
-
-		/**
-		 * @copydoc RenderAPICore::setDepthStencilState()
-		 */
-		void setDepthStencilState(const SPtr<DepthStencilStateCore>& depthStencilState, UINT32 stencilRefValue) override;
-
-		/**
-		 * @copydoc RenderAPICore::setViewport()
-		 */
-		void setViewport(const Rect2& area) override;
-
-		/**
-		 * @copydoc RenderAPICore::bindGpuProgram()
-		 */
-		void bindGpuProgram(const SPtr<GpuProgramCore>& prg) override;
-
-		/**
-		 * @copydoc RenderAPICore::unbindGpuProgram()
-		 */
-		void unbindGpuProgram(GpuProgramType gptype) override;
-
-		/**
-		 * @copydoc RenderAPICore::setConstantBuffers()
-		 */
-		void setConstantBuffers(GpuProgramType gptype, const SPtr<GpuParamsCore>& params) override;
-
-		/**
-		 * @copydoc RenderAPICore::beginFrame()
-		 */
-		void beginFrame() override;
-
-		/**
-		 * @copydoc RenderAPICore::endFrame()
-		 */
-		void endFrame() override;
-
-		/**
-		 * @copydoc RenderAPICore::draw()
-		 */
-		void draw(UINT32 vertexOffset, UINT32 vertexCount) override;
-
-		/**
-		 * @copydoc RenderAPICore::drawIndexed()
-		 */
-		void drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount) override;
-
-		/**
-		 * @copydoc RenderAPICore::drawIndexed()
-		 */
-		void dispatchCompute(UINT32 numGroupsX, UINT32 numGroupsY = 1, UINT32 numGroupsZ = 1) override;
-
-		/**
-		 * @copydoc RenderAPICore::clearRenderTarget()
-		 */
-		void clearRenderTarget(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
-			UINT8 targetMask = 0xFF) override;
-
-		/**
-		 * @copydoc RenderAPICore::clearViewport()
-		 */
-		void clearViewport(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
-			UINT8 targetMask = 0xFF) override;
-
-        /**
-		 * @copydoc RenderAPICore::getColorVertexElementType()
-		 */
-		VertexElementType getColorVertexElementType() const override;
-
-		/**
-		 * @copydoc RenderAPICore::getHorizontalTexelOffset()
-		 */
-		float getHorizontalTexelOffset() override;
-
-		/**
-		 * @copydoc RenderAPICore::getVerticalTexelOffset()
-		 */
-		float getVerticalTexelOffset() override;
-
-		/**
-		 * @copydoc RenderAPICore::getMinimumDepthInputValue()
-		 */
-		float getMinimumDepthInputValue() override;
-
-		 /**
-		 * @copydoc RenderAPICore::getMaximumDepthInputValue()
-		 */
-		float getMaximumDepthInputValue() override;
-
-		/**
-		 * @copydoc RenderAPICore::convertProjectionMatrix()
-		 */
-		void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest) override;
-
-		/**
-		 * @copydoc RenderAPICore::getGpuProgramHasColumnMajorMatrices
-		 */
-		bool getGpuProgramHasColumnMajorMatrices() const override;
-
-		/**
-		 * @copydoc RenderAPICore::generateParamBlockDesc()
-		 */
-		GpuParamBlockDesc generateParamBlockDesc(const String& name, Vector<GpuParamDataDesc>& params) override;
-
-		/************************************************************************/
-		/* 				Internal use by OpenGL RenderSystem only                */
-		/************************************************************************/
-
-		/**
-		 * @brief	Query has the main context been initialized.
-		 */
-		bool _isContextInitialized() const { return mGLInitialised; }
-
-		/**
-		 * @brief	Returns main context. Caller must ensure the context has been initialized.
-		 */
-		SPtr<GLContext> getMainContext() const { return mMainContext; } 
-
-		/**
-		 * @brief	Returns a support object you may use for creating
-		 */
-		GLSupport* getGLSupport() const { return mGLSupport; }
-
-	protected:
-		/**
-		 * @copydoc	RenderAPICore::initializePrepare
-		 */
-		void initializePrepare() override;
-
-		/**
-		 * @copydoc	RenderAPICore::initializeFinalize
-		 */
-		void initializeFinalize(const SPtr<RenderWindowCore>& primaryWindow) override;
-
-		/**
-		 * @copydoc	RenderAPICore::destroy_internal().
-		 */
-		void destroyCore() override;
-
-		/**
-		* @brief	Call before doing a draw operation, this method sets everything up.
-		*/
-		void beginDraw();
-
-		/**
-		* @brief	Needs to accompany every beginDraw after you are done with a single draw operation.
-		*/
-		void endDraw();
-
-		/**
-		 * @brief	Clear a part of a render target.
-		 */
-		void clearArea(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
-			const Rect2I& clearArea = Rect2I::EMPTY, UINT8 targetMask = 0xFF);
-
-		/**
-		 * @brief	Set up clip planes against which all geometry will get clipped.
-		 */
-		void setClipPlanesImpl(const PlaneList& clipPlanes) override;
-
-		/**
-		 * @brief	Set up a clip plane at a specific clip plane index. If enabled,
-		 *			geometry will be clipped against the positive side of the plane.
-		 *
-		 * @note	Valid index range is [0, 5].
-		 */
-        void setClipPlane(UINT16 index, float A, float B, float C, float D);
-
-		/**
-		 * @brief	Enable or disable clipping against a clip plane at the specified index.
-		 *
-		 * @note	Valid index range is [0, 5].
-		 */
-        void enableClipPlane (UINT16 index, bool enable);
-
-		/**
-		* @brief	Changes the currently active texture unit. Any texture related operations
-		*			will then be performed on this unit.
-		*/
-		bool activateGLTextureUnit(UINT16 unit);
-
-		/**
-		 * @brief	Changes the active GPU program.
-		 */
-		void setActiveProgram(GpuProgramType gptype, const SPtr<GLSLGpuProgramCore>& program);
-
-		/**
-		 * @brief	Retrieves the active GPU program of the specified type.
-		 */
-		SPtr<GLSLGpuProgramCore> getActiveProgram(GpuProgramType gptype) const;
-
-		/**
-		 * @brief	Converts Banshee blend mode to OpenGL blend mode.
-		 */
-		GLint getBlendMode(BlendFactor blendMode) const;
-
-		/**
-		* @brief	Converts Banshee texture addressing mode to OpenGL texture addressing mode.
-		*/
-		GLint getTextureAddressingMode(TextureAddressingMode tam) const;
-
-		/**
-		 * @brief	Gets a combined min/mip filter value usable by OpenGL from the currently
-		 *			set min and mip filters.
-		 */
-		GLuint getCombinedMinMipFilter() const;
-
-		/**
-		* @brief	OpenGL shares all texture slots, but the engine prefers to keep textures
-		* 			separate per-stage. This will convert texture unit that is set per stage
-		* 			into a global texture unit usable by OpenGL.
-		*/
-		UINT32 getGLTextureUnit(GpuProgramType gptype, UINT32 unit);
-
-		/**
-		* @brief	OpenGL shares all buffer bindings, but the engine prefers to keep buffers
-		* 			separate per-stage. This will convert block buffer binding that is set per stage
-		* 			into a global block buffer binding usable by OpenGL.
-		*/
-		UINT32 getGLUniformBlockBinding(GpuProgramType gptype, UINT32 binding);
-
-		/**
-		* @brief	Returns the OpenGL specific mode used for drawing, depending on the
-		* 			currently set draw operation;
-		*/
-		GLint getGLDrawMode() const;
-
-		/**
-		 * @brief	Creates render system capabilities that specify which features are
-		 *			or aren't supported.
-		 */
-		RenderAPICapabilities* createRenderSystemCapabilities() const;
-
-		/**
-		 * @brief	Finish initialization by setting up any systems dependant on render system
-		 *			capabilities.
-		 */
-		void initFromCaps(RenderAPICapabilities* caps);
-
-		/**
-		 * @brief	Switch the currently used OpenGL context. You will need to re-bind
-		 *			any previously bound values manually. (e.g. textures, gpu programs and such)
-		 */
-		void switchContext(const SPtr<GLContext>& context);
-
-		/************************************************************************/
-		/* 								Sampler states                     		*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Sets the texture addressing mode for a texture unit. This determines
-		 *			how are UV address values outside of [0, 1] range handled when sampling
-		 *			from texture.
-		 */
-        void setTextureAddressingMode(UINT16 stage, const UVWAddressingMode& uvw);
-
-		/**
-		 * @brief	Sets the texture border color for a texture unit. Border color
-		 *			determines color returned by the texture sampler when border addressing mode
-		 *			is used and texture address is outside of [0, 1] range.
-		 */
-        void setTextureBorderColor(UINT16 stage, const Color& color);
-
-		/**
-		 * @brief	Sets the mipmap bias value for a given texture unit. Bias allows
-		 *			you to adjust the mipmap selection calculation. Negative values force a
-		 *			larger mipmap to be used, and positive values smaller. Units are in values
-		 *			of mip levels, so -1 means use a mipmap one level higher than default.
-		 */
-		void setTextureMipmapBias(UINT16 unit, float bias);
-
-		/**
-		 * @brief	Allows you to specify how is the texture bound to the specified texture unit filtered.
-		 *			Different filter types are used for different situations like magnifying or minifying a texture.
-		 */
-        void setTextureFiltering(UINT16 unit, FilterType ftype, FilterOptions filter);
-
-		/**
-		 * @brief	Sets anisotropy value for the specified texture unit.
-		 */
-		void setTextureAnisotropy(UINT16 unit, UINT32 maxAnisotropy);
-
-		/**
-		 * @brief	Gets anisotropy value for the specified texture unit.
-		 */
-		GLfloat getCurrentAnisotropy(UINT16 unit);
-
-		/************************************************************************/
-		/* 								Blend states                      		*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
-		 *			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor).
-		 */
-		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op);
-
-		/**
-		* @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
-		*			Allows you to set up separate blend operations for alpha values.
-		*	
-		*			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor). (And the same for alpha)
-		*/
-		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
-			BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp);
-
-		/**
-		 * @brief	Sets alpha test that allows you to reject pixels that fail the comparison function
-		 *			versus the provided reference value.
-		 */
-		void setAlphaTest(CompareFunction func, unsigned char value);
-
-		/**
-		 * @brief	Enable alpha to coverage. Alpha to coverage allows you to perform blending without needing 
-		 *			to worry about order of rendering like regular blending does. It requires multi-sampling to 
-		 *			be active in order to work, and you need to supply an alpha texture that determines object transparency.
-		 */
-		void setAlphaToCoverage(bool enabled);
-
-		/**
-		 * @brief	Enables or disables writing to certain color channels of the render target.
-		 */
-		void setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha);
-
-		/************************************************************************/
-		/* 								Rasterizer states                  		*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Sets vertex winding order. Normally you would use this to cull back facing
-		 *			polygons.
-		 */
-		void setCullingMode(CullingMode mode);
-
-		/**
-		 * @brief	Sets the polygon rasterization mode. Determines how are polygons interpreted.
-		 */
-		void setPolygonMode(PolygonMode level);
-
-		/**
-		 * @brief	Sets a depth bias that will offset the depth values of new pixels by the specified amount.
-		 *			Final depth bias value is a combination of the constant depth bias and slope depth bias.
-		 *			Slope depth bias has more effect the higher the slope of the rendered polygon.
-		 *
-		 * @note	This is useful if you want to avoid z fighting for objects at the same or similar depth.
-		 */
-		void setDepthBias(float constantBias, float slopeScaleBias);
-
-		/**
-		 * @brief	Scissor test allows you to mask off rendering in all but a given rectangular area
-		 * 			identified by the rectangle set by setScissorRect().
-		 */
-		void setScissorTestEnable(bool enable);
-
-		/**
-		 * @brief	Enables or disables multisample antialiasing.
-		 */
-		void setMultisamplingEnable(bool enable);
-
-		/**
-		 * @brief	Enables or disables depth clipping (i.e. near/fear plane clipping).
-		 */
-		void setDepthClipEnable(bool enable);
-
-		/**
-		 * @brief	Enables or disables antialiased line rendering.
-		 */
-		void setAntialiasedLineEnable(bool enable);
-
-		/************************************************************************/
-		/* 						Depth stencil state                      		*/
-		/************************************************************************/
-		
-		/**
-		 * @brief	Should new pixels perform depth testing using the set depth comparison function before
-		 *			being written.
-		 */
-		void setDepthBufferCheckEnabled(bool enabled = true);
-
-		/**
-		 * @brief	Should new pixels write to the depth buffer.
-		 */
-		void setDepthBufferWriteEnabled(bool enabled = true);
-
-		/**
-		 * @brief	Sets comparison function used for depth testing. Determines how are new and existing
-		 *			pixel values compared - if comparison function returns true the new pixel is written.
-		 */
-		void setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL);
-
-		/**
-		 * @brief	Turns stencil tests on or off. By default this is disabled.
-		 *			Stencil testing allow you to mask out a part of the rendered image by using
-		 *			various stencil operations provided.
-		 */
-		void setStencilCheckEnabled(bool enabled);
-
-		/**
-		 * @brief	Allows you to set stencil operations that are performed when stencil test passes or fails.
-		 *
-		 * @param	stencilFailOp	Operation executed when stencil test fails.
-		 * @param	depthFailOp		Operation executed when stencil test succeeds but depth test fails.
-		 * @param	passOp			Operation executed when stencil test succeeds and depth test succeeds.
-		 * @param	front			Should the stencil operations be applied to front or back facing polygons.
-		 */
-		void setStencilBufferOperations(StencilOperation stencilFailOp = SOP_KEEP,
-			StencilOperation depthFailOp = SOP_KEEP, StencilOperation passOp = SOP_KEEP,
-			bool front = true);
-
-		/**
-		 * @brief	Sets a stencil buffer comparison function. The result of this will cause one of 3 actions 
-		 *			depending on whether the test fails, succeeds but with the depth buffer check still failing, 
-		 *			or succeeds with the depth buffer check passing too.
-		 *
-		 * @param func	Comparison function that determines whether a stencil test fails or passes. Reference value
-		 *				gets compared to the value already in the buffer using this function.
-		 * @param mask	The bitmask applied to both the stencil value and the reference value
-		 *				before comparison
-		 * @param ccw	If set to true, the stencil operations will be applied to counterclockwise
-		 *				faces. Otherwise they will be applied to clockwise faces.
-		 */
-		void setStencilBufferFunc(CompareFunction func = CMPF_ALWAYS_PASS, UINT32 mask = 0xFFFFFFFF, bool front = true);
-
-		/**
-		 * @brief	The bitmask applied to the stencil value before writing it to the stencil buffer.
-		 */
-		void setStencilBufferWriteMask(UINT32 mask = 0xFFFFFFFF);
-
-		/**
-		 * @brief	Sets a reference values used for stencil buffer comparisons. 
-		 * 			Actual comparison function and stencil operations are set by setting the DepthStencilState.
-		 */
-		void setStencilRefValue(UINT32 refValue);
-
-		/************************************************************************/
-		/* 							UTILITY METHODS                      		*/
-		/************************************************************************/
-
-		/**
-		 * @brief	Recalculates actual viewport dimensions based on currently 
-		 *			set viewport normalized dimensions and render target and applies
-		 *			them for further rendering.
-		 */
-		void applyViewport();
-
-		/**
-		 * @brief	Converts the provided matrix m into a representation usable by OpenGL.
-		 */
-		void makeGLMatrix(GLfloat gl_matrix[16], const Matrix4& m);
-
-		/**
-		 * @brief	Converts the engine depth/stencil compare function into OpenGL representation.
-		 */
-		GLint convertCompareFunction(CompareFunction func) const;
-
-		/**
-		 * @brief	Convers the engine stencil operation in OpenGL representation. Optionally inverts
-		 *			the operation (increment becomes decrement, etc.).
-		 */
-		GLint convertStencilOp(StencilOperation op, bool invert = false) const;
-
-		/**
-		 * @brief	Checks if there are any OpenGL errors and prints them to the log.
-		 */
-		bool checkForErrors() const;
-
-	private:
-		Rect2 mViewportNorm;
-		UINT32 mScissorTop, mScissorBottom, mScissorLeft, mScissorRight;
-		UINT32 mViewportLeft, mViewportTop, mViewportWidth, mViewportHeight;
-
-		UINT32 mStencilReadMask;
-		UINT32 mStencilWriteMask;
-		UINT32 mStencilRefValue;
-		CompareFunction mStencilCompareFront;
-		CompareFunction mStencilCompareBack;
-
-		// View matrix to set world against
-		Matrix4 mViewMatrix;
-
-		// Last min & mip filtering options, so we can combine them
-		FilterOptions mMinFilter;
-		FilterOptions mMipFilter;
-
-		// Holds texture type settings for every stage
-		UINT32	mNumTextureTypes;
-		GLenum* mTextureTypes;
-
-		bool mDepthWrite;
-		bool mColorWrite[4];
-
-		GLSupport* mGLSupport;
-		bool mGLInitialised;
-
-		GLSLProgramFactory* mGLSLProgramFactory;
-		GLSLProgramPipelineManager* mProgramPipelineManager;
-
-		SPtr<GLSLGpuProgramCore> mCurrentVertexProgram;
-		SPtr<GLSLGpuProgramCore> mCurrentFragmentProgram;
-		SPtr<GLSLGpuProgramCore> mCurrentGeometryProgram;
-		SPtr<GLSLGpuProgramCore> mCurrentHullProgram;
-		SPtr<GLSLGpuProgramCore> mCurrentDomainProgram;
-		SPtr<GLSLGpuProgramCore> mCurrentComputeProgram;
-
-		const GLSLProgramPipeline* mActivePipeline;
-
-		UINT32 mFragmentTexOffset;
-		UINT32 mVertexTexOffset;
-		UINT32 mGeometryTexOffset;
-
-		UINT32 mFragmentUBOffset;
-		UINT32 mVertexUBOffset;
-		UINT32 mGeometryUBOffset;
-		UINT32 mHullUBOffset;
-		UINT32 mDomainUBOffset;
-		UINT32 mComputeUBOffset;
-
-		Vector<SPtr<VertexBufferCore>> mBoundVertexBuffers;
-		SPtr<VertexDeclarationCore> mBoundVertexDeclaration;
-		SPtr<IndexBufferCore> mBoundIndexBuffer;
-		DrawOperationType mCurrentDrawOperation;
-
-		SPtr<GLContext> mMainContext;
-		SPtr<GLContext> mCurrentContext;
-
-		bool mDrawCallInProgress;
-
-		UINT16 mActiveTextureUnit;
-    };
-}
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsGLPrerequisites.h"
+#include "BsRenderAPI.h"
+#include "BsGLHardwareBufferManager.h"
+#include "BsGLSLProgramFactory.h"
+#include "BsMatrix4.h"
+
+namespace BansheeEngine 
+{
+	/**
+	 * @brief	Implementation of a render system using OpenGL. Provides abstracted
+	 *			access to various low level OpenGL methods.
+	 */
+    class BS_RSGL_EXPORT GLRenderAPI : public RenderAPICore
+    {
+    public:
+        GLRenderAPI();
+        ~GLRenderAPI();
+
+		/**
+		 * @copydoc RenderAPICore::getName()
+		 */
+		const StringID& getName() const override;
+
+		/**
+		 * @copydoc RenderAPICore::getShadingLanguageName()
+		 */
+		const String& getShadingLanguageName() const override;
+
+		/**
+		 * @copydoc RenderAPICore::setRenderTarget()
+		 */
+		void setRenderTarget(const SPtr<RenderTargetCore>& target, bool readOnlyDepthStencil = false) override;
+
+        /**
+		 * @copydoc RenderAPICore::setVertexBuffers()
+		 */
+		void setVertexBuffers(UINT32 index, SPtr<VertexBufferCore>* buffers, UINT32 numBuffers) override;
+
+		/**
+		 * @copydoc RenderAPICore::setIndexBuffer()
+		 */
+		void setIndexBuffer(const SPtr<IndexBufferCore>& buffer) override;
+
+		/**
+		 * @copydoc RenderAPICore::setVertexDeclaration()
+		 */
+		void setVertexDeclaration(const SPtr<VertexDeclarationCore>& vertexDeclaration) override;
+
+		/**
+		 * @copydoc RenderAPICore::setDrawOperation()
+		 */
+		void setDrawOperation(DrawOperationType op) override;
+
+        /**
+		 * @copydoc RenderAPICore::setScissorRect()
+		 */
+		void setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom) override;
+
+		/**
+		 * @copydoc RenderAPICore::setTexture()
+		 */
+		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& tex) override;
+
+		/**
+		 * @copydoc	RenderAPICore::setLoadStoreTexture
+		 */
+		void setLoadStoreTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const SPtr<TextureCore>& texPtr,
+			const TextureSurface& surface) override;
+        
+		/**
+		 * @copydoc RenderAPICore::setSamplerState()
+		 */
+		void setSamplerState(GpuProgramType gptype, UINT16 unit, const SPtr<SamplerStateCore>& state) override;
+
+		/**
+		 * @copydoc RenderAPICore::setBlendState()
+		 */
+		void setBlendState(const SPtr<BlendStateCore>& blendState) override;
+
+		/**
+		 * @copydoc RenderAPICore::setRasterizerState()
+		 */
+		void setRasterizerState(const SPtr<RasterizerStateCore>& rasterizerState) override;
+
+		/**
+		 * @copydoc RenderAPICore::setDepthStencilState()
+		 */
+		void setDepthStencilState(const SPtr<DepthStencilStateCore>& depthStencilState, UINT32 stencilRefValue) override;
+
+		/**
+		 * @copydoc RenderAPICore::setViewport()
+		 */
+		void setViewport(const Rect2& area) override;
+
+		/**
+		 * @copydoc RenderAPICore::bindGpuProgram()
+		 */
+		void bindGpuProgram(const SPtr<GpuProgramCore>& prg) override;
+
+		/**
+		 * @copydoc RenderAPICore::unbindGpuProgram()
+		 */
+		void unbindGpuProgram(GpuProgramType gptype) override;
+
+		/**
+		 * @copydoc RenderAPICore::setConstantBuffers()
+		 */
+		void setConstantBuffers(GpuProgramType gptype, const SPtr<GpuParamsCore>& params) override;
+
+		/**
+		 * @copydoc RenderAPICore::beginFrame()
+		 */
+		void beginFrame() override;
+
+		/**
+		 * @copydoc RenderAPICore::endFrame()
+		 */
+		void endFrame() override;
+
+		/**
+		 * @copydoc RenderAPICore::draw()
+		 */
+		void draw(UINT32 vertexOffset, UINT32 vertexCount) override;
+
+		/**
+		 * @copydoc RenderAPICore::drawIndexed()
+		 */
+		void drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount) override;
+
+		/**
+		 * @copydoc RenderAPICore::dispatchCompute()
+		 */
+		void dispatchCompute(UINT32 numGroupsX, UINT32 numGroupsY = 1, UINT32 numGroupsZ = 1) override;
+
+		/**
+		 * @copydoc RenderAPICore::clearRenderTarget()
+		 */
+		void clearRenderTarget(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
+			UINT8 targetMask = 0xFF) override;
+
+		/**
+		 * @copydoc RenderAPICore::clearViewport()
+		 */
+		void clearViewport(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
+			UINT8 targetMask = 0xFF) override;
+
+        /**
+		 * @copydoc RenderAPICore::getColorVertexElementType()
+		 */
+		VertexElementType getColorVertexElementType() const override;
+
+		/**
+		 * @copydoc RenderAPICore::getHorizontalTexelOffset()
+		 */
+		float getHorizontalTexelOffset() override;
+
+		/**
+		 * @copydoc RenderAPICore::getVerticalTexelOffset()
+		 */
+		float getVerticalTexelOffset() override;
+
+		/**
+		 * @copydoc RenderAPICore::getMinimumDepthInputValue()
+		 */
+		float getMinimumDepthInputValue() override;
+
+		 /**
+		 * @copydoc RenderAPICore::getMaximumDepthInputValue()
+		 */
+		float getMaximumDepthInputValue() override;
+
+		/**
+		 * @copydoc RenderAPICore::convertProjectionMatrix()
+		 */
+		void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest) override;
+
+		/**
+		 * @copydoc RenderAPICore::getGpuProgramHasColumnMajorMatrices
+		 */
+		bool getGpuProgramHasColumnMajorMatrices() const override;
+
+		/**
+		 * @copydoc RenderAPICore::generateParamBlockDesc()
+		 */
+		GpuParamBlockDesc generateParamBlockDesc(const String& name, Vector<GpuParamDataDesc>& params) override;
+
+		/************************************************************************/
+		/* 				Internal use by OpenGL RenderSystem only                */
+		/************************************************************************/
+
+		/**
+		 * @brief	Query has the main context been initialized.
+		 */
+		bool _isContextInitialized() const { return mGLInitialised; }
+
+		/**
+		 * @brief	Returns main context. Caller must ensure the context has been initialized.
+		 */
+		SPtr<GLContext> getMainContext() const { return mMainContext; } 
+
+		/**
+		 * @brief	Returns a support object you may use for creating
+		 */
+		GLSupport* getGLSupport() const { return mGLSupport; }
+
+	protected:
+		/**
+		 * @copydoc	RenderAPICore::initializePrepare
+		 */
+		void initializePrepare() override;
+
+		/**
+		 * @copydoc	RenderAPICore::initializeFinalize
+		 */
+		void initializeFinalize(const SPtr<RenderWindowCore>& primaryWindow) override;
+
+		/**
+		 * @copydoc	RenderAPICore::destroy_internal().
+		 */
+		void destroyCore() override;
+
+		/**
+		* @brief	Call before doing a draw operation, this method sets everything up.
+		*/
+		void beginDraw();
+
+		/**
+		* @brief	Needs to accompany every beginDraw after you are done with a single draw operation.
+		*/
+		void endDraw();
+
+		/**
+		 * @brief	Clear a part of a render target.
+		 */
+		void clearArea(UINT32 buffers, const Color& color = Color::Black, float depth = 1.0f, UINT16 stencil = 0, 
+			const Rect2I& clearArea = Rect2I::EMPTY, UINT8 targetMask = 0xFF);
+
+		/**
+		 * @brief	Set up clip planes against which all geometry will get clipped.
+		 */
+		void setClipPlanesImpl(const PlaneList& clipPlanes) override;
+
+		/**
+		 * @brief	Set up a clip plane at a specific clip plane index. If enabled,
+		 *			geometry will be clipped against the positive side of the plane.
+		 *
+		 * @note	Valid index range is [0, 5].
+		 */
+        void setClipPlane(UINT16 index, float A, float B, float C, float D);
+
+		/**
+		 * @brief	Enable or disable clipping against a clip plane at the specified index.
+		 *
+		 * @note	Valid index range is [0, 5].
+		 */
+        void enableClipPlane (UINT16 index, bool enable);
+
+		/**
+		* @brief	Changes the currently active texture unit. Any texture related operations
+		*			will then be performed on this unit.
+		*/
+		bool activateGLTextureUnit(UINT16 unit);
+
+		/**
+		 * @brief	Changes the active GPU program.
+		 */
+		void setActiveProgram(GpuProgramType gptype, const SPtr<GLSLGpuProgramCore>& program);
+
+		/**
+		 * @brief	Retrieves the active GPU program of the specified type.
+		 */
+		SPtr<GLSLGpuProgramCore> getActiveProgram(GpuProgramType gptype) const;
+
+		/**
+		 * @brief	Converts Banshee blend mode to OpenGL blend mode.
+		 */
+		GLint getBlendMode(BlendFactor blendMode) const;
+
+		/**
+		* @brief	Converts Banshee texture addressing mode to OpenGL texture addressing mode.
+		*/
+		GLint getTextureAddressingMode(TextureAddressingMode tam) const;
+
+		/**
+		 * @brief	Gets a combined min/mip filter value usable by OpenGL from the currently
+		 *			set min and mip filters.
+		 */
+		GLuint getCombinedMinMipFilter() const;
+
+		/**
+		* @brief	OpenGL shares all texture slots, but the engine prefers to keep textures
+		* 			separate per-stage. This will convert texture unit that is set per stage
+		* 			into a global texture unit usable by OpenGL.
+		*/
+		UINT32 getGLTextureUnit(GpuProgramType gptype, UINT32 unit);
+
+		/**
+		* @brief	OpenGL shares all buffer bindings, but the engine prefers to keep buffers
+		* 			separate per-stage. This will convert block buffer binding that is set per stage
+		* 			into a global block buffer binding usable by OpenGL.
+		*/
+		UINT32 getGLUniformBlockBinding(GpuProgramType gptype, UINT32 binding);
+
+		/**
+		* @brief	Returns the OpenGL specific mode used for drawing, depending on the
+		* 			currently set draw operation;
+		*/
+		GLint getGLDrawMode() const;
+
+		/**
+		 * @brief	Creates render system capabilities that specify which features are
+		 *			or aren't supported.
+		 */
+		RenderAPICapabilities* createRenderSystemCapabilities() const;
+
+		/**
+		 * @brief	Finish initialization by setting up any systems dependant on render system
+		 *			capabilities.
+		 */
+		void initFromCaps(RenderAPICapabilities* caps);
+
+		/**
+		 * @brief	Switch the currently used OpenGL context. You will need to re-bind
+		 *			any previously bound values manually. (e.g. textures, gpu programs and such)
+		 */
+		void switchContext(const SPtr<GLContext>& context);
+
+		/************************************************************************/
+		/* 								Sampler states                     		*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Sets the texture addressing mode for a texture unit. This determines
+		 *			how are UV address values outside of [0, 1] range handled when sampling
+		 *			from texture.
+		 */
+        void setTextureAddressingMode(UINT16 stage, const UVWAddressingMode& uvw);
+
+		/**
+		 * @brief	Sets the texture border color for a texture unit. Border color
+		 *			determines color returned by the texture sampler when border addressing mode
+		 *			is used and texture address is outside of [0, 1] range.
+		 */
+        void setTextureBorderColor(UINT16 stage, const Color& color);
+
+		/**
+		 * @brief	Sets the mipmap bias value for a given texture unit. Bias allows
+		 *			you to adjust the mipmap selection calculation. Negative values force a
+		 *			larger mipmap to be used, and positive values smaller. Units are in values
+		 *			of mip levels, so -1 means use a mipmap one level higher than default.
+		 */
+		void setTextureMipmapBias(UINT16 unit, float bias);
+
+		/**
+		 * @brief	Allows you to specify how is the texture bound to the specified texture unit filtered.
+		 *			Different filter types are used for different situations like magnifying or minifying a texture.
+		 */
+        void setTextureFiltering(UINT16 unit, FilterType ftype, FilterOptions filter);
+
+		/**
+		 * @brief	Sets anisotropy value for the specified texture unit.
+		 */
+		void setTextureAnisotropy(UINT16 unit, UINT32 maxAnisotropy);
+
+		/**
+		 * @brief	Gets anisotropy value for the specified texture unit.
+		 */
+		GLfloat getCurrentAnisotropy(UINT16 unit);
+
+		/************************************************************************/
+		/* 								Blend states                      		*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
+		 *			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor).
+		 */
+		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op);
+
+		/**
+		* @brief	Sets up blending mode that allows you to combine new pixels with pixels already in the render target.
+		*			Allows you to set up separate blend operations for alpha values.
+		*	
+		*			Final pixel value = (renderTargetPixel * sourceFactor) op (pixel * destFactor). (And the same for alpha)
+		*/
+		void setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
+			BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp);
+
+		/**
+		 * @brief	Sets alpha test that allows you to reject pixels that fail the comparison function
+		 *			versus the provided reference value.
+		 */
+		void setAlphaTest(CompareFunction func, unsigned char value);
+
+		/**
+		 * @brief	Enable alpha to coverage. Alpha to coverage allows you to perform blending without needing 
+		 *			to worry about order of rendering like regular blending does. It requires multi-sampling to 
+		 *			be active in order to work, and you need to supply an alpha texture that determines object transparency.
+		 */
+		void setAlphaToCoverage(bool enabled);
+
+		/**
+		 * @brief	Enables or disables writing to certain color channels of the render target.
+		 */
+		void setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha);
+
+		/************************************************************************/
+		/* 								Rasterizer states                  		*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Sets vertex winding order. Normally you would use this to cull back facing
+		 *			polygons.
+		 */
+		void setCullingMode(CullingMode mode);
+
+		/**
+		 * @brief	Sets the polygon rasterization mode. Determines how are polygons interpreted.
+		 */
+		void setPolygonMode(PolygonMode level);
+
+		/**
+		 * @brief	Sets a depth bias that will offset the depth values of new pixels by the specified amount.
+		 *			Final depth bias value is a combination of the constant depth bias and slope depth bias.
+		 *			Slope depth bias has more effect the higher the slope of the rendered polygon.
+		 *
+		 * @note	This is useful if you want to avoid z fighting for objects at the same or similar depth.
+		 */
+		void setDepthBias(float constantBias, float slopeScaleBias);
+
+		/**
+		 * @brief	Scissor test allows you to mask off rendering in all but a given rectangular area
+		 * 			identified by the rectangle set by setScissorRect().
+		 */
+		void setScissorTestEnable(bool enable);
+
+		/**
+		 * @brief	Enables or disables multisample antialiasing.
+		 */
+		void setMultisamplingEnable(bool enable);
+
+		/**
+		 * @brief	Enables or disables depth clipping (i.e. near/fear plane clipping).
+		 */
+		void setDepthClipEnable(bool enable);
+
+		/**
+		 * @brief	Enables or disables antialiased line rendering.
+		 */
+		void setAntialiasedLineEnable(bool enable);
+
+		/************************************************************************/
+		/* 						Depth stencil state                      		*/
+		/************************************************************************/
+		
+		/**
+		 * @brief	Should new pixels perform depth testing using the set depth comparison function before
+		 *			being written.
+		 */
+		void setDepthBufferCheckEnabled(bool enabled = true);
+
+		/**
+		 * @brief	Should new pixels write to the depth buffer.
+		 */
+		void setDepthBufferWriteEnabled(bool enabled = true);
+
+		/**
+		 * @brief	Sets comparison function used for depth testing. Determines how are new and existing
+		 *			pixel values compared - if comparison function returns true the new pixel is written.
+		 */
+		void setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL);
+
+		/**
+		 * @brief	Turns stencil tests on or off. By default this is disabled.
+		 *			Stencil testing allow you to mask out a part of the rendered image by using
+		 *			various stencil operations provided.
+		 */
+		void setStencilCheckEnabled(bool enabled);
+
+		/**
+		 * @brief	Allows you to set stencil operations that are performed when stencil test passes or fails.
+		 *
+		 * @param	stencilFailOp	Operation executed when stencil test fails.
+		 * @param	depthFailOp		Operation executed when stencil test succeeds but depth test fails.
+		 * @param	passOp			Operation executed when stencil test succeeds and depth test succeeds.
+		 * @param	front			Should the stencil operations be applied to front or back facing polygons.
+		 */
+		void setStencilBufferOperations(StencilOperation stencilFailOp = SOP_KEEP,
+			StencilOperation depthFailOp = SOP_KEEP, StencilOperation passOp = SOP_KEEP,
+			bool front = true);
+
+		/**
+		 * @brief	Sets a stencil buffer comparison function. The result of this will cause one of 3 actions 
+		 *			depending on whether the test fails, succeeds but with the depth buffer check still failing, 
+		 *			or succeeds with the depth buffer check passing too.
+		 *
+		 * @param func	Comparison function that determines whether a stencil test fails or passes. Reference value
+		 *				gets compared to the value already in the buffer using this function.
+		 * @param mask	The bitmask applied to both the stencil value and the reference value
+		 *				before comparison
+		 * @param ccw	If set to true, the stencil operations will be applied to counterclockwise
+		 *				faces. Otherwise they will be applied to clockwise faces.
+		 */
+		void setStencilBufferFunc(CompareFunction func = CMPF_ALWAYS_PASS, UINT32 mask = 0xFFFFFFFF, bool front = true);
+
+		/**
+		 * @brief	The bitmask applied to the stencil value before writing it to the stencil buffer.
+		 */
+		void setStencilBufferWriteMask(UINT32 mask = 0xFFFFFFFF);
+
+		/**
+		 * @brief	Sets a reference values used for stencil buffer comparisons. 
+		 * 			Actual comparison function and stencil operations are set by setting the DepthStencilState.
+		 */
+		void setStencilRefValue(UINT32 refValue);
+
+		/************************************************************************/
+		/* 							UTILITY METHODS                      		*/
+		/************************************************************************/
+
+		/**
+		 * @brief	Recalculates actual viewport dimensions based on currently 
+		 *			set viewport normalized dimensions and render target and applies
+		 *			them for further rendering.
+		 */
+		void applyViewport();
+
+		/**
+		 * @brief	Converts the provided matrix m into a representation usable by OpenGL.
+		 */
+		void makeGLMatrix(GLfloat gl_matrix[16], const Matrix4& m);
+
+		/**
+		 * @brief	Converts the engine depth/stencil compare function into OpenGL representation.
+		 */
+		GLint convertCompareFunction(CompareFunction func) const;
+
+		/**
+		 * @brief	Convers the engine stencil operation in OpenGL representation. Optionally inverts
+		 *			the operation (increment becomes decrement, etc.).
+		 */
+		GLint convertStencilOp(StencilOperation op, bool invert = false) const;
+
+		/**
+		 * @brief	Checks if there are any OpenGL errors and prints them to the log.
+		 */
+		bool checkForErrors() const;
+
+	private:
+		Rect2 mViewportNorm;
+		UINT32 mScissorTop, mScissorBottom, mScissorLeft, mScissorRight;
+		UINT32 mViewportLeft, mViewportTop, mViewportWidth, mViewportHeight;
+
+		UINT32 mStencilReadMask;
+		UINT32 mStencilWriteMask;
+		UINT32 mStencilRefValue;
+		CompareFunction mStencilCompareFront;
+		CompareFunction mStencilCompareBack;
+
+		// View matrix to set world against
+		Matrix4 mViewMatrix;
+
+		// Last min & mip filtering options, so we can combine them
+		FilterOptions mMinFilter;
+		FilterOptions mMipFilter;
+
+		// Holds texture type settings for every stage
+		UINT32	mNumTextureTypes;
+		GLenum* mTextureTypes;
+
+		bool mDepthWrite;
+		bool mColorWrite[4];
+
+		GLSupport* mGLSupport;
+		bool mGLInitialised;
+
+		GLSLProgramFactory* mGLSLProgramFactory;
+		GLSLProgramPipelineManager* mProgramPipelineManager;
+
+		SPtr<GLSLGpuProgramCore> mCurrentVertexProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentFragmentProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentGeometryProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentHullProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentDomainProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentComputeProgram;
+
+		const GLSLProgramPipeline* mActivePipeline;
+
+		UINT32 mFragmentTexOffset;
+		UINT32 mVertexTexOffset;
+		UINT32 mGeometryTexOffset;
+
+		UINT32 mFragmentUBOffset;
+		UINT32 mVertexUBOffset;
+		UINT32 mGeometryUBOffset;
+		UINT32 mHullUBOffset;
+		UINT32 mDomainUBOffset;
+		UINT32 mComputeUBOffset;
+
+		Vector<SPtr<VertexBufferCore>> mBoundVertexBuffers;
+		SPtr<VertexDeclarationCore> mBoundVertexDeclaration;
+		SPtr<IndexBufferCore> mBoundIndexBuffer;
+		DrawOperationType mCurrentDrawOperation;
+
+		SPtr<GLContext> mMainContext;
+		SPtr<GLContext> mCurrentContext;
+
+		bool mDrawCallInProgress;
+
+		UINT16 mActiveTextureUnit;
+    };
+}

+ 38 - 38
Source/BansheeMono/Include/BsMonoPrerequisites.h

@@ -1,39 +1,39 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
-#	ifdef BS_MONO_EXPORTS
-#		define BS_MONO_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_MONO_EXPORT
-#       else
-#    		define BS_MONO_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#elif defined ( BS_GCC_VISIBILITY )
-#    define BS_MONO_EXPORT  __attribute__ ((visibility("default")))
-#else
-#    define BS_MONO_EXPORT
-#endif
-
-/** @addtogroup Plugins/
-
-/** @defgroup Mono Mono
- *	Scripting language backend using Mono's CLR.
- */
-
-/** @} */
-
-namespace BansheeEngine
-{
-	class MonoManager;
-	class MonoAssembly;
-	class MonoClass;
-	class MonoMethod;
-	class MonoField;
-	class MonoProperty;
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
+#	ifdef BS_MONO_EXPORTS
+#		define BS_MONO_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_MONO_EXPORT
+#       else
+#    		define BS_MONO_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#elif defined ( BS_GCC_VISIBILITY )
+#    define BS_MONO_EXPORT  __attribute__ ((visibility("default")))
+#else
+#    define BS_MONO_EXPORT
+#endif
+
+/** @addtogroup Plugins/
+
+/** @defgroup Mono BansheeMono
+ *	Scripting language backend using Mono's CLR.
+ */
+
+/** @} */
+
+namespace BansheeEngine
+{
+	class MonoManager;
+	class MonoAssembly;
+	class MonoClass;
+	class MonoMethod;
+	class MonoField;
+	class MonoProperty;
 }
 }

+ 28 - 28
Source/BansheeOISInput/Include/BsOISPrerequisites.h

@@ -1,29 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
-#	ifdef BS_OIS_EXPORTS
-#		define BS_OIS_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_OIS_EXPORT
-#       else
-#    		define BS_OIS_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#elif defined ( BS_GCC_VISIBILITY )
-#    define BS_OIS_EXPORT  __attribute__ ((visibility("default")))
-#else
-#    define BS_OIS_EXPORT
-#endif
-
-/** @addtogroup Plugins/
-
-/** @defgroup OISInput OISInput
- *	OIS implementation for raw keyboard/mouse/gamepad input.
- */
-
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
+#	ifdef BS_OIS_EXPORTS
+#		define BS_OIS_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_OIS_EXPORT
+#       else
+#    		define BS_OIS_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#elif defined ( BS_GCC_VISIBILITY )
+#    define BS_OIS_EXPORT  __attribute__ ((visibility("default")))
+#else
+#    define BS_OIS_EXPORT
+#endif
+
+/** @addtogroup Plugins/
+
+/** @defgroup OISInput BansheeOISInput
+ *	OIS implementation for raw keyboard/mouse/gamepad input.
+ */
+
 /** @} */
 /** @} */

+ 110 - 110
Source/BansheePhysX/Include/BsPhysXPrerequisites.h

@@ -1,111 +1,111 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "foundation\PxVec3.h"
-#include "foundation\PxVec4.h"
-#include "foundation\PxQuat.h"
-#include "foundation\PxTransform.h"
-
-namespace BansheeEngine
-{
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
-#	ifdef BS_PHYSX_EXPORTS
-#		define BS_PHYSX_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_PHYSX_EXPORT
-#       else
-#    		define BS_PHYSX_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#else
-#	define BS_PHYSX_EXPORT
-#endif
-
-/** @addtogroup Plugins/
-
-/** @defgroup PhysX PhysX
- *	NVIDIA PhysX implementation of Banshee's physics.
- */
-
-/** @defgroup RTTI-Impl-PhysX RTTI types
- *  Types containing RTTI for specific classes.
- */
-
-/** @} */
-
-	class PhysXRigidbody;
-	class PhsyXMaterial;
-	class FPhysXCollider;
-
-	/** @cond INTERNAL */
-	/** @addtogroup PhysX
-	 *  @{
-	 */
-
-	/**	Type IDs used by the RTTI system for the PhysX library. */
-	enum TypeID_BansheeEditor
-	{
-		TID_PhysXMesh = 100000,
-	};
-
-	/** Converts a Banshee vector to a PhysX vector. */
-	inline const physx::PxVec3& toPxVector(const Vector3& input)
-	{
-		return *(physx::PxVec3*)&input;
-	}
-
-	/** Converts a Banshee vector to a PhysX vector. */
-	inline const physx::PxVec4& toPxVector(const Vector4& input)
-	{
-		return *(physx::PxVec4*)&input;
-	}
-
-	/** Converts a Banshee quaternion to a PhysX quaternion. */
-	inline const physx::PxQuat& toPxQuaternion(const Quaternion& input)
-	{
-		return *(physx::PxQuat*)&input;
-	}
-
-	/** Converts a Banshee position/rotation pair to a PhysX transform. */
-	inline physx::PxTransform toPxTransform(const Vector3& pos, const Quaternion& rot)
-	{
-		return physx::PxTransform(toPxVector(pos), toPxQuaternion(rot));
-	}
-
-	/** Converts a PhysX vector to a Banshee vector. */
-	inline const Vector3& fromPxVector(const physx::PxVec3& input)
-	{
-		return *(Vector3*)&input;
-	}
-
-	/** Converts a PhysX vector to a Banshee vector. */
-	inline const Vector4& fromPxVector(const physx::PxVec4& input)
-	{
-		return *(Vector4*)&input;
-	}
-
-	/** Converts a PhysX quaternion to a Banshee quaternion. */
-	inline const Quaternion& fromPxQuaternion(const physx::PxQuat& input)
-	{
-		return *(Quaternion*)&input;
-	}
-
-	/** Flags used on PhysX shape filters. */
-	enum class PhysXObjectFilterFlag
-	{
-		NoReport = 1 << 0, /**< Don't report collision events. */
-		ReportBasic = 1 << 1, /**< Report start/begin collision events. */
-		ReportAll = 1 << 2, /**< Report start/begin, as well as persistant collision events. */
-		CCD = 1 << 3 /**< Use continous collision detection for this shape. */
-	};
-
-	/** @copydoc ObjectFilterFlag */
-	typedef Flags<PhysXObjectFilterFlag> PhysXObjectFilterFlags;
-	BS_FLAGS_OPERATORS(PhysXObjectFilterFlag)
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "foundation\PxVec3.h"
+#include "foundation\PxVec4.h"
+#include "foundation\PxQuat.h"
+#include "foundation\PxTransform.h"
+
+namespace BansheeEngine
+{
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
+#	ifdef BS_PHYSX_EXPORTS
+#		define BS_PHYSX_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_PHYSX_EXPORT
+#       else
+#    		define BS_PHYSX_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#else
+#	define BS_PHYSX_EXPORT
+#endif
+
+/** @addtogroup Plugins/
+
+/** @defgroup PhysX BansheePhysX
+ *	NVIDIA PhysX implementation of Banshee's physics.
+ */
+
+/** @defgroup RTTI-Impl-PhysX RTTI types
+ *  Types containing RTTI for specific classes.
+ */
+
+/** @} */
+
+	class PhysXRigidbody;
+	class PhsyXMaterial;
+	class FPhysXCollider;
+
+	/** @cond INTERNAL */
+	/** @addtogroup PhysX
+	 *  @{
+	 */
+
+	/**	Type IDs used by the RTTI system for the PhysX library. */
+	enum TypeID_BansheeEditor
+	{
+		TID_PhysXMesh = 100000,
+	};
+
+	/** Converts a Banshee vector to a PhysX vector. */
+	inline const physx::PxVec3& toPxVector(const Vector3& input)
+	{
+		return *(physx::PxVec3*)&input;
+	}
+
+	/** Converts a Banshee vector to a PhysX vector. */
+	inline const physx::PxVec4& toPxVector(const Vector4& input)
+	{
+		return *(physx::PxVec4*)&input;
+	}
+
+	/** Converts a Banshee quaternion to a PhysX quaternion. */
+	inline const physx::PxQuat& toPxQuaternion(const Quaternion& input)
+	{
+		return *(physx::PxQuat*)&input;
+	}
+
+	/** Converts a Banshee position/rotation pair to a PhysX transform. */
+	inline physx::PxTransform toPxTransform(const Vector3& pos, const Quaternion& rot)
+	{
+		return physx::PxTransform(toPxVector(pos), toPxQuaternion(rot));
+	}
+
+	/** Converts a PhysX vector to a Banshee vector. */
+	inline const Vector3& fromPxVector(const physx::PxVec3& input)
+	{
+		return *(Vector3*)&input;
+	}
+
+	/** Converts a PhysX vector to a Banshee vector. */
+	inline const Vector4& fromPxVector(const physx::PxVec4& input)
+	{
+		return *(Vector4*)&input;
+	}
+
+	/** Converts a PhysX quaternion to a Banshee quaternion. */
+	inline const Quaternion& fromPxQuaternion(const physx::PxQuat& input)
+	{
+		return *(Quaternion*)&input;
+	}
+
+	/** Flags used on PhysX shape filters. */
+	enum class PhysXObjectFilterFlag
+	{
+		NoReport = 1 << 0, /**< Don't report collision events. */
+		ReportBasic = 1 << 1, /**< Report start/begin collision events. */
+		ReportAll = 1 << 2, /**< Report start/begin, as well as persistant collision events. */
+		CCD = 1 << 3 /**< Use continous collision detection for this shape. */
+	};
+
+	/** @copydoc ObjectFilterFlag */
+	typedef Flags<PhysXObjectFilterFlag> PhysXObjectFilterFlags;
+	BS_FLAGS_OPERATORS(PhysXObjectFilterFlag)
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 210 - 209
Source/MBansheeEditor/MBansheeEditor.csproj

@@ -1,210 +1,211 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{ABC62E37-342E-4345-A374-E37CA06C036E}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>BansheeEditor</RootNamespace>
-    <AssemblyName>MBansheeEditor</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>..\..\bin\Assemblies\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <UseVSHostingProcess>false</UseVSHostingProcess>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>..\bin\Assemblies\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AboutBox.cs" />
-    <Compile Include="BrowseDialog.cs" />
-    <Compile Include="BuildManager.cs" />
-    <Compile Include="BuildWindow.cs" />
-    <Compile Include="CodeEditor.cs" />
-    <Compile Include="ColorPicker.cs" />
-    <Compile Include="EditorPersistentData.cs" />
-    <Compile Include="Inspectors\BoxColliderInspector.cs" />
-    <Compile Include="Inspectors\CapsuleColliderInspector.cs" />
-    <Compile Include="Inspectors\CharacterControllerInspector.cs" />
-    <Compile Include="Inspectors\ColliderInspector.cs" />
-    <Compile Include="Inspectors\D6JointInspector.cs" />
-    <Compile Include="Inspectors\DistanceJointInspector.cs" />
-    <Compile Include="Inspectors\FixedJointInspector.cs" />
-    <Compile Include="Inspectors\GUIWidgetInspector.cs" />
-    <Compile Include="Inspectors\HingeJointInspector.cs" />
-    <Compile Include="Inspectors\JointInspector.cs" />
-    <Compile Include="Inspectors\LimitInspectors.cs" />
-    <Compile Include="Inspectors\MeshColliderInspector.cs" />
-    <Compile Include="Inspectors\PhysicsMaterialInspector.cs" />
-    <Compile Include="Inspectors\PhysicsMeshInspector.cs" />
-    <Compile Include="Inspectors\PlaneColliderInspector.cs" />
-    <Compile Include="Inspectors\RigidbodyInspector.cs" />
-    <Compile Include="Inspectors\SliderJointInspector.cs" />
-    <Compile Include="Inspectors\SphereColliderInspector.cs" />
-    <Compile Include="Inspectors\SphericalJointInspector.cs" />
-    <Compile Include="LogWindow.cs" />
-    <Compile Include="DefaultSize.cs" />
-    <Compile Include="DialogBox.cs" />
-    <Compile Include="DragDrop.cs" />
-    <Compile Include="DropDownWindow.cs" />
-    <Compile Include="EditorInput.cs" />
-    <Compile Include="EditorVirtualInput.cs" />
-    <Compile Include="FolderMonitor.cs" />
-    <Compile Include="GameWindow.cs" />
-    <Compile Include="GUI\GUIDictionaryField.cs" />
-    <Compile Include="GUI\GUIListField.cs" />
-    <Compile Include="GUI\GUIEnumField.cs" />
-    <Compile Include="GUI\GUIListBoxField.cs" />
-    <Compile Include="GUI\GUISceneTreeView.cs" />
-    <Compile Include="GUI\GUISliderField.cs" />
-    <Compile Include="GUI\GUITextureField.cs" />
-    <Compile Include="HierarchyWindow.cs" />
-    <Compile Include="Inspectors\CameraInspector.cs" />
-    <Compile Include="Inspectors\FontInspector.cs" />
-    <Compile Include="Inspectors\GUISkinInspector.cs" />
-    <Compile Include="Inspectors\LightInspector.cs" />
-    <Compile Include="Inspectors\MaterialInspector.cs" />
-    <Compile Include="Inspectors\MeshInspector.cs" />
-    <Compile Include="Inspectors\PlainTextInspector.cs" />
-    <Compile Include="Inspectors\PrefabInspector.cs" />
-    <Compile Include="Inspectors\RenderableInspector.cs" />
-    <Compile Include="Inspectors\ScriptCodeInspector.cs" />
-    <Compile Include="Inspectors\ShaderInspector.cs" />
-    <Compile Include="Inspectors\SpriteTextureInspector.cs" />
-    <Compile Include="Inspectors\StringTableInspector.cs" />
-    <Compile Include="Inspectors\Texture2DInspector.cs" />
-    <Compile Include="Inspector\InspectableDictionary.cs" />
-    <Compile Include="Inspector\InspectorPersistentData.cs" />
-    <Compile Include="Inspector\InspectorUtility.cs" />
-    <Compile Include="Library\LibraryGUIContent.cs" />
-    <Compile Include="Library\LibraryDropDown.cs" />
-    <Compile Include="Library\LibraryGUIEntry.cs" />
-    <Compile Include="Library\LibraryMenu.cs" />
-    <Compile Include="Library\LibraryUtility.cs" />
-    <Compile Include="LocEdString.cs" />
-    <Compile Include="MenuItems.cs" />
-    <Compile Include="PrefabUtility.cs" />
-    <Compile Include="Library\LibraryDropTarget.cs" />
-    <Compile Include="OSDropTarget.cs" />
-    <Compile Include="EditorApplication.cs" />
-    <Compile Include="EditorBuiltin.cs" />
-    <Compile Include="EditorSettings.cs" />
-    <Compile Include="EditorStyles.cs" />
-    <Compile Include="EditorUtility.cs" />
-    <Compile Include="EditorWindow.cs" />
-    <Compile Include="GUI\GUIGameObjectField.cs" />
-    <Compile Include="GUI\GUIResourceField.cs" />
-    <Compile Include="GUI\GUIVector3Field.cs" />
-    <Compile Include="GUI\GUIColorField.cs" />
-    <Compile Include="GUI\GUIFloatField.cs" />
-    <Compile Include="GUI\GUIIntField.cs" />
-    <Compile Include="GUI\GUITextField.cs" />
-    <Compile Include="GUI\GUIToggleField.cs" />
-    <Compile Include="GUI\GUIVector2Field.cs" />
-    <Compile Include="GUI\GUIVector4Field.cs" />
-    <Compile Include="ImportOptions.cs" />
-    <Compile Include="Inspector\CustomInspector.cs" />
-    <Compile Include="Inspector\GenericInspector.cs" />
-    <Compile Include="Inspector\InspectableArray.cs" />
-    <Compile Include="Inspector\InspectableBool.cs" />
-    <Compile Include="Inspector\InspectableColor.cs" />
-    <Compile Include="Inspector\InspectableFieldLayout.cs" />
-    <Compile Include="Inspector\InspectableFloat.cs" />
-    <Compile Include="Inspector\InspectableGameObjectRef.cs" />
-    <Compile Include="Inspector\InspectableList.cs" />
-    <Compile Include="Inspector\InspectableObject.cs" />
-    <Compile Include="Inspector\InspectableField.cs" />
-    <Compile Include="Inspector\InspectableInt.cs" />
-    <Compile Include="Inspector\InspectableResourceRef.cs" />
-    <Compile Include="Inspector\InspectableString.cs" />
-    <Compile Include="Inspector\InspectableVector2.cs" />
-    <Compile Include="Inspector\InspectableVector3.cs" />
-    <Compile Include="Inspector\InspectableVector4.cs" />
-    <Compile Include="Inspector\Inspector.cs" />
-    <Compile Include="Inspector\InspectorWindow.cs" />
-    <Compile Include="MenuItem.cs" />
-    <Compile Include="ModalWindow.cs" />
-    <Compile Include="ProgressBar.cs" />
-    <Compile Include="ProjectSettings.cs" />
-    <Compile Include="Library\LibraryWindow.cs" />
-    <Compile Include="ProjectWindow.cs" />
-    <Compile Include="Scene\Gizmos\CharacterControllerGizmo.cs" />
-    <Compile Include="Scene\Gizmos\ColliderGizmos.cs" />
-    <Compile Include="Scene\Gizmos\LightGizmos.cs" />
-    <Compile Include="Scene\SceneAxesGUI.cs" />
-    <Compile Include="Scene\SceneAxesHandle.cs" />
-    <Compile Include="Scene\SceneCamera.cs" />
-    <Compile Include="Scene\SceneGizmos.cs" />
-    <Compile Include="Scene\SceneGrid.cs" />
-    <Compile Include="Scene\SceneHandles.cs" />
-    <Compile Include="Scene\SceneSelection.cs" />
-    <Compile Include="Scene\SceneWindow.cs" />
-    <Compile Include="Scene\DefaultHandle.cs" />
-    <Compile Include="Scene\DefaultHandleManager.cs" />
-    <Compile Include="Scene\Handles.cs" />
-    <Compile Include="Scene\MoveHandle.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="ProjectLibrary.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Scene\CustomHandle.cs" />
-    <Compile Include="Scene\DrawGizmo.cs" />
-    <Compile Include="Scene\Gizmos.cs" />
-    <Compile Include="Scene\HandleDrawing.cs" />
-    <Compile Include="Scene\HandleSlider.cs" />
-    <Compile Include="Scene\HandleSliderDisc.cs" />
-    <Compile Include="Scene\HandleSliderLine.cs" />
-    <Compile Include="Scene\HandleSliderPlane.cs" />
-    <Compile Include="Scene\Handle.cs" />
-    <Compile Include="Scene\RotateHandle.cs" />
-    <Compile Include="Scene\ScaleHandle.cs" />
-    <Compile Include="ScriptCodeManager.cs" />
-    <Compile Include="ScriptCompiler.cs" />
-    <Compile Include="Selection.cs" />
-    <Compile Include="SettingsWindow.cs" />
-    <Compile Include="ToolbarItem.cs" />
-    <Compile Include="UndoRedo.cs" />
-    <Compile Include="UnitTests.cs" />
-    <Compile Include="UnitTestTypes.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\MBansheeEngine\MBansheeEngine.csproj">
-      <Project>{876eb338-489e-4727-84da-8cbbf0da5b5e}</Project>
-      <Name>MBansheeEngine</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <PropertyGroup>
-    <PostBuildEvent>$(SolutionDir)..\..\Dependencies\tools\pdb2mdb.bat "$(TargetPath)" "$(ConfigurationName)"</PostBuildEvent>
-  </PropertyGroup>
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{ABC62E37-342E-4345-A374-E37CA06C036E}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>BansheeEditor</RootNamespace>
+    <AssemblyName>MBansheeEditor</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\Assemblies\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\bin\Assemblies\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AboutBox.cs" />
+    <Compile Include="BrowseDialog.cs" />
+    <Compile Include="BuildManager.cs" />
+    <Compile Include="BuildWindow.cs" />
+    <Compile Include="CodeEditor.cs" />
+    <Compile Include="ColorPicker.cs" />
+    <Compile Include="EditorPersistentData.cs" />
+    <Compile Include="Inspectors\BoxColliderInspector.cs" />
+    <Compile Include="Inspectors\CapsuleColliderInspector.cs" />
+    <Compile Include="Inspectors\CharacterControllerInspector.cs" />
+    <Compile Include="Inspectors\ColliderInspector.cs" />
+    <Compile Include="Inspectors\D6JointInspector.cs" />
+    <Compile Include="Inspectors\DistanceJointInspector.cs" />
+    <Compile Include="Inspectors\FixedJointInspector.cs" />
+    <Compile Include="Inspectors\GUIWidgetInspector.cs" />
+    <Compile Include="Inspectors\HingeJointInspector.cs" />
+    <Compile Include="Inspectors\JointInspector.cs" />
+    <Compile Include="Inspectors\LimitInspectors.cs" />
+    <Compile Include="Inspectors\MeshColliderInspector.cs" />
+    <Compile Include="Inspectors\PhysicsMaterialInspector.cs" />
+    <Compile Include="Inspectors\PhysicsMeshInspector.cs" />
+    <Compile Include="Inspectors\PlaneColliderInspector.cs" />
+    <Compile Include="Inspectors\RigidbodyInspector.cs" />
+    <Compile Include="Inspectors\SliderJointInspector.cs" />
+    <Compile Include="Inspectors\SphereColliderInspector.cs" />
+    <Compile Include="Inspectors\SphericalJointInspector.cs" />
+    <Compile Include="LogWindow.cs" />
+    <Compile Include="DefaultSize.cs" />
+    <Compile Include="DialogBox.cs" />
+    <Compile Include="DragDrop.cs" />
+    <Compile Include="DropDownWindow.cs" />
+    <Compile Include="EditorInput.cs" />
+    <Compile Include="EditorVirtualInput.cs" />
+    <Compile Include="FolderMonitor.cs" />
+    <Compile Include="GameWindow.cs" />
+    <Compile Include="GUI\GUIDictionaryField.cs" />
+    <Compile Include="GUI\GUIListField.cs" />
+    <Compile Include="GUI\GUIEnumField.cs" />
+    <Compile Include="GUI\GUIListBoxField.cs" />
+    <Compile Include="GUI\GUISceneTreeView.cs" />
+    <Compile Include="GUI\GUISliderField.cs" />
+    <Compile Include="GUI\GUITextureField.cs" />
+    <Compile Include="HierarchyWindow.cs" />
+    <Compile Include="Inspectors\CameraInspector.cs" />
+    <Compile Include="Inspectors\FontInspector.cs" />
+    <Compile Include="Inspectors\GUISkinInspector.cs" />
+    <Compile Include="Inspectors\LightInspector.cs" />
+    <Compile Include="Inspectors\MaterialInspector.cs" />
+    <Compile Include="Inspectors\MeshInspector.cs" />
+    <Compile Include="Inspectors\PlainTextInspector.cs" />
+    <Compile Include="Inspectors\PrefabInspector.cs" />
+    <Compile Include="Inspectors\RenderableInspector.cs" />
+    <Compile Include="Inspectors\ScriptCodeInspector.cs" />
+    <Compile Include="Inspectors\ShaderInspector.cs" />
+    <Compile Include="Inspectors\SpriteTextureInspector.cs" />
+    <Compile Include="Inspectors\StringTableInspector.cs" />
+    <Compile Include="Inspectors\Texture2DInspector.cs" />
+    <Compile Include="Inspector\InspectableDictionary.cs" />
+    <Compile Include="Inspector\InspectorPersistentData.cs" />
+    <Compile Include="Inspector\InspectorUtility.cs" />
+    <Compile Include="Library\LibraryGUIContent.cs" />
+    <Compile Include="Library\LibraryDropDown.cs" />
+    <Compile Include="Library\LibraryGUIEntry.cs" />
+    <Compile Include="Library\LibraryMenu.cs" />
+    <Compile Include="Library\LibraryUtility.cs" />
+    <Compile Include="LocEdString.cs" />
+    <Compile Include="MenuItems.cs" />
+    <Compile Include="PrefabUtility.cs" />
+    <Compile Include="Library\LibraryDropTarget.cs" />
+    <Compile Include="OSDropTarget.cs" />
+    <Compile Include="EditorApplication.cs" />
+    <Compile Include="EditorBuiltin.cs" />
+    <Compile Include="EditorSettings.cs" />
+    <Compile Include="EditorStyles.cs" />
+    <Compile Include="EditorUtility.cs" />
+    <Compile Include="EditorWindow.cs" />
+    <Compile Include="GUI\GUIGameObjectField.cs" />
+    <Compile Include="GUI\GUIResourceField.cs" />
+    <Compile Include="GUI\GUIVector3Field.cs" />
+    <Compile Include="GUI\GUIColorField.cs" />
+    <Compile Include="GUI\GUIFloatField.cs" />
+    <Compile Include="GUI\GUIIntField.cs" />
+    <Compile Include="GUI\GUITextField.cs" />
+    <Compile Include="GUI\GUIToggleField.cs" />
+    <Compile Include="GUI\GUIVector2Field.cs" />
+    <Compile Include="GUI\GUIVector4Field.cs" />
+    <Compile Include="ImportOptions.cs" />
+    <Compile Include="Inspector\CustomInspector.cs" />
+    <Compile Include="Inspector\GenericInspector.cs" />
+    <Compile Include="Inspector\InspectableArray.cs" />
+    <Compile Include="Inspector\InspectableBool.cs" />
+    <Compile Include="Inspector\InspectableColor.cs" />
+    <Compile Include="Inspector\InspectableFieldLayout.cs" />
+    <Compile Include="Inspector\InspectableFloat.cs" />
+    <Compile Include="Inspector\InspectableGameObjectRef.cs" />
+    <Compile Include="Inspector\InspectableList.cs" />
+    <Compile Include="Inspector\InspectableObject.cs" />
+    <Compile Include="Inspector\InspectableField.cs" />
+    <Compile Include="Inspector\InspectableInt.cs" />
+    <Compile Include="Inspector\InspectableResourceRef.cs" />
+    <Compile Include="Inspector\InspectableString.cs" />
+    <Compile Include="Inspector\InspectableVector2.cs" />
+    <Compile Include="Inspector\InspectableVector3.cs" />
+    <Compile Include="Inspector\InspectableVector4.cs" />
+    <Compile Include="Inspector\Inspector.cs" />
+    <Compile Include="Inspector\InspectorWindow.cs" />
+    <Compile Include="MenuItem.cs" />
+    <Compile Include="ModalWindow.cs" />
+    <Compile Include="ProgressBar.cs" />
+    <Compile Include="ProjectSettings.cs" />
+    <Compile Include="Library\LibraryWindow.cs" />
+    <Compile Include="ProjectWindow.cs" />
+    <Compile Include="Scene\Gizmos\CharacterControllerGizmo.cs" />
+    <Compile Include="Scene\Gizmos\ColliderGizmos.cs" />
+    <Compile Include="Scene\Gizmos\JointGizmos.cs" />
+    <Compile Include="Scene\Gizmos\LightGizmos.cs" />
+    <Compile Include="Scene\SceneAxesGUI.cs" />
+    <Compile Include="Scene\SceneAxesHandle.cs" />
+    <Compile Include="Scene\SceneCamera.cs" />
+    <Compile Include="Scene\SceneGizmos.cs" />
+    <Compile Include="Scene\SceneGrid.cs" />
+    <Compile Include="Scene\SceneHandles.cs" />
+    <Compile Include="Scene\SceneSelection.cs" />
+    <Compile Include="Scene\SceneWindow.cs" />
+    <Compile Include="Scene\DefaultHandle.cs" />
+    <Compile Include="Scene\DefaultHandleManager.cs" />
+    <Compile Include="Scene\Handles.cs" />
+    <Compile Include="Scene\MoveHandle.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="ProjectLibrary.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Scene\CustomHandle.cs" />
+    <Compile Include="Scene\DrawGizmo.cs" />
+    <Compile Include="Scene\Gizmos.cs" />
+    <Compile Include="Scene\HandleDrawing.cs" />
+    <Compile Include="Scene\HandleSlider.cs" />
+    <Compile Include="Scene\HandleSliderDisc.cs" />
+    <Compile Include="Scene\HandleSliderLine.cs" />
+    <Compile Include="Scene\HandleSliderPlane.cs" />
+    <Compile Include="Scene\Handle.cs" />
+    <Compile Include="Scene\RotateHandle.cs" />
+    <Compile Include="Scene\ScaleHandle.cs" />
+    <Compile Include="ScriptCodeManager.cs" />
+    <Compile Include="ScriptCompiler.cs" />
+    <Compile Include="Selection.cs" />
+    <Compile Include="SettingsWindow.cs" />
+    <Compile Include="ToolbarItem.cs" />
+    <Compile Include="UndoRedo.cs" />
+    <Compile Include="UnitTests.cs" />
+    <Compile Include="UnitTestTypes.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MBansheeEngine\MBansheeEngine.csproj">
+      <Project>{876eb338-489e-4727-84da-8cbbf0da5b5e}</Project>
+      <Name>MBansheeEngine</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>$(SolutionDir)..\..\Dependencies\tools\pdb2mdb.bat "$(TargetPath)" "$(ConfigurationName)"</PostBuildEvent>
+  </PropertyGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
 </Project>
 </Project>

+ 12 - 0
Source/MBansheeEditor/Scene/Gizmos/JointGizmos.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BansheeEditor.Scene.Gizmos
+{
+    class JointGizmos
+    {
+    }
+}