Parcourir la source

Work on GPUProfiler
More documentation

Marko Pintera il y a 11 ans
Parent
commit
b349c98754

+ 1 - 0
BansheeEngine.sln

@@ -33,6 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		MonoIntegrationGuide.txt = MonoIntegrationGuide.txt
 		Notes.txt = Notes.txt
 		Opts.txt = Opts.txt
+		Polish.txt = Polish.txt
 		ProjectLibrary.txt = ProjectLibrary.txt
 		RenderOperation.txt = RenderOperation.txt
 		ResourceBundles.txt = ResourceBundles.txt

+ 4 - 1
CamelotCore/CamelotCore.vcxproj

@@ -273,6 +273,8 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsCommonStructs.h" />
+    <ClInclude Include="Include\BsProfilerFwd.h" />
+    <ClInclude Include="Include\BsRenderStats.h" />
     <ClInclude Include="Include\BsThreadPolicy.h" />
     <ClInclude Include="Include\CmBindableGpuParamBlock.h" />
     <ClInclude Include="Include\CmBindableGpuParams.h" />
@@ -288,6 +290,7 @@
     <ClInclude Include="Include\CmGameObjectHandleRTTI.h" />
     <ClInclude Include="Include\CmGameObjectManager.h" />
     <ClInclude Include="Include\CmGameObjectRTTI.h" />
+    <ClInclude Include="Include\BsGPUProfiler.h" />
     <ClInclude Include="Include\CmGpuResourceData.h" />
     <ClInclude Include="Include\CmGpuParamBlockBuffer.h" />
     <ClInclude Include="Include\CmGpuResource.h" />
@@ -311,7 +314,6 @@
     <ClInclude Include="Include\CmResourceManifest.h" />
     <ClInclude Include="Include\CmResourceManifestRTTI.h" />
     <ClInclude Include="Include\CmSceneObjectRTTI.h" />
-    <ClInclude Include="Include\CmMemAllocCategories.h" />
     <ClInclude Include="Include\CmApplication.h" />
     <ClInclude Include="Include\CmBlendStateRTTI.h" />
     <ClInclude Include="Include\CmCommandQueue.h" />
@@ -446,6 +448,7 @@
     <ClCompile Include="Source\CmGpuParamBlock.cpp" />
     <ClCompile Include="Source\CmGpuParamBlockBuffer.cpp" />
     <ClCompile Include="Source\CmGpuParams.cpp" />
+    <ClCompile Include="Source\BsGPUProfiler.cpp" />
     <ClCompile Include="Source\CmGpuProgInclude.cpp" />
     <ClCompile Include="Source\CmGpuProgram.cpp" />
     <ClCompile Include="Source\CmGpuProgramImporter.cpp" />

+ 12 - 3
CamelotCore/CamelotCore.vcxproj.filters

@@ -348,9 +348,6 @@
     <ClInclude Include="Include\CmFontImportOptionsRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
-    <ClInclude Include="Include\CmMemAllocCategories.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmGameObjectHandle.h">
       <Filter>Header Files\Scene</Filter>
     </ClInclude>
@@ -528,6 +525,15 @@
     <ClInclude Include="Include\CmGpuProgramManager.h">
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsProfilerFwd.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsGPUProfiler.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsRenderStats.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CmApplication.cpp">
@@ -827,5 +833,8 @@
     <ClCompile Include="Source\CmGpuProgramManager.cpp">
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsGPUProfiler.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 104 - 0
CamelotCore/Include/BsGPUProfiler.h

@@ -0,0 +1,104 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmModule.h"
+#include "BsProfilerFwd.h"
+
+namespace BansheeEngine
+{
+	struct GPUProfilerReport
+	{
+		struct Sample
+		{
+			String name; /**< Name of the sample for easier identification. */
+			float timeMs; /**< Time in milliseconds it took to execute the sampled block. */
+
+			UINT32 numDrawCalls; /**< Number of draw calls that happened. */
+			UINT32 numRenderTargetChanges; /**< How many times was render target changed. */
+			UINT32 numPresents; /**< How many times did a buffer swap happen on a double buffered render target. */
+			UINT32 numClears; /**< How many times was render target cleared. */
+
+			UINT32 numVertices; /**< Total number of vertices sent to the GPU. */
+			UINT32 numTriangles; /**< Total number of triangles sent to the GPU. */
+			UINT32 numDrawnSamples; /**< Number of samples drawn by the GPU. */
+
+			UINT32 numBlendStateChanges; /**< How many times did the blend state change. */
+			UINT32 numRasterizerStateChanges; /**< How many times did the rasterizer state change. */
+			UINT32 numDepthStencilStateChanges; /**< How many times did the depth stencil state change. */
+			
+			UINT32 numTextureBinds; /**< How many times was a texture bound. */
+			UINT32 numSamplerBinds; /**< How many times was a sampler bound. */
+			UINT32 numVertexBufferBinds; /**< How many times was a vertex buffer bound. */
+			UINT32 numIndexBufferBinds; /**< How many times was an index buffer bound. */
+			UINT32 numGpuParamBufferBinds; /**< How many times was an GPU parameter buffer bound. */
+			UINT32 numGpuProgramBinds; /**< How many times was a GPU program bound. */
+
+			UINT32 numResourceWrites; /**< How many times were GPU resources written to. */
+			UINT32 numResourceReads; /**< How many times were GPU resources read from. */
+
+			UINT32 numObjectsCreated; /**< How many GPU objects were created. */
+			UINT32 numObjectsDestroyed; /**< How many GPU objects were destroyed. */
+		};
+
+		Sample frameSample; /**< Sample containing data for entire frame. */
+		Vector<Sample> samples;
+	};
+
+	/**
+	 * @brief	Profiler that measures time and amount of various GPU operations.
+	 *
+	 * @note	Sim thread only. However most operations will be queued on the core thread or
+	 *			on the GPU itself so the results will not be immediately available.
+	 */
+	class CM_EXPORT GPUProfiler : public Module<GPUProfiler>
+	{
+		/**
+		 * @brief	Signals a start of a new frame. Every frame will generate a separate profiling report.
+		 *			This call must be followed by "endFrame", and any sampling operations must happen between
+		 *			beginFrame and endFrame.
+		 */
+		void beginFrame();
+
+		/**
+		 * @brief	Signals an end of the currently sampled frame. Results of the sampling will be available
+		 *			once getNumAvailableReports increments. This may take a while as the sampling is scheduled on
+		 *			the core thread and on the GPU.
+		 */
+		void endFrame();
+
+		/**
+		 * @brief	Begins sample measurement. Must be followed by endSample.
+		 *
+		 * @param	name	Unique name for the sample you can later use to find the sampling data.
+		 *
+		 * @note	Must be called between beginFrame/endFrame calls.
+		 */
+		void beginSample(const ProfilerString& name);
+
+		/**
+		 * @brief	Ends sample measurement.
+		 *
+		 * @param	name	Unique name for the sample.
+		 *
+		 * @note	Unique name is primarily needed to more easily identify mismatched
+		 * 			begin/end sample pairs. Otherwise the name in beginSample would be enough.
+		 *			Must be called between beginFrame/endFrame calls.
+		 */
+		void endSample(const ProfilerString& name);
+
+		/**
+		 * @brief	Returns number of profiling reports that are ready but haven't been
+		 *			retrieved yet. 
+		 *
+		 * @note	There is an internal limit of maximum number of available reports, where oldest ones will
+		 *			get deleted so make sure to call this often if you don't want to miss some.
+		 */
+		UINT32 getNumAvailableReports();
+
+		/**
+		 * @brief	Gets the oldest report available and removes it from the internal list.
+		 *			Throws an exception if no reports are available.
+		 */
+		const GPUProfilerReport& getNextReport();
+	};
+}

+ 14 - 0
CamelotCore/Include/BsProfilerFwd.h

@@ -0,0 +1,14 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+
+namespace BansheeEngine
+{
+	typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString;
+
+	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
+	using ProfilerVector = std::vector<T, A>;
+
+	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
+	using ProfilerStack = std::stack<T, std::deque<T, A>>;
+}

+ 47 - 0
CamelotCore/Include/BsRenderStats.h

@@ -0,0 +1,47 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmModule.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Object that keeps track of various render statistics.
+	 */
+	struct RenderStats
+	{
+		RenderStats()
+		: numDrawCalls(0), numRenderTargetChanges(0), numPresents(0), numClears(0),
+		  numVertices(0), numPrimitives(0), numDrawnSamples(0), numBlendStateChanges(0),
+		  numRasterizerStateChanges(0), numDepthStencilStateChanges(0), numTextureBinds(0),
+		  numSamplerBinds(0), numVertexBufferBinds(0), numIndexBufferBinds(0), numGpuParamBufferBinds(0),
+		  numGpuProgramBinds(0)
+		{ }
+
+		UINT64 numDrawCalls;
+		UINT64 numRenderTargetChanges;
+		UINT64 numPresents;
+		UINT64 numClears;
+
+		UINT64 numVertices;
+		UINT64 numPrimitives;
+		UINT64 numDrawnSamples; 
+
+		UINT64 numBlendStateChanges; 
+		UINT64 numRasterizerStateChanges; 
+		UINT64 numDepthStencilStateChanges;
+
+		UINT64 numTextureBinds; 
+		UINT64 numSamplerBinds; 
+		UINT64 numVertexBufferBinds; 
+		UINT64 numIndexBufferBinds;
+		UINT64 numGpuParamBufferBinds;
+		UINT64 numGpuProgramBinds; 
+
+		UINT64 numResourceWrites;
+		UINT64 numResourceReads;
+
+		UINT64 numObjectsCreated; 
+		UINT64 numObjectsDestroyed; 
+	};
+}

+ 3 - 10
CamelotCore/Include/CmCPUProfiler.h

@@ -1,19 +1,12 @@
 #pragma once
 
 #include "CmPrerequisites.h"
+#include "BsProfilerFwd.h"
 
 namespace BansheeEngine
 {
 	class CPUProfilerReport;
 
-	typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString; 
-
-	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>> 
-	using ProfilerVector = std::vector<T, A>;
-
-	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>> 
-	using ProfilerStack = std::stack<T, std::deque<T, A>>;
-
 	/**
 	 * @brief	Provides various performance measuring methods
 	 * 			
@@ -185,7 +178,7 @@ namespace BansheeEngine
 		void beginSample(const ProfilerString& name);
 
 		/**
-		 * @brief	Ends sample measurement and returns measured data.
+		 * @brief	Ends sample measurement.
 		 *
 		 * @param	name	Unique name for the sample. 
 		 * 					
@@ -207,7 +200,7 @@ namespace BansheeEngine
 		void beginSamplePrecise(const ProfilerString& name);
 
 		/**
-		 * @brief	Ends precise sample measurement and returns measured data.
+		 * @brief	Ends precise sample measurement.
 		 *
 		 * @param	name	Unique name for the sample. 
 		 * 					

+ 37 - 0
CamelotCore/Include/CmDrawOps.h

@@ -17,4 +17,41 @@ namespace BansheeEngine
 		DOT_TRIANGLE_STRIP = 5,
 		DOT_TRIANGLE_FAN = 6
 	};
+
+	/**
+	* @brief	Converts the number of vertices to number of primitives
+	* 			based on the specified draw operation.
+	*/
+	UINT32 vertexCountToPrimCount(DrawOperationType type, UINT32 elementCount)
+	{
+		UINT32 primCount = 0;
+		switch (type)
+		{
+		case DOT_POINT_LIST:
+			primCount = elementCount;
+			break;
+
+		case DOT_LINE_LIST:
+			primCount = elementCount / 2;
+			break;
+
+		case DOT_LINE_STRIP:
+			primCount = elementCount - 1;
+			break;
+
+		case DOT_TRIANGLE_LIST:
+			primCount = elementCount / 3;
+			break;
+
+		case DOT_TRIANGLE_STRIP:
+			primCount = elementCount - 2;
+			break;
+
+		case DOT_TRIANGLE_FAN:
+			primCount = elementCount - 2;
+			break;
+		}
+
+		return primCount;
+	}
 }

+ 0 - 15
CamelotCore/Include/CmMemAllocCategories.h

@@ -1,15 +0,0 @@
-#pragma once
-
-#include "CmMemoryAllocator.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Allocator used for various GUI elements.
-	 */
-	class GUIAlloc
-	{
-		
-	};
-}
-

+ 0 - 2
CamelotCore/Include/CmPrerequisites.h

@@ -58,8 +58,6 @@
 
 #endif
 
-#include "CmMemAllocCategories.h"
-
 namespace BansheeEngine 
 {
 // Pre-declare classes

+ 33 - 0
CamelotCore/Include/CmRenderStateManager.h

@@ -5,6 +5,9 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Handles creation of various render states.
+	 */
 	class CM_EXPORT RenderStateManager : public Module<RenderStateManager>
 	{
 	public:
@@ -56,15 +59,45 @@ namespace BansheeEngine
 		 */
 		BlendStatePtr createEmptyBlendState() const;
 
+		/**
+		 * @brief	Gets a sampler state initialized with default options.
+		 */
 		const SamplerStatePtr& getDefaultSamplerState() const;
+		
+		/**
+		 * @brief	Gets a blend state initialized with default options.
+		 */
 		const BlendStatePtr& getDefaultBlendState() const;
+
+		/**
+		 * @brief	Gets a rasterizer state initialized with default options.
+		 */
 		const RasterizerStatePtr& getDefaultRasterizerState() const;
+
+		/**
+		 * @brief	Gets a depth stencil state initialized with default options.
+		 */
 		const DepthStencilStatePtr& getDefaultDepthStencilState() const;
 
 	protected:
+		/**
+		 * @copydoc	createSamplerState
+		 */
 		virtual SamplerStatePtr createSamplerStateImpl() const;
+
+		/**
+		 * @copydoc	createBlendState
+		 */
 		virtual BlendStatePtr createBlendStateImpl() const;
+
+		/**
+		 * @copydoc	createRasterizerState
+		 */
 		virtual RasterizerStatePtr createRasterizerStateImpl() const;
+
+		/**
+		 * @copydoc	createDepthStencilState
+		 */
 		virtual DepthStencilStatePtr createDepthStencilStateImpl() const;
 
 	private:

+ 28 - 19
CamelotCore/Include/CmRenderSystem.h

@@ -7,7 +7,7 @@
 
 #include "CmSamplerState.h"
 #include "CmCommonEnums.h"
-
+#include "BsRenderStats.h"
 #include "CmCommandQueue.h"
 #include "CmDrawOps.h"
 #include "CmRenderSystemCapabilities.h"
@@ -294,11 +294,11 @@ namespace BansheeEngine
 		virtual float getHorizontalTexelOffset() = 0;
 
 		/**
-		* @brief	Gets vertical texel offset used for mapping texels to pixels
-		*			in this render system.
-		*
-		* @note		Thread safe.
-		*/
+		 * @brief	Gets vertical texel offset used for mapping texels to pixels
+		 *			in this render system.
+		 *
+		 * @note		Thread safe.
+		 */
 		virtual float getVerticalTexelOffset() = 0;
 
 		/**
@@ -310,25 +310,33 @@ namespace BansheeEngine
 		virtual float getMinimumDepthInputValue() = 0;
 
 		/**
-		* @brief	Gets the maximum (farthest) depth value used by this
-		*			render system.
-		*
-		* @note		Thread safe.
-		*/
-		virtual float getMaximumDepthInputValue(void) = 0;
+		 * @brief	Gets the maximum (farthest) depth value used by this
+		 *			render system.
+		 *
+		 * @note		Thread safe.
+		 */
+		virtual float getMaximumDepthInputValue() = 0;
+
+		/**
+		 * @brief	Returns an object containing various rendering statistics.
+		 *			
+		 * @note	Do not modify the returned state unless you know what you are doing, it will
+		 *			change the actual internal object.
+		 */
+		RenderStats& getRenderStats() { return mRenderStats; }
 
 		/************************************************************************/
 		/* 							INTERNAL METHODS				        	*/
 		/************************************************************************/
 	protected:
 		/**
-		* @brief	Initializes the render system and creates a primary render window.
-		*
-		* @note		Although I'd like otherwise, due to the nature of some render system implementations,
-		* 			you cannot initialize the render system without a window.
-		*
-		*			Sim thread.
-		*/
+		 * @brief	Initializes the render system and creates a primary render window.
+		 *
+		 * @note		Although I'd like otherwise, due to the nature of some render system implementations,
+		 * 			you cannot initialize the render system without a window.
+		 *
+		 *			Sim thread.
+		 */
 		RenderWindowPtr initialize(const RENDER_WINDOW_DESC& primaryWindowDesc);
 
 		/**
@@ -362,6 +370,7 @@ namespace BansheeEngine
 
 		RenderTargetPtr mActiveRenderTarget;
 
+		RenderStats mRenderStats;
 		DriverVersion mDriverVersion;
 		CullingMode mCullingMode;
 		UINT16 mDisabledTexUnitsFrom;

+ 340 - 446
CamelotCore/Include/CmRenderSystemCapabilities.h

@@ -1,48 +1,11 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __RenderSystemCapabilities__
-#define __RenderSystemCapabilities__ 1
-
-// Precompiler options
+#pragma once
+
 #include "CmPrerequisites.h"
 #include "CmString.h"
 #include "CmGpuProgram.h"
 
-// Because there are more than 32 possible Capabilities, more than 1 int is needed to store them all.
-// In fact, an array of integers is used to store capabilities. However all the capabilities are defined in the single
-// enum. The only way to know which capabilities should be stored where in the array is to use some of the 32 bits
-// to record the category of the capability.  These top few bits are used as an index into mCapabilities array
-// The lower bits are used to identify each capability individually by setting 1 bit for each
-
-// Identifies how many bits are reserved for categories
-// NOTE: Although 4 bits (currently) are enough
-#define CAPS_CATEGORY_SIZE 4
-#define CM_CAPS_BITSHIFT (32 - CAPS_CATEGORY_SIZE)
+#define CAPS_CATEGORY_SIZE 8
+#define CM_CAPS_BITSHIFT (64 - CAPS_CATEGORY_SIZE)
 #define CAPS_CATEGORY_MASK (((1 << CAPS_CATEGORY_SIZE) - 1) << CM_CAPS_BITSHIFT)
 #define CM_CAPS_VALUE(cat, val) ((cat << CM_CAPS_BITSHIFT) | (1 << val))
 
@@ -50,136 +13,65 @@ THE SOFTWARE.
 
 namespace BansheeEngine 
 {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup RenderSystem
-	*  @{
-	*/
-
 	/// Enumerates the categories of capabilities
 	enum CapabilitiesCategory
 	{
 		CAPS_CATEGORY_COMMON = 0,
-		CAPS_CATEGORY_COMMON_2 = 1,
-		CAPS_CATEGORY_D3D9 = 2,
-		CAPS_CATEGORY_GL = 3,
-		CAPS_CATEGORY_COMMON_3 = 4,
-		CAPS_CATEGORY_D3D11 = 5,
-		/// Placeholder for max value
-		CAPS_CATEGORY_COUNT = 6
+		CAPS_CATEGORY_D3D9 = 1,
+		CAPS_CATEGORY_GL = 2,
+		CAPS_CATEGORY_D3D11 = 3,
+		CAPS_CATEGORY_COUNT = 32 /**< Maximum number of categories. */
 	};
 
-	/// Enum describing the different hardware capabilities we want to check for
-	/// OGRE_CAPS_VALUE(a, b) defines each capability
-	// a is the category (which can be from 0 to 15)
-	// b is the value (from 0 to 27)
-	enum Capabilities
+	/**
+	 * @brief	Enum describing the different hardware capabilities we can check for.
+	 */
+	enum Capabilities : UINT64
 	{
-		/// Supports generating mipmaps in hardware
-		RSC_AUTOMIPMAP              = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 0),
-		RSC_BLENDING                = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 1),
-		/// Supports anisotropic texture filtering
-		RSC_ANISOTROPY              = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 2),
-		/// Supports fixed-function DOT3 texture blend
-		RSC_DOT3                    = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 3),
-		/// Supports cube mapping
-		RSC_CUBEMAPPING             = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 4),
-		/// Supports hardware stencil buffer
-		RSC_HWSTENCIL               = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 5),
-		/// Supports hardware vertex and index buffers
-		RSC_VBO                     = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 7),
-		/// Supports vertex programs (vertex shaders)
-		RSC_VERTEX_PROGRAM          = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 9),
-		/// Supports fragment programs (pixel shaders)
-		RSC_FRAGMENT_PROGRAM        = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 10),
-		/// Supports performing a scissor test to exclude areas of the screen
-		RSC_SCISSOR_TEST            = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 11),
-		/// Supports separate stencil updates for both front and back faces
-		RSC_TWO_SIDED_STENCIL       = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 12),
-		/// Supports wrapping the stencil value at the range extremeties
-		RSC_STENCIL_WRAP            = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 13),
-		/// Supports hardware occlusion queries
-		RSC_HWOCCLUSION             = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 14),
-		/// Supports user clipping planes
-		RSC_USER_CLIP_PLANES        = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 15),
-		/// Supports the VET_UBYTE4 vertex element type
-		RSC_VERTEX_FORMAT_UBYTE4    = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 16),
-		/// Supports infinite far plane projection
-		RSC_INFINITE_FAR_PLANE      = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 17),
-		/// Supports hardware render-to-texture (bigger than framebuffer)
-		RSC_HWRENDER_TO_TEXTURE     = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 18),
-		/// Supports float textures and render targets
-		RSC_TEXTURE_FLOAT           = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 19),
-		/// Supports non-power of two textures
-		RSC_NON_POWER_OF_2_TEXTURES = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 20),
-		/// Supports 3d (volume) textures
-		RSC_TEXTURE_3D              = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21),
-		/// Supports basic point sprite rendering
-		RSC_POINT_SPRITES           = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22),
-		/// Supports extra point parameters (minsize, maxsize, attenuation)
-		RSC_POINT_EXTENDED_PARAMETERS = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23),
-		/// Supports vertex texture fetch
-		RSC_VERTEX_TEXTURE_FETCH = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24),
-		/// Supports mipmap LOD biasing
-		RSC_MIPMAP_LOD_BIAS = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25),
-		/// Supports hardware geometry programs
-		RSC_GEOMETRY_PROGRAM = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26),
-		/// Supports rendering to vertex buffers
-		RSC_HWRENDER_TO_VERTEX_BUFFER = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27),
-		/// Support for async occlusion queries
-		RSC_HWOCCLUSION_ASYNCHRONOUS = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 28),
-		/// Supports dynamic shader linking
-		RSC_SHADER_SUBROUTINE  = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 29),
-
-		/// Supports compressed textures
-		RSC_TEXTURE_COMPRESSION = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 0),
-		/// Supports compressed textures in the DXT/ST3C formats
-		RSC_TEXTURE_COMPRESSION_DXT = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 1),
-		/// Supports compressed textures in the VTC format
-		RSC_TEXTURE_COMPRESSION_VTC = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 2),
-		/// Supports compressed textures in the PVRTC format
-		RSC_TEXTURE_COMPRESSION_PVRTC = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 3),
-		/// Supports fixed-function pipeline
-		RSC_FIXED_FUNCTION = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 4),
-		/// Supports MRTs with different bit depths
-		RSC_MRT_DIFFERENT_BIT_DEPTHS = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 5),
-		/// Supports Alpha to Coverage (A2C)
-		RSC_ALPHA_TO_COVERAGE = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 6),
-		/// Supports Blending operations other than +
-		RSC_ADVANCED_BLEND_OPERATIONS = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 7),
-
-		// ***** DirectX specific caps *****
-		/// Is DirectX feature "per stage constants" supported
-		RSC_PERSTAGECONSTANT = CM_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0),
-
-		// ***** GL Specific Caps *****
-		/// Supports openGL GLEW version 1.5
-		RSC_GL1_5_NOVBO    = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 1),
-		/// Support for Frame Buffer Objects (FBOs)
-		RSC_FBO              = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 2),
-		/// Support for Frame Buffer Objects ARB implementation (regular FBO is higher precedence)
-		RSC_FBO_ARB          = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 3),
-		/// Support for Frame Buffer Objects ATI implementation (ARB FBO is higher precedence)
-		RSC_FBO_ATI          = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 4),
-		/// Support for PBuffer
-		RSC_PBUFFER          = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 5),
-		/// Support for GL 1.5 but without HW occlusion workaround
-		RSC_GL1_5_NOHWOCCLUSION = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 6),
-		/// Support for point parameters ARB implementation
-		RSC_POINT_EXTENDED_PARAMETERS_ARB = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 7),
-		/// Support for point parameters EXT implementation
-		RSC_POINT_EXTENDED_PARAMETERS_EXT = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 8),
-
-		/// Supports hardware tessellation programs
-		RSC_TESSELLATION_PROGRAM = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_3, 0),
-		/// Supports hardware compute programs
-		RSC_COMPUTE_PROGRAM = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON_3, 1),
-
+		RSC_AUTOMIPMAP				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 0), /**< Supports generating mipmaps in hardware. */
+		RSC_ANISOTROPY				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 1), /**< Supports anisotropic texture filtering. */
+		RSC_CUBEMAPPING				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 2), /**< Supports cube mapping. */
+		RSC_TWO_SIDED_STENCIL		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 3), /**< Supports separate stencil updates for both front and back faces. */
+		RSC_STENCIL_WRAP			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 4), /**< Supports wrapping the stencil value at the range extremes. */
+		RSC_HWOCCLUSION				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 5), /**< Supports hardware occlusion queries. */
+		RSC_USER_CLIP_PLANES		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 6), /**< Supports user clipping planes. */
+		RSC_VERTEX_FORMAT_UBYTE4	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 7), /**< Supports the VET_UBYTE4 vertex element type. */
+		RSC_INFINITE_FAR_PLANE		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 8), /**< Supports infinite far plane projection. */
+		RSC_HWRENDER_TO_TEXTURE		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 9), /**< Supports hardware render-to-texture. */
+		RSC_TEXTURE_FLOAT			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 10), /**< Supports float textures and render targets. */
+		RSC_NON_POWER_OF_2_TEXTURES = CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 11), /**< Supports non-power of two textures. */
+		RSC_TEXTURE_3D				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 12), /**< Supports 3d (volume) textures. */
+		RSC_POINT_SPRITES			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 13), /**< Supports basic point sprite rendering. */
+
+		RSC_POINT_EXTENDED_PARAMETERS	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 14), /**< Supports extra point parameters (minsize, maxsize, attenuation). */
+		RSC_VERTEX_TEXTURE_FETCH		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 15), /**< Supports vertex texture fetch. */
+		RSC_MIPMAP_LOD_BIAS				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 16), /**< Supports mipmap LOD biasing. */
+		RSC_GEOMETRY_PROGRAM			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 17), /**< Supports hardware geometry programs. */
+
+		RSC_TEXTURE_COMPRESSION			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 18), /**< Supports compressed textures. */
+		RSC_TEXTURE_COMPRESSION_DXT		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 19), /**< Supports compressed textures in the DXT/ST3C formats. */
+		RSC_TEXTURE_COMPRESSION_VTC		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 20), /**< Supports compressed textures in the VTC format. */
+		RSC_TEXTURE_COMPRESSION_PVRTC	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21), /**< Supports compressed textures in the PVRTC format. */
+		RSC_MRT_DIFFERENT_BIT_DEPTHS	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22), /**< Supports multiple render targets with different bit depths. */
+		RSC_ALPHA_TO_COVERAGE			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23), /**< Supports Alpha to Coverage. */
+		RSC_ADVANCED_BLEND_OPERATIONS	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24), /**< Supports blend operations like subtract, min, max. */
+		RSC_SHADER_SUBROUTINE			= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25), /**< Supports dynamic shader linking. */
+		RSC_HWOCCLUSION_ASYNCHRONOUS	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26), /**< Support for async occlusion queries. */
+		RSC_HWRENDER_TO_VERTEX_BUFFER	= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27), /**< Supports rendering to vertex buffers. */
+		RSC_TESSELLATION_PROGRAM		= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 28), /**< Supports hardware tessellation programs. */
+		RSC_COMPUTE_PROGRAM				= CM_CAPS_VALUE(CAPS_CATEGORY_COMMON, 29), /**< Supports hardware compute programs. */
+
+		// ***** DirectX 9 specific caps *****
+		RSC_PERSTAGECONSTANT = CM_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0), /**< Are per stage constants supported. */
+
+		// ***** GL Specific caps *****
+		RSC_FBO              = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 0), /**< Support for Frame Buffer Objects. */
+		RSC_PBUFFER			 = CM_CAPS_VALUE(CAPS_CATEGORY_GL, 1), /**< Support for PBuffers. */
 	};
 
-	/// DriverVersion is used by RenderSystemCapabilities and both GL and D3D9
-	/// to store the version of the current GPU driver
+	/**
+	 * @brief	Holds data about render system driver version.
+	 */
 	struct CM_EXPORT DriverVersion 
 	{
 		int major;
@@ -192,6 +84,9 @@ namespace BansheeEngine
 			major = minor = release = build = 0;
 		}
 
+		/**
+		 * @brief	Returns the driver version as a single string.
+		 */
 		String toString() const 
 		{
 			StringStream str;
@@ -199,6 +94,10 @@ namespace BansheeEngine
 			return str.str();
 		}
 
+		/**
+		 * @brief	Parses a string in the major.minor.release.build format
+		 *			and stores the version numbers.
+		 */
 		void fromString(const String& versionString)
 		{
 			Vector<BansheeEngine::String> tokens = StringUtil::split(versionString, ".");
@@ -216,7 +115,9 @@ namespace BansheeEngine
 		}
 	};
 
-	/** Enumeration of GPU vendors. */
+	/**
+	 * @brief	Types of GPU vendors
+	 */
 	enum GPUVendor
 	{
 		GPU_UNKNOWN = 0,
@@ -224,208 +125,121 @@ namespace BansheeEngine
 		GPU_AMD = 2, 
 		GPU_INTEL = 3,
 
-		/// placeholder
 		GPU_VENDOR_COUNT = 4
 	};
 
-	/** singleton class for storing the capabilities of the graphics card. 
-	@remarks
-	This class stores the capabilities of the graphics card.  This
-	information is set by the individual render systems.
-	*/
+	/**
+	 * @brief	Holds information about render hardware and driver capabilities
+	 *			and allows you to easily set and query those capabilities.
+	 */
 	class CM_EXPORT RenderSystemCapabilities
 	{
-
-	public:
-
-		typedef Set<String> ShaderProfiles;
-	private:
-		/// This is used to build a database of RSC's
-		/// if a RSC with same name, but newer version is introduced, the older one 
-		/// will be removed
-		DriverVersion mDriverVersion;
-		/// GPU Vendor
-		GPUVendor mVendor;
-
-		static Vector<BansheeEngine::String> msGPUVendorStrings;
-		static void initVendorStrings();
-
-		/// The number of world matrices available
-		UINT16 mNumWorldMatrices;
-		/// The number of texture units available per stage
-		Map<GpuProgramType, UINT16> mNumTextureUnitsPerStage;
-		/// Total number of texture units available
-		UINT16 mNumCombinedTextureUnits;
-		/// The number of uniform blocks available per stage
-		Map<GpuProgramType, UINT16> mNumUniformBlocksPerStage;
-		/// Total number of uniform blocks available
-		UINT16 mNumCombinedUniformBlocks;
-		/// The stencil buffer bit depth
-		UINT16 mStencilBufferBitDepth;
-		/// Maximum number of vertex buffers we can bind at once
-		UINT32 mMaxBoundVertexBuffers;
-		/// The number of matrices available for hardware blending
-		UINT16 mNumVertexBlendMatrices;
-		/// Stores the capabilities flags.
-		int mCapabilities[CAPS_CATEGORY_COUNT];
-		/// Which categories are relevant
-		bool mCategoryRelevant[CAPS_CATEGORY_COUNT];
-		/// The name of the device as reported by the render system
-		String mDeviceName;
-		/// The identifier associated with the render system for which these capabilities are valid
-		String mRenderSystemName;
-
-		/// The number of floating-point constants vertex programs support
-		UINT16 mVertexProgramConstantFloatCount;           
-		/// The number of integer constants vertex programs support
-		UINT16 mVertexProgramConstantIntCount;           
-		/// The number of boolean constants vertex programs support
-		UINT16 mVertexProgramConstantBoolCount;           
-		/// The number of floating-point constants geometry programs support
-		UINT16 mGeometryProgramConstantFloatCount;           
-		/// The number of integer constants vertex geometry support
-		UINT16 mGeometryProgramConstantIntCount;           
-		/// The number of boolean constants vertex geometry support
-		UINT16 mGeometryProgramConstantBoolCount;           
-		/// The number of floating-point constants fragment programs support
-		UINT16 mFragmentProgramConstantFloatCount;           
-		/// The number of integer constants fragment programs support
-		UINT16 mFragmentProgramConstantIntCount;           
-		/// The number of boolean constants fragment programs support
-		UINT16 mFragmentProgramConstantBoolCount;
-		/// The number of simultaneous render targets supported
-		UINT16 mNumMultiRenderTargets;
-		/// The maximum point size
-		float mMaxPointSize;
-		/// Are non-POW2 textures feature-limited?
-		bool mNonPOW2TexturesLimited;
-		/// The number of vertices a geometry program can emit in a single run
-		int mGeometryProgramNumOutputVertices;
-
-		/// The list of supported shader profiles
-		ShaderProfiles mSupportedShaderProfiles;
-
-		// Allows us to convert a generic shader profile to a render-system specific one
-		UnorderedMap<GpuProgramProfile, String> mGenericToSpecificShaderProfileMap;
 	public:	
 		RenderSystemCapabilities ();
 		virtual ~RenderSystemCapabilities ();
 
-		virtual size_t calculateSize() const {return 0;}
-
-		/** Set the driver version. */
+		/**
+		 * @brief	Sets the current driver version.
+		 */
 		void setDriverVersion(const DriverVersion& version)
 		{
 			mDriverVersion = version;
 		}
-
-		void parseDriverVersionFromString(const String& versionString)
-		{
-			DriverVersion version;
-			version.fromString(versionString);
-			setDriverVersion(version);
-		}
-
-
+		
+		/**
+		 * @brief	Returns current driver version.
+		 */
 		DriverVersion getDriverVersion() const
 		{
 			return mDriverVersion;
 		}
 
+		/**
+		 * @brief	Returns vendor of the currently used GPU.
+		 */
 		GPUVendor getVendor() const
 		{
 			return mVendor;
 		}
 
+		/**
+		 * @brief	Sets the GPU vendor.
+		 */
 		void setVendor(GPUVendor v)
 		{
 			mVendor = v;
 		}
 
-		/// Parse and set vendor
-		void parseVendorFromString(const String& vendorString)
-		{
-			setVendor(vendorFromString(vendorString));
-		}
-
-		/// Convert a vendor string to an enum
+		/**
+		 * @brief	Parses a vendor string and returns an enum with the vendor
+		 *			if parsed succesfully.
+		 */
 		static GPUVendor vendorFromString(const String& vendorString);
-		/// Convert a vendor enum to a string
-		static String vendorToString(GPUVendor v);
-
-		bool isDriverOlderThanVersion(DriverVersion v) const
-		{
-			if (mDriverVersion.major < v.major)
-				return true;
-			else if (mDriverVersion.major == v.major && 
-				mDriverVersion.minor < v.minor)
-				return true;
-			else if (mDriverVersion.major == v.major && 
-				mDriverVersion.minor == v.minor && 
-				mDriverVersion.release < v.release)
-				return true;
-			else if (mDriverVersion.major == v.major && 
-				mDriverVersion.minor == v.minor && 
-				mDriverVersion.release == v.release &&
-				mDriverVersion.build < v.build)
-				return true;
-			return false;
-		}
 
-		void setNumWorldMatrices(UINT16 num)
-		{
-			mNumWorldMatrices = num;
-		}
+		/**
+		 * @brief	Converts a vendor enum to a string.
+		 */
+		static String vendorToString(GPUVendor v);
 
+		/**
+		 * @brief	Sets the maximum number of texture units per pipeline stage.
+		 */
 		void setNumTextureUnits(GpuProgramType type, UINT16 num)
 		{
 			mNumTextureUnitsPerStage[type] = num;
 		}
 
+		/**
+		 * @brief	Sets the maximum number of texture units in all pipeline stages.
+		 */
 		void setNumCombinedTextureUnits(UINT16 num)
 		{
 			mNumCombinedTextureUnits = num;
 		}
 
-		void setNumUniformBlockBuffers(GpuProgramType type, UINT16 num)
+		/**
+		 * @brief	Sets the maximum number of GPU param block buffers per pipeline stage.
+		 */
+		void setNumGpuParamBlockBuffers(GpuProgramType type, UINT16 num)
 		{
-			mNumUniformBlocksPerStage[type] = num;
+			mNumGpuParamBlocksPerStage[type] = num;
 		}
 
-		void setNumCombinedUniformBlockBuffers(UINT16 num)
+		/**
+		 * @brief	Sets the maximum number of GPU param block buffers in all pipeline stages.
+		 */
+		void setNumCombinedGpuParamBlockBuffers(UINT16 num)
 		{
 			mNumCombinedUniformBlocks = num;
 		}
 
+		/**
+		 * @brief	Sets maximum stencil buffer depth in bits.
+		 */
 		void setStencilBufferBitDepth(UINT16 num)
 		{
 			mStencilBufferBitDepth = num;
 		}
 
-		void setNumVertexBlendMatrices(UINT16 num)
-		{
-			mNumVertexBlendMatrices = num;
-		}
-
+		/**
+		 * @brief	Sets maximum number of bound vertex buffers.
+		 */
 		void setMaxBoundVertexBuffers(UINT32 num)
 		{
 			mMaxBoundVertexBuffers = num;
 		}
 
-		/// The number of simultaneous render targets supported
+		/**
+		 * @brief	Sets maximum number of simultaneously set render targets.
+		 */
 		void setNumMultiRenderTargets(UINT16 num)
 		{
 			mNumMultiRenderTargets = num;
 		}
 
-		UINT16 getNumWorldMatrices(void) const
-		{ 
-			return mNumWorldMatrices;
-		}
-
-		/** Returns the number of texture units the current output hardware
-		supports, for the specified stage.
-		*/
+		/**
+		 * @brief	Returns the number of texture units supported per pipeline stage.
+		 */
 		UINT16 getNumTextureUnits(GpuProgramType type) const
 		{
 			auto iterFind = mNumTextureUnitsPerStage.find(type);
@@ -435,148 +249,128 @@ namespace BansheeEngine
 				return 0;
 		}
 
-		/** Returns the number of texture units the current output hardware
-		supports, total for all stages combined.
+		/**
+		* @brief	Returns the number of texture units supported in all pipeline stages.
 		*/
 		UINT16 getNumCombinedTextureUnits() const
 		{
 			return mNumCombinedTextureUnits;
 		}
 
-		/** Returns the number of uniform buffer blocks the current output hardware
-		supports, for the specified stage.
-		*/
-		UINT16 getNumUniformBlockBuffers(GpuProgramType type) const
+		/**
+		 * @brief	Returns the maximum number of bound GPU program param block 
+		 *			buffers per pipeline stage.
+		 */
+		UINT16 getNumGpuParamBlockBuffers(GpuProgramType type) const
 		{
-			auto iterFind = mNumUniformBlocksPerStage.find(type);
-			if(iterFind != mNumUniformBlocksPerStage.end())
+			auto iterFind = mNumGpuParamBlocksPerStage.find(type);
+			if(iterFind != mNumGpuParamBlocksPerStage.end())
 				return iterFind->second;
 			else
 				return 0;
 		}
 
-		/** Returns the number of combined uniform buffers the current output hardware
-		supports, total for all stages combined.
+		/**
+		* @brief	Returns the maximum number of bound GPU program param block
+		*			buffers in all pipeline stages.
 		*/
-		UINT16 getNumCombinedUniformBlockBuffers() const
+		UINT16 getNumCombinedGpuParamBlockBuffers() const
 		{
 			return mNumCombinedUniformBlocks;
 		}
 
-		/** Determines the bit depth of the hardware accelerated stencil 
-		buffer, if supported.
-		@remarks
-		If hardware stencilling is not supported, the software will
-		provide an 8-bit software stencil.
-		*/
-		UINT16 getStencilBufferBitDepth(void) const
+		/**
+		 * @brief	Returns the maximum number of bits available for
+		 *			the stencil buffer.
+		 */
+		UINT16 getStencilBufferBitDepth() const
 		{
 			return mStencilBufferBitDepth;
 		}
 
-		/** Returns the number of matrices available to hardware vertex 
-		blending for this rendering system. */
-		UINT16 getNumVertexBlendMatrices(void) const
-		{
-			return mNumVertexBlendMatrices;
-		}
-		/** Returns the maximum number of vertex buffers we can bind at once. */
+		/**
+		 * @brief	Returns the maximum number of vertex buffers that can be bound
+		 *			at once.
+		 */
 		UINT32 getMaxBoundVertexBuffers() const
 		{
 			return mMaxBoundVertexBuffers;
 		}
 
-		/// The number of simultaneous render targets supported
-		UINT16 getNumMultiRenderTargets(void) const
+		/**
+		 * @brief	Returns the maximum number of render targets we can render to
+		 *			simultaneously.
+		 */
+		UINT16 getNumMultiRenderTargets() const
 		{
 			return mNumMultiRenderTargets;
 		}
 
-		/** Returns true if capability is render system specific
-		*/
-		bool isCapabilityRenderSystemSpecific(const Capabilities c)
-		{
-			int cat = c >> CM_CAPS_BITSHIFT;
-			if(cat == CAPS_CATEGORY_GL || cat == CAPS_CATEGORY_D3D9)
-				return true;
-			return false;
-		}
-
-		/** Adds a capability flag
-		*/
+		/**
+		 * @brief	Sets a capability flag indicating this capability is supported.
+		 */
 		void setCapability(const Capabilities c) 
 		{ 
 			int index = (CAPS_CATEGORY_MASK & c) >> CM_CAPS_BITSHIFT;
-			// zero out the index from the stored capability
 			mCapabilities[index] |= (c & ~CAPS_CATEGORY_MASK);
 		}
 
-		/** Remove a capability flag
-		*/
+		/**
+		 * @brief	Remove a capability flag indicating this capability is 
+		 *			not supported (default).
+		 */
 		void unsetCapability(const Capabilities c) 
 		{ 
 			int index = (CAPS_CATEGORY_MASK & c) >> CM_CAPS_BITSHIFT;
-			// zero out the index from the stored capability
 			mCapabilities[index] &= (~c | CAPS_CATEGORY_MASK);
 		}
 
-		/** Checks for a capability
-		*/
+		/**
+		 * @brief	Checks is the specified capability supported.
+		 */
 		bool hasCapability(const Capabilities c) const
 		{
 			int index = (CAPS_CATEGORY_MASK & c) >> CM_CAPS_BITSHIFT;
-			// test against
-			if(mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK))
-			{
-				return true;
-			}
-			else
-			{
-				return false;
-			}
+
+			return (mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK));
 		}
 
-		/** Adds the profile to the list of supported profiles
-		*/
+		/**
+		 * @brief	Adds a shader profile to the list of render-system specific supported profiles.
+		 */
 		void addShaderProfile(const String& profile)
 		{
 			mSupportedShaderProfiles.insert(profile);
-
 		}
 
-		/** Adds the profile to the list of supported profiles
-		*/
+		/**
+		 * @brief	Adds a mapping between GPU program profile enum and render-system specific profile name.
+		 */
 		void addGpuProgramProfile(GpuProgramProfile gpuProgProfile, const String& rsSpecificProfile)
 		{
 			mGenericToSpecificShaderProfileMap[gpuProgProfile] = rsSpecificProfile;
 		}
 
-		/** Remove a given shader profile, if present.
-		*/
-		void removeShaderProfile(const String& profile)
-		{
-			mSupportedShaderProfiles.erase(profile);
-		}
-
-		/** Returns true if profile is in the list of supported profiles
-		*/
+		/**
+		 * @brief	Returns true if the provided profile is supported.
+		 */
 		bool isShaderProfileSupported(const String& profile) const
 		{
 			return (mSupportedShaderProfiles.end() != mSupportedShaderProfiles.find(profile));
 		}
 
-
-		/** Returns a set of all supported shader profiles
-		* */
-		const ShaderProfiles& getSupportedShaderProfiles() const
+		/**
+		 * @brief	Returns a set of all supported shader profiles.
+		 */
+		const Set<String>& getSupportedShaderProfiles() const
 		{
 			return mSupportedShaderProfiles;
 		}
 
-		/** Converts a generic GpuProgramProfile identifier into a render-system specific one.  
-		* 
-		*  Returns an empty string if it can't convert it.
-		*/
+		/**
+		 * @brief	Converts a generic GpuProgramProfile identifier into a render-system specific one.  
+		 *			Returns an empty string if conversion cannot be done.
+		 */
 		String gpuProgProfileToRSSpecificProfile(GpuProgramProfile gpuProgProfile) const
 		{
 			auto iterFind = mGenericToSpecificShaderProfileMap.find(gpuProgProfile);
@@ -588,174 +382,274 @@ namespace BansheeEngine
 			return "";
 		}
 
-		/// The number of floating-point constants vertex programs support
-		UINT16 getVertexProgramConstantFloatCount(void) const
+		/**
+		 * @brief	Gets the number of floating-point constants vertex programs support.
+		 */
+		UINT16 getVertexProgramConstantFloatCount() const
 		{
 			return mVertexProgramConstantFloatCount;           
 		}
-		/// The number of integer constants vertex programs support
-		UINT16 getVertexProgramConstantIntCount(void) const
+
+		/**
+		 * @brief	Gets the number of integer constants vertex programs support.
+		 */
+		UINT16 getVertexProgramConstantIntCount() const
 		{
 			return mVertexProgramConstantIntCount;           
 		}
-		/// The number of boolean constants vertex programs support
-		UINT16 getVertexProgramConstantBoolCount(void) const
+
+		/**
+		 * @brief	Gets the number of boolean constants vertex programs support.
+		 */
+		UINT16 getVertexProgramConstantBoolCount() const
 		{
 			return mVertexProgramConstantBoolCount;           
 		}
-		/// The number of floating-point constants geometry programs support
-		UINT16 getGeometryProgramConstantFloatCount(void) const
+
+		/**
+		 * @brief	Gets the number of floating-point constants geometry programs support.
+		 */
+		UINT16 getGeometryProgramConstantFloatCount() const
 		{
 			return mGeometryProgramConstantFloatCount;           
 		}
-		/// The number of integer constants geometry programs support
-		UINT16 getGeometryProgramConstantIntCount(void) const
+
+		/**
+		 * @brief	 Gets the number of integer constants geometry programs support.
+		 */
+		UINT16 getGeometryProgramConstantIntCount() const
 		{
 			return mGeometryProgramConstantIntCount;           
 		}
-		/// The number of boolean constants geometry programs support
-		UINT16 getGeometryProgramConstantBoolCount(void) const
+
+		/**
+		 * @brief	 Gets the number of boolean constants geometry programs support.
+		 */
+		UINT16 getGeometryProgramConstantBoolCount() const
 		{
 			return mGeometryProgramConstantBoolCount;           
 		}
-		/// The number of floating-point constants fragment programs support
-		UINT16 getFragmentProgramConstantFloatCount(void) const
+
+		/**
+		 * @brief	Gets the number of floating-point constants fragment programs support.
+		 */
+		UINT16 getFragmentProgramConstantFloatCount() const
 		{
 			return mFragmentProgramConstantFloatCount;           
 		}
-		/// The number of integer constants fragment programs support
-		UINT16 getFragmentProgramConstantIntCount(void) const
+
+		/**
+		 * @brief	Gets the number of integer constants fragment programs support.
+		 */
+		UINT16 getFragmentProgramConstantIntCount() const
 		{
 			return mFragmentProgramConstantIntCount;           
 		}
-		/// The number of boolean constants fragment programs support
-		UINT16 getFragmentProgramConstantBoolCount(void) const
+		
+		/**
+		 * @brief	 Gets the number of boolean constants fragment programs support.
+		 */
+		UINT16 getFragmentProgramConstantBoolCount() const
 		{
 			return mFragmentProgramConstantBoolCount;           
 		}
 
-		/// sets the device name for Render system
+		/**
+		 * @brief	Sets the current GPU device name.
+		 */
 		void setDeviceName(const String& name)
 		{
 			mDeviceName = name;
 		}
 
-		/// gets the device name for render system
+		/**
+		 * @brief	Gets the current GPU device name.
+		 */
 		String getDeviceName() const
 		{
 			return mDeviceName;
 		}
 
-		/// The number of floating-point constants vertex programs support
+		/**
+		 * @brief	Sets the number of floating-point constants vertex programs support.
+		 */
 		void setVertexProgramConstantFloatCount(UINT16 c)
 		{
 			mVertexProgramConstantFloatCount = c;           
 		}
-		/// The number of integer constants vertex programs support
+
+		/**
+		 * @brief	Sets the number of integer constants vertex programs support.
+		 */
 		void setVertexProgramConstantIntCount(UINT16 c)
 		{
 			mVertexProgramConstantIntCount = c;           
 		}
-		/// The number of boolean constants vertex programs support
+
+		/**
+		 * @brief	Sets the number of boolean constants vertex programs support.
+		 */
 		void setVertexProgramConstantBoolCount(UINT16 c)
 		{
 			mVertexProgramConstantBoolCount = c;           
 		}
-		/// The number of floating-point constants geometry programs support
+
+		/**
+		 * @brief	Sets the number of floating-point constants geometry programs support.
+		 */
 		void setGeometryProgramConstantFloatCount(UINT16 c)
 		{
 			mGeometryProgramConstantFloatCount = c;           
 		}
-		/// The number of integer constants geometry programs support
+
+		/**
+		 * @brief	Sets the number of integer constants geometry programs support.
+		 */
 		void setGeometryProgramConstantIntCount(UINT16 c)
 		{
 			mGeometryProgramConstantIntCount = c;           
 		}
-		/// The number of boolean constants geometry programs support
+
+		/**
+		 * @brief	Sets the number of boolean constants geometry programs support.
+		 */
 		void setGeometryProgramConstantBoolCount(UINT16 c)
 		{
 			mGeometryProgramConstantBoolCount = c;           
 		}
-		/// The number of floating-point constants fragment programs support
+
+		/**
+		 * @brief	Sets the number of floating-point constants fragment programs support.
+		 */
 		void setFragmentProgramConstantFloatCount(UINT16 c)
 		{
 			mFragmentProgramConstantFloatCount = c;           
 		}
-		/// The number of integer constants fragment programs support
+
+		/**
+		 * @brief	Sets the number of integer constants fragment programs support.
+		 */
 		void setFragmentProgramConstantIntCount(UINT16 c)
 		{
 			mFragmentProgramConstantIntCount = c;           
 		}
-		/// The number of boolean constants fragment programs support
+
+		/**
+		 * @brief	Sets the number of boolean constants fragment programs support.
+		 */
 		void setFragmentProgramConstantBoolCount(UINT16 c)
 		{
 			mFragmentProgramConstantBoolCount = c;           
 		}
-		/// Maximum point screen size in pixels
+
+		/**
+		 * @brief	Sets the maximum point screen size in pixels.
+		 */
 		void setMaxPointSize(float s)
 		{
 			mMaxPointSize = s;
 		}
-		/// Maximum point screen size in pixels
+
+		/**
+		 * @brief	Gets the maximum point screen size in pixels.
+		 */
 		float getMaxPointSize(void) const
 		{
 			return mMaxPointSize;
 		}
-		/// Non-POW2 textures limited
-		void setNonPOW2TexturesLimited(bool l)
-		{
-			mNonPOW2TexturesLimited = l;
-		}
-		/** Are non-power of two textures limited in features?
-		@remarks
-		If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this
-		method returns true, you can use non power of 2 textures only if:
-		<ul><li>You load them explicitly with no mip maps</li>
-		<li>You don't use DXT texture compression</li>
-		<li>You use clamp texture addressing</li></ul>
-		*/
-		bool getNonPOW2TexturesLimited(void) const
-		{
-			return mNonPOW2TexturesLimited;
-		}
-		/// Set the number of vertices a single geometry program run can emit
+
+		/**
+		 * @brief	Sets the number of vertices a single geometry program run can emit.
+		 */
 		void setGeometryProgramNumOutputVertices(int numOutputVertices)
 		{
 			mGeometryProgramNumOutputVertices = numOutputVertices;
 		}
-		/// Get the number of vertices a single geometry program run can emit
+
+		/**
+		 * @brief	Gets the number of vertices a single geometry program run can emit.
+		 */
 		int getGeometryProgramNumOutputVertices(void) const
 		{
 			return mGeometryProgramNumOutputVertices;
 		}
 
-		/// Get the identifier of the rendersystem from which these capabilities were generated
-		String getRenderSystemName(void) const
+		/**
+		 * @brief	Get the identifier of the render system from which these capabilities were generated.
+		 */
+		String getRenderSystemName() const
 		{
 			return mRenderSystemName;
 		}
-		///  Set the identifier of the rendersystem from which these capabilities were generated
+
+		/**
+		 * @brief	Set the identifier of the render system from which these capabilities were generated.
+		 */
 		void setRenderSystemName(const String& rs)
 		{
 			mRenderSystemName = rs;
 		}
 
-		/// Mark a category as 'relevant' or not, ie will it be reported
-		void setCategoryRelevant(CapabilitiesCategory cat, bool relevant)
-		{
-			mCategoryRelevant[cat] = relevant;
-		}
+	private:
+		/**
+		 * @brief	Initializes vendor enum -> vendor name mappings.
+		 */
+		static void initVendorStrings();
 
-		/// Return whether a category is 'relevant' or not, ie will it be reported
-		bool isCategoryRelevant(CapabilitiesCategory cat)
-		{
-			return mCategoryRelevant[cat];
-		}
-	};
+	private:
+		static Vector<BansheeEngine::String> msGPUVendorStrings;
 
-	/** @} */
-	/** @} */
-} // namespace
+		DriverVersion mDriverVersion;
+		GPUVendor mVendor = GPU_UNKNOWN;
 
-#endif // __RenderSystemCapabilities__
+		// The number of texture units available per stage
+		Map<GpuProgramType, UINT16> mNumTextureUnitsPerStage;
+		// Total number of texture units available
+		UINT16 mNumCombinedTextureUnits = 0;
+		// The number of uniform blocks available per stage
+		Map<GpuProgramType, UINT16> mNumGpuParamBlocksPerStage;
+		// Total number of uniform blocks available
+		UINT16 mNumCombinedUniformBlocks = 0;
+		// The stencil buffer bit depth
+		UINT16 mStencilBufferBitDepth = 0;
+		// Maximum number of vertex buffers we can bind at once
+		UINT32 mMaxBoundVertexBuffers = 0;
+		// Stores the capabilities flags.
+		UINT32 mCapabilities[CAPS_CATEGORY_COUNT];
+		// The name of the device as reported by the render system
+		String mDeviceName;
+		// The identifier associated with the render system for which these capabilities are valid
+		String mRenderSystemName;
+
+		// The number of floating-point constants vertex programs support
+		UINT16 mVertexProgramConstantFloatCount = 0;
+		// The number of integer constants vertex programs support
+		UINT16 mVertexProgramConstantIntCount = 0;
+		// The number of boolean constants vertex programs support
+		UINT16 mVertexProgramConstantBoolCount = 0;
+		// The number of floating-point constants geometry programs support
+		UINT16 mGeometryProgramConstantFloatCount = 0;
+		// The number of integer constants vertex geometry support
+		UINT16 mGeometryProgramConstantIntCount = 0;
+		// The number of boolean constants vertex geometry support
+		UINT16 mGeometryProgramConstantBoolCount = 0;
+		// The number of floating-point constants fragment programs support
+		UINT16 mFragmentProgramConstantFloatCount = 0;
+		// The number of integer constants fragment programs support
+		UINT16 mFragmentProgramConstantIntCount = 0;
+		// The number of boolean constants fragment programs support
+		UINT16 mFragmentProgramConstantBoolCount = 0;
+		// The number of simultaneous render targets supported
+		UINT16 mNumMultiRenderTargets = 0;
+		// The maximum point size in pixels
+		float mMaxPointSize = 0.0f;
+		// The number of vertices a geometry program can emit in a single run
+		UINT32 mGeometryProgramNumOutputVertices = 0;
+
+		// The list of supported shader profiles
+		Set<String> mSupportedShaderProfiles;
 
+		// Allows us to convert a generic shader profile to a render-system specific one
+		UnorderedMap<GpuProgramProfile, String> mGenericToSpecificShaderProfileMap;
+	};
+}

+ 1 - 0
CamelotCore/Source/BsGPUProfiler.cpp

@@ -0,0 +1 @@
+#include "BsGPUProfiler.h"

+ 5 - 1
CamelotCore/Source/CmRenderSystem.cpp

@@ -268,8 +268,12 @@ namespace BansheeEngine {
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
-		if(target->isInitialized())
+		if (target->isInitialized())
+		{
 			target->swapBuffers();
+
+			mRenderStats.numPresents++;
+		}
 	}
 
 	void RenderSystem::writeSubresource(GpuResourcePtr resource, UINT32 subresourceIdx, const GpuResourceDataPtr& data, bool discardEntireBuffer, AsyncOp& asyncOp)

+ 6 - 23
CamelotCore/Source/CmRenderSystemCapabilities.cpp

@@ -7,27 +7,11 @@ namespace BansheeEngine
 	Vector<BansheeEngine::String> RenderSystemCapabilities::msGPUVendorStrings;
 
 	RenderSystemCapabilities::RenderSystemCapabilities()
-		: mVendor(GPU_UNKNOWN)
-		, mNumWorldMatrices(0)
-		, mNumCombinedTextureUnits(0)
-		, mNumCombinedUniformBlocks(0)
-		, mStencilBufferBitDepth(0)
-		, mNumVertexBlendMatrices(0)
-		, mNumMultiRenderTargets(1)
-		, mMaxBoundVertexBuffers(1)
-		, mNonPOW2TexturesLimited(false)
 	{
-
 		for(int i = 0; i < CAPS_CATEGORY_COUNT; i++)
 		{
 			mCapabilities[i] = 0;
 		}
-		mCategoryRelevant[CAPS_CATEGORY_COMMON] = true;
-		mCategoryRelevant[CAPS_CATEGORY_COMMON_2] = true;
-
-		mCategoryRelevant[CAPS_CATEGORY_D3D11] = false;
-		mCategoryRelevant[CAPS_CATEGORY_D3D9] = false;
-		mCategoryRelevant[CAPS_CATEGORY_GL] = false;
 
 		mNumTextureUnitsPerStage[GPT_VERTEX_PROGRAM] = 0;
 		mNumTextureUnitsPerStage[GPT_FRAGMENT_PROGRAM] = 0;
@@ -36,12 +20,12 @@ namespace BansheeEngine
 		mNumTextureUnitsPerStage[GPT_DOMAIN_PROGRAM] = 0;
 		mNumTextureUnitsPerStage[GPT_COMPUTE_PROGRAM] = 0;
 
-		mNumUniformBlocksPerStage[GPT_VERTEX_PROGRAM] = 0;
-		mNumUniformBlocksPerStage[GPT_FRAGMENT_PROGRAM] = 0;
-		mNumUniformBlocksPerStage[GPT_GEOMETRY_PROGRAM] = 0;
-		mNumUniformBlocksPerStage[GPT_HULL_PROGRAM] = 0;
-		mNumUniformBlocksPerStage[GPT_DOMAIN_PROGRAM] = 0;
-		mNumUniformBlocksPerStage[GPT_COMPUTE_PROGRAM] = 0;
+		mNumGpuParamBlocksPerStage[GPT_VERTEX_PROGRAM] = 0;
+		mNumGpuParamBlocksPerStage[GPT_FRAGMENT_PROGRAM] = 0;
+		mNumGpuParamBlocksPerStage[GPT_GEOMETRY_PROGRAM] = 0;
+		mNumGpuParamBlocksPerStage[GPT_HULL_PROGRAM] = 0;
+		mNumGpuParamBlocksPerStage[GPT_DOMAIN_PROGRAM] = 0;
+		mNumGpuParamBlocksPerStage[GPT_COMPUTE_PROGRAM] = 0;
 	}
 
 	RenderSystemCapabilities::~RenderSystemCapabilities()
@@ -65,7 +49,6 @@ namespace BansheeEngine
 		}
 
 		return ret;
-		
 	}
 
 	String RenderSystemCapabilities::vendorToString(GPUVendor v)

+ 2 - 0
CamelotD3D11RenderSystem/Include/CmD3D11RenderSystem.h

@@ -124,6 +124,8 @@ namespace BansheeEngine
 		VertexDeclarationPtr mActiveVertexDeclaration;
 		D3D11GpuProgramPtr	 mActiveVertexShader;
 
+		DrawOperationType	mActiveDrawOp;
+
 		/**
 		 * @brief	Creates or retrieves a proper input layout depending on the currently set vertex shader
 		 * 			and vertex buffer. 

+ 50 - 21
CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp

@@ -29,9 +29,9 @@ namespace BansheeEngine
 {
 	D3D11RenderSystem::D3D11RenderSystem()
 		: mDXGIFactory(nullptr), mDevice(nullptr), mDriverList(nullptr)
-		, mActiveD3DDriver(nullptr), mFeatureLevel(D3D_FEATURE_LEVEL_9_1)
+		, mActiveD3DDriver(nullptr), mFeatureLevel(D3D_FEATURE_LEVEL_11_0)
 		, mHLSLFactory(nullptr), mIAManager(nullptr)
-		, mStencilRef(0)
+		, mStencilRef(0), mActiveDrawOp(DOT_TRIANGLE_LIST)
 	{
 		mClipPlanesDirty = false; // DX11 handles clip planes through shaders
 	}
@@ -214,6 +214,8 @@ namespace BansheeEngine
 		default:
 			CM_EXCEPT(InvalidParametersException, "Unsupported gpu program type: " + toString(gptype));
 		}
+
+		mRenderStats.numSamplerBinds++;
 	}
 
 	void D3D11RenderSystem::setBlendState(const BlendStatePtr& blendState)
@@ -222,6 +224,8 @@ namespace BansheeEngine
 
 		D3D11BlendState* d3d11BlendState = static_cast<D3D11BlendState*>(const_cast<BlendState*>(blendState.get()));
 		mDevice->getImmediateContext()->OMSetBlendState(d3d11BlendState->getInternal(), nullptr, 0xFFFFFFFF);
+
+		mRenderStats.numBlendStateChanges++;
 	}
 
 	void D3D11RenderSystem::setRasterizerState(const RasterizerStatePtr& rasterizerState)
@@ -230,6 +234,8 @@ namespace BansheeEngine
 
 		D3D11RasterizerState* d3d11RasterizerState = static_cast<D3D11RasterizerState*>(const_cast<RasterizerState*>(rasterizerState.get()));
 		mDevice->getImmediateContext()->RSSetState(d3d11RasterizerState->getInternal());
+
+		mRenderStats.numRasterizerStateChanges++;
 	}
 
 	void D3D11RenderSystem::setDepthStencilState(const DepthStencilStatePtr& depthStencilState, UINT32 stencilRefValue)
@@ -238,6 +244,8 @@ namespace BansheeEngine
 
 		D3D11DepthStencilState* d3d11RasterizerState = static_cast<D3D11DepthStencilState*>(const_cast<DepthStencilState*>(depthStencilState.get()));
 		mDevice->getImmediateContext()->OMSetDepthStencilState(d3d11RasterizerState->getInternal(), stencilRefValue);
+
+		mRenderStats.numDepthStencilStateChanges++;
 	}
 
 	void D3D11RenderSystem::setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const TexturePtr &texPtr)
@@ -280,6 +288,8 @@ namespace BansheeEngine
 		default:
 			CM_EXCEPT(InvalidParametersException, "Unsupported gpu program type: " + toString(gptype));
 		}
+
+		mRenderStats.numTextureBinds++;
 	}
 
 	void D3D11RenderSystem::disableTextureUnit(GpuProgramType gptype, UINT16 texUnit)
@@ -350,6 +360,8 @@ namespace BansheeEngine
 		}
 
 		mDevice->getImmediateContext()->IASetVertexBuffers(index, numBuffers, dx11buffers, strides, offsets);
+
+		mRenderStats.numVertexBufferBinds++;
 	}
 
 	void D3D11RenderSystem::setIndexBuffer(const IndexBufferPtr& buffer)
@@ -367,6 +379,8 @@ namespace BansheeEngine
 			CM_EXCEPT(InternalErrorException, "Unsupported index format: " + toString(indexBuffer->getType()));
 
 		mDevice->getImmediateContext()->IASetIndexBuffer(indexBuffer->getD3DIndexBuffer(), indexFormat, 0);
+
+		mRenderStats.numIndexBufferBinds++;
 	}
 
 	void D3D11RenderSystem::setVertexDeclaration(VertexDeclarationPtr vertexDeclaration)
@@ -435,6 +449,8 @@ namespace BansheeEngine
 
 		if (mDevice->hasError())
 			CM_EXCEPT(RenderingAPIException, "Failed to bindGpuProgram : " + mDevice->getErrorDescription());
+
+		mRenderStats.numGpuProgramBinds++;
 	}
 
 	void D3D11RenderSystem::unbindGpuProgram(GpuProgramType gptype)
@@ -465,6 +481,8 @@ namespace BansheeEngine
 		default:
 			CM_EXCEPT(InvalidParametersException, "Unsupported gpu program type: " + toString(gptype));
 		}
+
+		mRenderStats.numGpuProgramBinds++;
 	}
 
 	void D3D11RenderSystem::bindGpuParams(GpuProgramType gptype, BindableGpuParams& bindableParams)
@@ -532,6 +550,8 @@ namespace BansheeEngine
 				mDevice->getImmediateContext()->CSSetConstantBuffers(iter->second.slot, 1, bufferArray);
 				break;
 			};
+
+			mRenderStats.numGpuParamBufferBinds++;
 		}
 
 		if (mDevice->hasError())
@@ -550,6 +570,10 @@ namespace BansheeEngine
 		if(mDevice->hasError())
 			LOGWRN(mDevice->getErrorDescription());
 #endif
+
+		mRenderStats.numDrawCalls++;
+		mRenderStats.numVertices += vertexCount;
+		mRenderStats.numPrimitives += vertexCountToPrimCount(mActiveDrawOp, vertexCount);
 	}
 
 	void D3D11RenderSystem::drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount)
@@ -564,6 +588,10 @@ namespace BansheeEngine
 		if(mDevice->hasError())
 			LOGWRN(mDevice->getErrorDescription());
 #endif
+
+		mRenderStats.numDrawCalls++;
+		mRenderStats.numVertices += vertexCount;
+		mRenderStats.numPrimitives += vertexCountToPrimCount(mActiveDrawOp, indexCount);
 	}
 
 	void D3D11RenderSystem::setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom)
@@ -590,8 +618,11 @@ namespace BansheeEngine
 		bool clearEntireTarget = clearArea.width == 0 || clearArea.height == 0;
 		clearEntireTarget |= (clearArea.x == 0 && clearArea.y == 0 && clearArea.width == mActiveRenderTarget->getWidth() && clearArea.height == mActiveRenderTarget->getHeight());
 
-		if(!clearEntireTarget)
+		if (!clearEntireTarget)
+		{
 			D3D11RenderUtility::instance().drawClearQuad(buffers, color, depth, stencil);
+			mRenderStats.numClears++;
+		}
 		else
 			clearRenderTarget(buffers, color, depth, stencil);
 	}
@@ -651,6 +682,8 @@ namespace BansheeEngine
 			if(depthStencilView != nullptr)
 				mDevice->getImmediateContext()->ClearDepthStencilView(depthStencilView, clearFlag, depth, (UINT8)stencil);
 		}
+
+		mRenderStats.numClears++;
 	}
 
 	void D3D11RenderSystem::setRenderTarget(RenderTargetPtr target)
@@ -680,6 +713,8 @@ namespace BansheeEngine
 			CM_EXCEPT(RenderingAPIException, "Failed to setRenderTarget : " + mDevice->getErrorDescription());
 
 		cm_deleteN<ScratchAlloc>(views, maxRenderTargets);
+
+		mRenderStats.numRenderTargetChanges++;
 	}
 
 	void D3D11RenderSystem::setClipPlanesImpl(const PlaneList& clipPlanes)
@@ -693,18 +728,14 @@ namespace BansheeEngine
 
 		RenderSystemCapabilities* rsc = cm_new<RenderSystemCapabilities>();
 
-		rsc->setCategoryRelevant(CAPS_CATEGORY_D3D11, true);
 		rsc->setDriverVersion(mDriverVersion);
 		rsc->setDeviceName(mActiveD3DDriver->getDriverDescription());
 		rsc->setRenderSystemName(getName());
 
-		rsc->setCapability(RSC_HWSTENCIL);
 		rsc->setStencilBufferBitDepth(8);
 
 		rsc->setCapability(RSC_ANISOTROPY);
 		rsc->setCapability(RSC_AUTOMIPMAP);
-		rsc->setCapability(RSC_BLENDING);
-		rsc->setCapability(RSC_DOT3);
 
 		// Cube map
 		rsc->setCapability(RSC_CUBEMAPPING);
@@ -712,8 +743,6 @@ namespace BansheeEngine
 		// We always support compression, D3DX will decompress if device does not support
 		rsc->setCapability(RSC_TEXTURE_COMPRESSION);
 		rsc->setCapability(RSC_TEXTURE_COMPRESSION_DXT);
-		rsc->setCapability(RSC_VBO);
-		rsc->setCapability(RSC_SCISSOR_TEST);
 		rsc->setCapability(RSC_TWO_SIDED_STENCIL);
 		rsc->setCapability(RSC_STENCIL_WRAP);
 		rsc->setCapability(RSC_HWOCCLUSION);
@@ -741,12 +770,12 @@ namespace BansheeEngine
 			rsc->setNumCombinedTextureUnits(rsc->getNumTextureUnits(GPT_FRAGMENT_PROGRAM)
 				+ rsc->getNumTextureUnits(GPT_VERTEX_PROGRAM) + rsc->getNumTextureUnits(GPT_VERTEX_PROGRAM));
 
-			rsc->setNumUniformBlockBuffers(GPT_FRAGMENT_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
-			rsc->setNumUniformBlockBuffers(GPT_VERTEX_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
-			rsc->setNumUniformBlockBuffers(GPT_GEOMETRY_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+			rsc->setNumGpuParamBlockBuffers(GPT_FRAGMENT_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+			rsc->setNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+			rsc->setNumGpuParamBlockBuffers(GPT_GEOMETRY_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
 
-			rsc->setNumCombinedUniformBlockBuffers(rsc->getNumUniformBlockBuffers(GPT_FRAGMENT_PROGRAM)
-				+ rsc->getNumUniformBlockBuffers(GPT_VERTEX_PROGRAM) + rsc->getNumUniformBlockBuffers(GPT_VERTEX_PROGRAM));
+			rsc->setNumCombinedGpuParamBlockBuffers(rsc->getNumGpuParamBlockBuffers(GPT_FRAGMENT_PROGRAM)
+				+ rsc->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM) + rsc->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM));
 		}
 
 		if(mFeatureLevel >= D3D_FEATURE_LEVEL_10_1)
@@ -785,14 +814,14 @@ namespace BansheeEngine
 				+ rsc->getNumTextureUnits(GPT_HULL_PROGRAM) + rsc->getNumTextureUnits(GPT_DOMAIN_PROGRAM)
 				+ rsc->getNumTextureUnits(GPT_COMPUTE_PROGRAM));
 
-			rsc->setNumUniformBlockBuffers(GPT_HULL_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
-			rsc->setNumUniformBlockBuffers(GPT_DOMAIN_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
-			rsc->setNumUniformBlockBuffers(GPT_COMPUTE_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+			rsc->setNumGpuParamBlockBuffers(GPT_HULL_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+			rsc->setNumGpuParamBlockBuffers(GPT_DOMAIN_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+			rsc->setNumGpuParamBlockBuffers(GPT_COMPUTE_PROGRAM, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
 
-			rsc->setNumCombinedUniformBlockBuffers(rsc->getNumUniformBlockBuffers(GPT_FRAGMENT_PROGRAM)
-				+ rsc->getNumUniformBlockBuffers(GPT_VERTEX_PROGRAM) + rsc->getNumUniformBlockBuffers(GPT_VERTEX_PROGRAM)
-				+ rsc->getNumUniformBlockBuffers(GPT_HULL_PROGRAM) + rsc->getNumUniformBlockBuffers(GPT_DOMAIN_PROGRAM)
-				+ rsc->getNumUniformBlockBuffers(GPT_COMPUTE_PROGRAM));
+			rsc->setNumCombinedGpuParamBlockBuffers(rsc->getNumGpuParamBlockBuffers(GPT_FRAGMENT_PROGRAM)
+				+ rsc->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM) + rsc->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM)
+				+ rsc->getNumGpuParamBlockBuffers(GPT_HULL_PROGRAM) + rsc->getNumGpuParamBlockBuffers(GPT_DOMAIN_PROGRAM)
+				+ rsc->getNumGpuParamBlockBuffers(GPT_COMPUTE_PROGRAM));
 
 			rsc->setCapability(RSC_SHADER_SUBROUTINE);
 		}

+ 2 - 37
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -1,32 +1,4 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __D3D9RENDERSYSTEM_H__
-#define __D3D9RENDERSYSTEM_H__
+#pragma once
 
 #include "CmD3D9Prerequisites.h"
 #include "CmString.h"
@@ -280,12 +252,6 @@ namespace BansheeEngine
 		 */
 		D3DPRIMITIVETYPE getD3D9PrimitiveType() const;
 
-		/**
-		 * @brief	Converts the number of points to number of primitives 
-		 * 			based on the specified draw operation.
-		 */
-		UINT32 pointCountToPrimCount(DrawOperationType type, UINT32 elementCount) const;
-
         /** Check whether or not filtering is supported for the precise texture format requested
         with the given usage options.
         */
@@ -531,5 +497,4 @@ namespace BansheeEngine
 		/// Notify when a device has been reset.
 		void notifyOnDeviceReset(D3D9Device* device);
 	};
-}
-#endif
+}

Fichier diff supprimé car celui-ci est trop grand
+ 131 - 221
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp


+ 54 - 116
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -206,40 +206,20 @@ namespace BansheeEngine
 		switch (glprg->getType())
 		{
 		case GPT_VERTEX_PROGRAM:
-			if (mCurrentVertexProgram != glprg)
-			{
-				unbindGpuProgram(glprg->getType());
-				mCurrentVertexProgram = glprg;
-			}
+			mCurrentVertexProgram = glprg;
 			break;
 
 		case GPT_FRAGMENT_PROGRAM:
-			if (mCurrentFragmentProgram != glprg)
-			{
-				unbindGpuProgram(glprg->getType());
-				mCurrentFragmentProgram = glprg;
-			}
+			mCurrentFragmentProgram = glprg;
 			break;
 		case GPT_GEOMETRY_PROGRAM:
-			if (mCurrentGeometryProgram != glprg)
-			{
-				unbindGpuProgram(glprg->getType());
-				mCurrentGeometryProgram = glprg;
-			}
+			mCurrentGeometryProgram = glprg;
 			break;
 		case GPT_DOMAIN_PROGRAM:
-			if (mCurrentDomainProgram != glprg)
-			{
-				unbindGpuProgram(glprg->getType());
-				mCurrentDomainProgram = glprg;
-			}
+			mCurrentDomainProgram = glprg;
 			break;
 		case GPT_HULL_PROGRAM:
-			if (mCurrentHullProgram != glprg)
-			{
-				unbindGpuProgram(glprg->getType());
-				mCurrentHullProgram = glprg;
-			}
+			mCurrentHullProgram = glprg;
 			break;
 		}
 
@@ -317,8 +297,11 @@ namespace BansheeEngine
 			glBindBufferRange(GL_UNIFORM_BUFFER, globalBlockBinding, glParamBlockBuffer->getGLHandle(), 0, glParamBlockBuffer->getSize());
 
 			blockBinding++;
+
+			mRenderStats.numGpuParamBufferBinds++;
 		}
 
+		bool hasBoundAtLeastOne = false;
 		for(auto iter = paramDesc.params.begin(); iter != paramDesc.params.end(); ++iter)
 		{
 			const GpuParamDataDesc& paramDesc = iter->second;
@@ -327,6 +310,7 @@ namespace BansheeEngine
 				continue;
 
 			const UINT8* ptrData = uniformBufferData + paramDesc.cpuMemOffset * sizeof(UINT32);
+			hasBoundAtLeastOne = true;
 
 			switch(paramDesc.type)
 			{
@@ -398,6 +382,9 @@ namespace BansheeEngine
 			}
 		}
 
+		if (hasBoundAtLeastOne)
+			mRenderStats.numGpuParamBufferBinds++;
+
 		if(uniformBufferData != nullptr)
 		{
 			cm_free<ScratchAlloc>(uniformBufferData);
@@ -431,6 +418,8 @@ namespace BansheeEngine
 		}
 
 		activateGLTextureUnit(0);
+
+		mRenderStats.numTextureBinds++;
 	}
 
 	void GLRenderSystem::setSamplerState(GpuProgramType gptype, UINT16 unit, const SamplerStatePtr& state)
@@ -456,6 +445,8 @@ namespace BansheeEngine
 
 		// Set border color
 		setTextureBorderColor(unit, state->getBorderColor());
+
+		mRenderStats.numSamplerBinds++;
 	}
 
 	void GLRenderSystem::setBlendState(const BlendStatePtr& blendState)
@@ -480,6 +471,8 @@ namespace BansheeEngine
 		// Color write mask
 		UINT8 writeMask = blendState->getRenderTargetWriteMask(0);
 		setColorBufferWriteEnabled((writeMask & 0x1) != 0, (writeMask & 0x2) != 0, (writeMask & 0x4) != 0, (writeMask & 0x8) != 0);
+
+		mRenderStats.numBlendStateChanges++;
 	}
 
 	void GLRenderSystem::setRasterizerState(const RasterizerStatePtr& rasterizerState)
@@ -493,6 +486,8 @@ namespace BansheeEngine
 		setPolygonMode(rasterizerState->getPolygonMode());
 
 		setScissorTestEnable(rasterizerState->getScissorEnable());
+
+		mRenderStats.numRasterizerStateChanges++;
 	}
 
 	void GLRenderSystem::setDepthStencilState(const DepthStencilStatePtr& depthStencilState, UINT32 stencilRefValue)
@@ -517,6 +512,8 @@ namespace BansheeEngine
 
 		// Set stencil ref value
 		setStencilRefValue(stencilRefValue);
+
+		mRenderStats.numDepthStencilStateChanges++;
 	}
 
 	void GLRenderSystem::setViewport(const ViewportPtr& vp)
@@ -585,6 +582,8 @@ namespace BansheeEngine
 				glDisable(GL_FRAMEBUFFER_SRGB_EXT);
 			}
 		}
+
+		mRenderStats.numRenderTargetChanges++;
 	}
 
 	void GLRenderSystem::beginFrame()
@@ -646,6 +645,10 @@ namespace BansheeEngine
 		glDrawArrays(primType, vertexOffset, vertexCount);
 
 		endDraw();
+
+		mRenderStats.numDrawCalls++;
+		mRenderStats.numVertices += vertexCount;
+		mRenderStats.numPrimitives += vertexCountToPrimCount(mCurrentDrawOperation, vertexCount);
 	}
 
 	void GLRenderSystem::drawIndexed(UINT32 startIndex, UINT32 indexCount, UINT32 vertexOffset, UINT32 vertexCount)
@@ -667,6 +670,11 @@ namespace BansheeEngine
 		glDrawElementsBaseVertex(primType, indexCount, indexType, (GLvoid*)(mBoundIndexBuffer->getIndexSize() * startIndex), vertexOffset);
 
 		endDraw();
+
+		mRenderStats.numDrawCalls++;
+		mRenderStats.numVertices += vertexCount;
+		mRenderStats.numPrimitives += vertexCountToPrimCount(mCurrentDrawOperation, vertexCount);
+		mRenderStats.numIndexBufferBinds++;
 	}
 
 	void GLRenderSystem::setScissorRect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom)
@@ -790,6 +798,8 @@ namespace BansheeEngine
 		{
 			glStencilMask(mStencilWriteMask);
 		}
+
+		mRenderStats.numClears++;
 	}
 
 	/************************************************************************/
@@ -1311,6 +1321,9 @@ namespace BansheeEngine
 
 		const GLVertexArrayObject& vao = GLVertexArrayObjectManager::instance().getVAO(mCurrentVertexProgram, mBoundVertexDeclaration, mBoundVertexBuffers);
 		glBindVertexArray(vao.getGLHandle()); 
+
+		mRenderStats.numVertexBufferBinds++;
+		mRenderStats.numGpuProgramBinds++;
 	}
 
 	void GLRenderSystem::endDraw()
@@ -1527,7 +1540,7 @@ namespace BansheeEngine
 
 	UINT32 GLRenderSystem::getGLUniformBlockBinding(GpuProgramType gptype, UINT32 binding)
 	{
-		UINT32 maxNumBindings = mCurrentCapabilities->getNumUniformBlockBuffers(gptype);
+		UINT32 maxNumBindings = mCurrentCapabilities->getNumGpuParamBlockBuffers(gptype);
 		if (binding < 0 || binding >= maxNumBindings)
 		{
 			CM_EXCEPT(InvalidParametersException, "Invalid buffer binding for the provided stage. Buffer binding: " + toString(binding) + ". Stage: " +
@@ -1607,23 +1620,6 @@ namespace BansheeEngine
 				"Trying to initialize GLRenderSystem from RenderSystemCapabilities that do not support OpenGL");
 		}
 
-		if(caps->hasCapability(RSC_GL1_5_NOVBO))
-		{
-			// Assign ARB functions same to GL 1.5 version since
-			// interface identical
-			glBindBufferARB = glBindBuffer;
-			glBufferDataARB = glBufferData;
-			glBufferSubDataARB = glBufferSubData;
-			glDeleteBuffersARB = glDeleteBuffers;
-			glGenBuffersARB = glGenBuffers;
-			glGetBufferParameterivARB = glGetBufferParameteriv;
-			glGetBufferPointervARB = glGetBufferPointerv;
-			glGetBufferSubDataARB = glGetBufferSubData;
-			glIsBufferARB = glIsBuffer;
-			glMapBufferARB = glMapBuffer;
-			glUnmapBufferARB = glUnmapBuffer;
-		}
-
 		HardwareBufferManager::startUp<GLHardwareBufferManager>();
 		checkForErrors();
 
@@ -1637,32 +1633,9 @@ namespace BansheeEngine
 			checkForErrors();
 		}
 
-		if(caps->hasCapability(RSC_HWOCCLUSION))
-		{
-			if(caps->hasCapability(RSC_GL1_5_NOHWOCCLUSION))
-			{
-				// Assign ARB functions same to GL 1.5 version since
-				// interface identical
-				glBeginQueryARB = glBeginQuery;
-				glDeleteQueriesARB = glDeleteQueries;
-				glEndQueryARB = glEndQuery;
-				glGenQueriesARB = glGenQueries;
-				glGetQueryObjectivARB = glGetQueryObjectiv;
-				glGetQueryObjectuivARB = glGetQueryObjectuiv;
-				glGetQueryivARB = glGetQueryiv;
-				glIsQueryARB = glIsQuery;
-			}
-		}
-
 		// Check for framebuffer object extension
 		if(caps->hasCapability(RSC_FBO))
 		{
-			// Before GL version 2.0, we need to get one of the extensions
-			if(caps->hasCapability(RSC_FBO_ARB))
-				GLEW_GET_FUN(__glewDrawBuffers) = glDrawBuffersARB;
-			else if(caps->hasCapability(RSC_FBO_ATI))
-				GLEW_GET_FUN(__glewDrawBuffers) = glDrawBuffersATI;
-
 			if(caps->hasCapability(RSC_HWRENDER_TO_TEXTURE))
 			{
 				// Create FBO manager
@@ -1697,19 +1670,19 @@ namespace BansheeEngine
 			mTextureTypes[i] = 0;
 
 		mVertexUBOffset = 0;
-		UINT32 totalNumUniformBlocks = caps->getNumUniformBlockBuffers(GPT_VERTEX_PROGRAM);
+		UINT32 totalNumUniformBlocks = caps->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM);
 		mFragmentUBOffset = totalNumUniformBlocks;
-		totalNumUniformBlocks += caps->getNumUniformBlockBuffers(GPT_FRAGMENT_PROGRAM);
+		totalNumUniformBlocks += caps->getNumGpuParamBlockBuffers(GPT_FRAGMENT_PROGRAM);
 		mGeometryUBOffset = totalNumUniformBlocks;
-		totalNumUniformBlocks += caps->getNumUniformBlockBuffers(GPT_GEOMETRY_PROGRAM);
+		totalNumUniformBlocks += caps->getNumGpuParamBlockBuffers(GPT_GEOMETRY_PROGRAM);
 		mHullUBOffset = totalNumUniformBlocks;
-		totalNumUniformBlocks += caps->getNumUniformBlockBuffers(GPT_HULL_PROGRAM);
+		totalNumUniformBlocks += caps->getNumGpuParamBlockBuffers(GPT_HULL_PROGRAM);
 		mDomainUBOffset = totalNumUniformBlocks;
-		totalNumUniformBlocks += caps->getNumUniformBlockBuffers(GPT_DOMAIN_PROGRAM);
+		totalNumUniformBlocks += caps->getNumGpuParamBlockBuffers(GPT_DOMAIN_PROGRAM);
 		mComputeUBOffset = totalNumUniformBlocks;
-		totalNumUniformBlocks += caps->getNumUniformBlockBuffers(GPT_COMPUTE_PROGRAM);
+		totalNumUniformBlocks += caps->getNumGpuParamBlockBuffers(GPT_COMPUTE_PROGRAM);
 
-		UINT16 numCombinedUniformBlocks = caps->getNumCombinedUniformBlockBuffers();
+		UINT16 numCombinedUniformBlocks = caps->getNumCombinedGpuParamBlockBuffers();
 
 		if(totalNumUniformBlocks > numCombinedUniformBlocks)
 			CM_EXCEPT(InternalErrorException, "Number of combined uniform block buffers less than the number of individual per-stage buffers!?");
@@ -1769,7 +1742,6 @@ namespace BansheeEngine
 	{
 		RenderSystemCapabilities* rsc = cm_new<RenderSystemCapabilities>();
 
-		rsc->setCategoryRelevant(CAPS_CATEGORY_GL, true);
 		rsc->setDriverVersion(mDriverVersion);
 		const char* deviceName = (const char*)glGetString(GL_RENDERER);
 		const char* vendorName = (const char*)glGetString(GL_VENDOR);
@@ -1794,27 +1766,12 @@ namespace BansheeEngine
 			rsc->setCapability(RSC_AUTOMIPMAP);
 		}
 
-		// Check for blending support
-		if(GLEW_VERSION_1_3 || getGLSupport()->checkExtension("GL_ARB_texture_env_combine") 
-			|| getGLSupport()->checkExtension("GL_EXT_texture_env_combine"))
-		{
-			rsc->setCapability(RSC_BLENDING);
-		}
-
 		// Check for Anisotropy support
 		if (getGLSupport()->checkExtension("GL_EXT_texture_filter_anisotropic"))
 		{
 			rsc->setCapability(RSC_ANISOTROPY);
 		}
 
-		// Check for DOT3 support
-		if(GLEW_VERSION_1_3 ||
-			getGLSupport()->checkExtension("GL_ARB_texture_env_dot3") ||
-			getGLSupport()->checkExtension("GL_EXT_texture_env_dot3"))
-		{
-			rsc->setCapability(RSC_DOT3);
-		}
-
 		// Check for cube mapping
 		if(GLEW_VERSION_1_3 || 
 			getGLSupport()->checkExtension("GL_ARB_texture_cube_map") ||
@@ -1835,18 +1792,9 @@ namespace BansheeEngine
 
 		if(stencil)
 		{
-			rsc->setCapability(RSC_HWSTENCIL);
 			rsc->setStencilBufferBitDepth(stencil);
 		}
 
-		if (GLEW_VERSION_1_5 || getGLSupport()->checkExtension("GL_ARB_vertex_buffer_object"))
-		{
-			rsc->setCapability(RSC_VBO);
-		}
-
-		rsc->setCapability(RSC_VERTEX_PROGRAM);
-		rsc->setCapability(RSC_FRAGMENT_PROGRAM);
-
 		if (GLEW_VERSION_2_0 || 
 			(getGLSupport()->checkExtension("GL_ARB_shading_language_100") &&
 			getGLSupport()->checkExtension("GL_ARB_shader_objects") &&
@@ -1898,8 +1846,6 @@ namespace BansheeEngine
 			}
 		}
 
-		// Scissor test is standard in GL 1.2 (is it emulated on some cards though?)
-		rsc->setCapability(RSC_SCISSOR_TEST);
 		// As are user clipping planes
 		rsc->setCapability(RSC_USER_CLIP_PLANES);
 
@@ -1953,15 +1899,7 @@ namespace BansheeEngine
 				glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &buffers);
 				rsc->setNumMultiRenderTargets(std::min<int>(buffers, (GLint)CM_MAX_MULTIPLE_RENDER_TARGETS));
 				rsc->setCapability(RSC_MRT_DIFFERENT_BIT_DEPTHS);
-				if(!GLEW_VERSION_2_0)
-				{
-					// Before GL version 2.0, we need to get one of the extensions
-					if (getGLSupport()->checkExtension("GL_ARB_draw_buffers"))
-						rsc->setCapability(RSC_FBO_ARB);
-					if (getGLSupport()->checkExtension("GL_ATI_draw_buffers"))
-						rsc->setCapability(RSC_FBO_ATI);
-				}
-				// Set FBO flag for all 3 'subtypes'
+
 				rsc->setCapability(RSC_FBO);
 
 			}
@@ -1992,10 +1930,10 @@ namespace BansheeEngine
 
 		GLint numUniformBlocks;
 		glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &numUniformBlocks);
-		rsc->setNumUniformBlockBuffers(GPT_VERTEX_PROGRAM, numUniformBlocks);
+		rsc->setNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM, numUniformBlocks);
 
 		glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &numUniformBlocks);
-		rsc->setNumUniformBlockBuffers(GPT_FRAGMENT_PROGRAM, numUniformBlocks);
+		rsc->setNumGpuParamBlockBuffers(GPT_FRAGMENT_PROGRAM, numUniformBlocks);
 
 		if (mGLSupport->checkExtension("GL_ARB_geometry_shader4"))
 		{
@@ -2004,7 +1942,7 @@ namespace BansheeEngine
 			rsc->setNumTextureUnits(GPT_GEOMETRY_PROGRAM, static_cast<UINT16>(geomUnits));
 
 			glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, &numUniformBlocks);
-			rsc->setNumUniformBlockBuffers(GPT_GEOMETRY_PROGRAM, numUniformBlocks);
+			rsc->setNumGpuParamBlockBuffers(GPT_GEOMETRY_PROGRAM, numUniformBlocks);
 		}
 
 		if (mGLSupport->checkExtension("GL_ARB_tessellation_shader"))
@@ -2012,10 +1950,10 @@ namespace BansheeEngine
 			rsc->setCapability(RSC_TESSELLATION_PROGRAM);
 
 			glGetIntegerv(GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS, &numUniformBlocks);
-			rsc->setNumUniformBlockBuffers(GPT_HULL_PROGRAM, numUniformBlocks);
+			rsc->setNumGpuParamBlockBuffers(GPT_HULL_PROGRAM, numUniformBlocks);
 
 			glGetIntegerv(GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS, &numUniformBlocks);
-			rsc->setNumUniformBlockBuffers(GPT_DOMAIN_PROGRAM, numUniformBlocks);
+			rsc->setNumGpuParamBlockBuffers(GPT_DOMAIN_PROGRAM, numUniformBlocks);
 		}
 
 		if (mGLSupport->checkExtension("GL_ARB_compute_shader")) 
@@ -2027,7 +1965,7 @@ namespace BansheeEngine
 			rsc->setNumTextureUnits(GPT_COMPUTE_PROGRAM, static_cast<UINT16>(computeUnits));
 
 			glGetIntegerv(GL_MAX_COMPUTE_UNIFORM_BLOCKS, &numUniformBlocks);
-			rsc->setNumUniformBlockBuffers(GPT_COMPUTE_PROGRAM, numUniformBlocks);
+			rsc->setNumGpuParamBlockBuffers(GPT_COMPUTE_PROGRAM, numUniformBlocks);
 		}
 
 		GLint combinedTexUnits;
@@ -2036,7 +1974,7 @@ namespace BansheeEngine
 
 		GLint combinedUniformBlockUnits;
 		glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &combinedUniformBlockUnits);
-		rsc->setNumCombinedUniformBlockBuffers(static_cast<UINT16>(combinedUniformBlockUnits));
+		rsc->setNumCombinedGpuParamBlockBuffers(static_cast<UINT16>(combinedUniformBlockUnits));
 
 		// Mipmap LOD biasing
 

+ 8 - 0
Polish.txt

@@ -0,0 +1,8 @@
+
+
+There's still a crash regarding an uninitialized mCachedPtr on a C# class when shutting down. Attempt to find consistent repro steps.
+
+Finish GPUProfiler:
+ - Actually implement sampling and report generation
+ - Add timer and occlusion queries
+ - Resource writes/reads/creation/destruction is not currently increased in RenderStats

+ 0 - 9
SBansheeEngine/Source/BsScriptObject.cpp

@@ -16,17 +16,8 @@ namespace BansheeEngine
 			CM_EXCEPT(InvalidStateException, "Script object is being destroyed without its instance previously being released.");
 	}
 
-	static Vector<UINT64> dbgList;
 	void ScriptObjectBase::_onManagedInstanceDeleted()
 	{
-		auto iterFind = std::find(dbgList.begin(), dbgList.end(), (UINT64)this);
-		if (iterFind != dbgList.end())
-		{
-			assert(false);
-		}
-
-		dbgList.push_back((UINT64)this);
-
 		mManagedInstance = nullptr;
 		cm_delete(this);
 	}

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff