Browse Source

Removed some unused stuff
Updated and cleaned up TODO

Marko Pintera 13 years ago
parent
commit
6193cd16a6

+ 7 - 13
CamelotForwardRenderer/Source/CmForwardRenderer.cpp

@@ -8,7 +8,6 @@
 #include "CmMesh.h"
 #include "CmPass.h"
 #include "CmApplication.h"
-#include "CmDeferredRenderSystem.h"
 
 namespace CamelotEngine
 {
@@ -29,9 +28,7 @@ namespace CamelotEngine
 	{
 		return; // TODO - Temporarily I don't want to run this
 
-		DeferredRenderSystemPtr renderSystem = gApplication().getActiveRenderSystem();
-		
-		//RenderSystem* renderSystem = RenderSystemManager::getActive();
+		RenderSystem* renderSystem = RenderSystemManager::getActive();
 
 		// TODO - No point in setting these each frame?
 		renderSystem->setInvertVertexWinding(false);
@@ -50,8 +47,7 @@ namespace CamelotEngine
 	{
 		vector<RenderablePtr>::type allRenderables = gSceneManager().getVisibleRenderables(camera);
 
-		DeferredRenderSystemPtr renderSystem = gApplication().getActiveRenderSystem();
-		//RenderSystem* renderSystem = RenderSystemManager::getActive();
+		RenderSystem* renderSystem = RenderSystemManager::getActive();
 		renderSystem->setViewport(*camera->getViewport());
 
 		Matrix4 projMatrixCstm = camera->getProjectionMatrix();
@@ -102,8 +98,7 @@ namespace CamelotEngine
 
 		mActivePass = pass;
 
-		DeferredRenderSystemPtr renderSystem = gApplication().getActiveRenderSystem();
-		//RenderSystem* renderSystem = RenderSystemManager::getActive();
+		RenderSystem* renderSystem = RenderSystemManager::getActive();
 
 		GpuProgramRef vertProgram = pass->getVertexProgram();
 		if(vertProgram)
@@ -207,22 +202,21 @@ namespace CamelotEngine
 	void ForwardRenderer::setPassParameters(PassParametersPtr params)
 	{
 		// TODO - When applying passes, don't re-apply states that are already the same as from previous pass.
-		DeferredRenderSystemPtr renderSystem = gApplication().getActiveRenderSystem();
-		//RenderSystem* renderSystem = RenderSystemManager::getActive();
+		RenderSystem* renderSystem = RenderSystemManager::getActive();
 
 		if(mActivePass == nullptr)
 			CM_EXCEPT(InternalErrorException, "Trying to set pass parameters, but no pass is set.");
 
 		GpuProgramRef vertProgram = mActivePass->getVertexProgram();
 		if(vertProgram)
-			renderSystem->bindGpuProgramParameters(GPT_VERTEX_PROGRAM, params->mVertParams);
+			renderSystem->bindGpuProgramParameters(GPT_VERTEX_PROGRAM, params->mVertParams, GPV_ALL);
 
 		GpuProgramRef fragProgram = mActivePass->getFragmentProgram();
 		if(fragProgram)
-			renderSystem->bindGpuProgramParameters(GPT_FRAGMENT_PROGRAM, params->mFragParams);
+			renderSystem->bindGpuProgramParameters(GPT_FRAGMENT_PROGRAM, params->mFragParams, GPV_ALL);
 
 		GpuProgramRef geomProgram = mActivePass->getGeometryProgram();
 		if(geomProgram)
-			renderSystem->bindGpuProgramParameters(GPT_GEOMETRY_PROGRAM, params->mGeomParams);
+			renderSystem->bindGpuProgramParameters(GPT_GEOMETRY_PROGRAM, params->mGeomParams, GPV_ALL);
 	}
 }

+ 0 - 4
CamelotRenderer/CamelotRenderer.vcxproj

@@ -95,8 +95,6 @@
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\CmApplication.h" />
-    <ClInclude Include="Include\CmDeferredGpuCommands.h" />
-    <ClInclude Include="Include\CmDeferredRenderSystem.h" />
     <ClInclude Include="Include\CmCamera.h" />
     <ClInclude Include="Include\CmCameraRTTI.h" />
     <ClInclude Include="Include\CmCgProgram.h" />
@@ -178,7 +176,6 @@
     <ClCompile Include="Source\CmCgProgram.cpp" />
     <ClCompile Include="Source\CmCgProgramFactory.cpp" />
     <ClCompile Include="Source\CmDefaultHardwareBufferManager.cpp" />
-    <ClCompile Include="Source\CmDeferredGpuCommands.cpp" />
     <ClCompile Include="Source\CmGpuProgram.cpp" />
     <ClCompile Include="Source\CmGpuProgramManager.cpp" />
     <ClCompile Include="Source\CmGpuProgramParams.cpp" />
@@ -219,7 +216,6 @@
     <ClCompile Include="Source\CmWindowEventUtilities.cpp" />
     <ClCompile Include="Source\CmGameObject.cpp" />
     <ClCompile Include="Source\CmComponent.cpp" />
-    <ClCompile Include="Source\CmDeferredRenderSystem.cpp" />
     <ClCompile Include="Source\stdafx.cpp" />
     <ClCompile Include="Source\Win32\CmOSCursorImpl.cpp" />
   </ItemGroup>

+ 0 - 12
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -307,12 +307,6 @@
     <ClInclude Include="Include\CmRenderOperation.h">
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
-    <ClInclude Include="Include\CmDeferredRenderSystem.h">
-      <Filter>Header Files\RenderSystem</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\CmDeferredGpuCommands.h">
-      <Filter>Header Files\RenderSystem</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmRenderSystemContext.h">
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
@@ -459,12 +453,6 @@
     <ClCompile Include="Source\CmSamplerState.cpp">
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>
-    <ClCompile Include="Source\CmDeferredRenderSystem.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
-    </ClCompile>
-    <ClCompile Include="Source\CmDeferredGpuCommands.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
-    </ClCompile>
     <ClCompile Include="Source\CmRenderSystemContext.cpp">
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>

+ 0 - 3
CamelotRenderer/Include/CmApplication.h

@@ -26,8 +26,6 @@ namespace CamelotEngine
 
 			RenderWindow* getPrimaryRenderWindow() const { return mPrimaryRenderWindow; }
 
-			DeferredRenderSystemPtr getActiveRenderSystem() const { return mPrimaryDeferredRenderSystem; }
-
 			/**
 			 * @brief	Loads a plugin.
 			 *
@@ -37,7 +35,6 @@ namespace CamelotEngine
 
 	private:
 		RenderWindow* mPrimaryRenderWindow;
-		DeferredRenderSystemPtr mPrimaryDeferredRenderSystem;
 
 		/**
 		 * @brief	Callback called from the render thread in order to initialize resources.

+ 0 - 455
CamelotRenderer/Include/CmDeferredGpuCommands.h

@@ -1,455 +0,0 @@
-#pragma once
-
-#include "CmPrerequisites.h"
-#include "CmRenderSystem.h"
-
-namespace CamelotEngine
-{
-	class CM_EXPORT DeferredGpuCommand
-	{
-	public:
-		DeferredGpuCommand();
-
-		virtual void submitCommand(RenderSystem* rs) = 0;
-	};
-
-	class CM_EXPORT DfrdRSStartUpCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdRSStartUpCommand();
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdRenderGpuCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdRenderGpuCommand(RenderOperation& _renderOp);
-
-		RenderOperation renderOp;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdBindGpuProgramCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdBindGpuProgramCommand(GpuProgramRef _gpuProgram);
-
-		GpuProgramRef gpuProgram;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdUnbindGpuProgramCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdUnbindGpuProgramCommand(GpuProgramType _type);
-
-		GpuProgramType type;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdBindGpuParamsCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdBindGpuParamsCommand(GpuProgramType _type, GpuProgramParametersPtr& _progParams);
-
-		GpuProgramType type;
-		GpuProgramParametersPtr progParams;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdInvVertWindingCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdInvVertWindingCommand(bool _invert);
-
-		bool invert;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdScissorTestCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdScissorTestCommand(bool _enabled, size_t _left, size_t _top, size_t _right, size_t _bottom);
-
-		bool enabled;
-		size_t left;
-		size_t top;
-		size_t right;
-		size_t bottom;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdStencilBufferParamsCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdStencilBufferParamsCommand(CompareFunction _func, UINT32 _refValue, UINT32 _mask, 
-			StencilOperation _stencilFailOp, StencilOperation _depthFailOp, 
-			StencilOperation _passOp, bool _twoSidedOperation);
-
-		CompareFunction func;
-		UINT32 refValue;
-		UINT32 mask; 
-		StencilOperation stencilFailOp;
-		StencilOperation depthFailOp;
-		StencilOperation passOp;
-		bool twoSidedOperation;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	// TODO !
-	class CM_EXPORT DfrdVertexDeclCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdVertexDeclCommand();
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	// TODO !
-	class CM_EXPORT DfrdVertBufferBindCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdVertBufferBindCommand();
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdPolygonModeCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdPolygonModeCommand(PolygonMode _level);
-
-		PolygonMode mode;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdStencilCheckCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdStencilCheckCommand(bool _enabled);
-
-		bool enabled;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdWaitForVerticalBlankCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdWaitForVerticalBlankCommand(bool _enabled);
-
-		bool enabled;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureUnitSettingsCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureUnitSettingsCommand(size_t _texUnit, const TexturePtr& _tex, 
-			const SamplerState& _samplerState);
-
-		size_t texUnit;
-		TexturePtr tex;
-		SamplerState samplerState;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdPointParamsCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdPointParamsCommand(float _size, bool _attenuationEnabled, 
-			float _constant, float _linear, float _quadratic, float _minSize, float _maxSize);
-
-		float size; 
-		bool attenuationEnabled; 
-		float constant; 
-		float linear; 
-		float quadratic; 
-		float minSize; 
-		float maxSize;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureCommand(size_t _texUnit, bool _enabled, const TexturePtr& _tex);
-
-		size_t texUnit;
-		bool enabled;
-		const TexturePtr &tex;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdVertexTextureCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdVertexTextureCommand(size_t _texUnit, const TexturePtr& _tex);
-
-		size_t texUnit;
-		const TexturePtr& tex;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureFilteringCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureFilteringCommand(size_t _texUnit, FilterType _ftype, FilterOptions _filter);
-
-		size_t texUnit;
-		FilterType ftype;
-		FilterOptions filter;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureAnisotropyCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureAnisotropyCommand(size_t _texUnit, unsigned int _maxAnisotropy);
-
-		size_t texUnit;
-		unsigned int maxAnisotropy;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureAddrModeCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureAddrModeCommand(size_t _texUnit, const SamplerState::UVWAddressingMode& _uvw);
-
-		size_t texUnit;
-		SamplerState::UVWAddressingMode uvw;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureBorderColorCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureBorderColorCommand(size_t _texUnit, const Color& _color);
-
-		size_t texUnit;
-		Color color;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdTextureMipBiasCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdTextureMipBiasCommand(size_t _texUnit, float _bias);
-
-		size_t texUnit;
-		float bias;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdSceneBlendingCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdSceneBlendingCommand(SceneBlendFactor _sourceFactor, 
-			SceneBlendFactor _destFactor, SceneBlendOperation _op);
-
-		SceneBlendFactor sourceFactor;
-		SceneBlendFactor destFactor;
-		SceneBlendOperation op;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdSeparateSceneBlendingCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdSeparateSceneBlendingCommand(SceneBlendFactor _sourceFactor, 
-			SceneBlendFactor _destFactor, SceneBlendFactor _sourceFactorAlpha, 
-			SceneBlendFactor _destFactorAlpha, SceneBlendOperation _op, 
-			SceneBlendOperation _alphaOp);
-
-		SceneBlendFactor sourceFactor;
-		SceneBlendFactor destFactor;
-		SceneBlendFactor sourceFactorAlpha;
-		SceneBlendFactor destFactorAlpha;
-		SceneBlendOperation op;
-		SceneBlendOperation alphaOp;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdAlphaRejectParamsCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdAlphaRejectParamsCommand(CompareFunction _func, 
-			unsigned char _value, bool _alphaToCoverage);
-
-		CompareFunction func;
-		unsigned char value;
-		bool alphaToCoverage;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	// TODO
-	class CM_EXPORT DfrdViewportCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdViewportCommand(const Viewport& _vp);
-
-		Viewport vp;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdCullingCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdCullingCommand(CullingMode _mode);
-
-		CullingMode mode;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDepthBufferParamsCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDepthBufferParamsCommand(bool _depthTest, bool _depthWrite, 
-			CompareFunction _depthFunction);
-
-		bool depthTest;
-		bool depthWrite;
-		CompareFunction depthFunction;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDepthBufferCheckCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDepthBufferCheckCommand(bool _enabled);
-
-		bool enabled;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDepthBufferWriteCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDepthBufferWriteCommand(bool _enabled);
-
-		bool enabled;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDepthBufferFuncCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDepthBufferFuncCommand(CompareFunction _func);
-
-		CompareFunction func;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDepthBiasCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDepthBiasCommand(float _constantBias, float _slopeScaleBias);
-
-		float constantBias;
-		float slopeScaleBias;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdColorBufferWriteCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdColorBufferWriteCommand(bool _red, bool _green, bool _blue, bool _alpha);
-
-		bool red;
-		bool green;
-		bool blue;
-		bool alpha;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDisableTextureUnitCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDisableTextureUnitCommand(size_t _texUnit);
-
-		size_t texUnit;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdDisableTextureUnitsFromCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdDisableTextureUnitsFromCommand(size_t _texUnit);
-
-		size_t texUnit;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdBeginFrameCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdBeginFrameCommand();
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdEndFrameCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdEndFrameCommand();
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdClearFrameBufferCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdClearFrameBufferCommand(unsigned int _buffers, 
-			const Color& _color, float _depth, unsigned short _stencil);
-
-		unsigned int buffers;
-		Color color;
-		float depth;
-		unsigned short stencil;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-
-	class CM_EXPORT DfrdSwapAllRenderTargetBuffersCommand : public DeferredGpuCommand
-	{
-	public:
-		DfrdSwapAllRenderTargetBuffersCommand(bool _waitForVsync);
-
-		bool waitForVsync;
-
-		virtual void submitCommand(RenderSystem* rs);
-	};
-}

+ 0 - 345
CamelotRenderer/Include/CmDeferredRenderSystem.h

@@ -1,345 +0,0 @@
-#pragma once
-
-#include "CmPrerequisites.h"
-#include "CmRenderSystem.h"
-#include <boost/function.hpp>
-
-namespace CamelotEngine
-{
-	// TODO Low priority - We have too many allocations for RenderCommands in this class. Maybe pool the commands somewhere?
-
-	class CM_EXPORT DeferredRenderSystem
-	{
-	public:
-		~DeferredRenderSystem();
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::render()
-		 */
-		void render(const RenderOperation& op);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::bindGpuProgram()
-		 */
-		void bindGpuProgram(GpuProgramRef prg);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::unbindGpuProgram()
-		 */
-		void unbindGpuProgram(GpuProgramType gptype);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::bindGpuProgramParameters()
-		 */
-		void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params);
-				
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::bindGpuProgramParameters()
-		 */
-		void setInvertVertexWinding(bool invert);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setScissorTest()
-		 */
-		void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, 
-			size_t right = 1280, size_t bottom = 720);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setStencilBufferParams()
-		 */
-		void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
-			UINT32 refValue = 0, UINT32 mask = 0xFFFFFFFF, 
-			StencilOperation stencilFailOp = SOP_KEEP, 
-			StencilOperation depthFailOp = SOP_KEEP,
-			StencilOperation passOp = SOP_KEEP, 
-			bool twoSidedOperation = false);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setVertexDeclaration()
-		 */
-		void setVertexDeclaration(VertexDeclarationPtr decl);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setVertexBufferBinding()
-		 */
-		void setVertexBufferBinding(VertexBufferBinding* binding);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setPolygonMode()
-		 */
-		void setPolygonMode(PolygonMode mode);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setStencilCheckEnabled()
-		 */
-		void setStencilCheckEnabled(bool enabled);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setWaitForVerticalBlank()
-		 */
-		void setWaitForVerticalBlank(bool enabled);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureUnitSettings()
-		 */
-		void setTextureUnitSettings(size_t texUnit, const TexturePtr& texture, const SamplerState& samplerState);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setPointParameters()
-		 */
-		void setPointParameters(float size, bool attenuationEnabled, 
-			float constant, float linear, float quadratic, float minSize, float maxSize);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTexture()
-		 */
-		void setTexture(size_t unit, bool enabled, const TexturePtr &texPtr);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setVertexTexture()
-		 */
-		void setVertexTexture(size_t unit, const TexturePtr& tex);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureUnitFiltering()
-		 */
-		void setTextureFiltering(size_t unit, FilterOptions minFilter,
-			FilterOptions magFilter, FilterOptions mipFilter);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureFiltering()
-		 */
-		void setTextureFiltering(size_t unit, FilterType ftype, FilterOptions filter);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureAnisotropy()
-		 */
-		void setTextureAnisotropy(size_t unit, unsigned int maxAnisotropy);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureAddressingMode()
-		 */
-		void setTextureAddressingMode(size_t unit, const SamplerState::UVWAddressingMode& uvw);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureBorderColor()
-		 */
-		void setTextureBorderColor(size_t unit, const Color& color);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setTextureMipmapBias()
-		 */
-		void setTextureMipmapBias(size_t unit, float bias);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setSceneBlending()
-		 */
-		void setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op = SBO_ADD);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setSeparateSceneBlending()
-		 */
-		void setSeparateSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
-			SceneBlendFactor destFactorAlpha, SceneBlendOperation op = SBO_ADD, SceneBlendOperation alphaOp = SBO_ADD);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setAlphaRejectSettings()
-		 */
-		void setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setViewport()
-		 */
-		void setViewport(const Viewport& vp);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setCullingMode()
-		 */
-		void setCullingMode(CullingMode mode);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setDepthBufferParams()
-		 */
-		void setDepthBufferParams(bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setDepthBufferCheckEnabled()
-		 */
-		void setDepthBufferCheckEnabled(bool enabled = true);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setDepthBufferWriteEnabled()
-		 */
-		void setDepthBufferWriteEnabled(bool enabled = true);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setDepthBufferFunction()
-		 */
-		void setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setDepthBias()
-		 */
-		void setDepthBias(float constantBias, float slopeScaleBias = 0.0f);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::setColorBufferWriteEnabled()
-		 */
-		void setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::disableTextureUnit()
-		 */
-		void disableTextureUnit(size_t texUnit);
-		
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::disableTextureUnitsFrom()
-		 */
-		void disableTextureUnitsFrom(size_t texUnit);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::beginFrame()
-		 */
-		void beginFrame(void);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::endFrame()
-		 */
-		void endFrame(void);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::clearFrameBuffer()
-		 */
-		void clearFrameBuffer(unsigned int buffers, 
-			const Color& colour = Color::Black, 
-			float depth = 1.0f, unsigned short stencil = 0);
-
-		/**
-		 * @brief	Wrapper around RenderSystem method of the same name. See RenderSystem doc.
-		 * 			
-		 * @see		RenderSystem::swapAllRenderTargetBuffers()
-		 */
-		void swapAllRenderTargetBuffers(bool waitForVsync = true);
-
-	private:
-		// Actively being filled up
-		vector<DeferredGpuCommand*>::type* mActiveRenderCommandBuffer;
-
-		// Finalized and ready for rendering
-		vector<DeferredGpuCommand*>::type* mReadyRenderCommandBuffer;
-
-		bool mIsShutdown;
-
-		CM_THREAD_ID_TYPE mMyThreadId;
-		CM_MUTEX(mCommandBufferMutex)
-
-		/**
-		 * @brief	Throw an exception if the current thread is not the original
-		 * 			thread the DeferredRenderSystem was started on.
-		 */
-		void throwIfInvalidThread();
-
-		/************************************************************************/
-		/* 					CALLABLE ONLY FROM RENDERSYSTEM                     */
-		/************************************************************************/
-		friend class RenderSystem;
-
-		DeferredRenderSystem(CM_THREAD_ID_TYPE threadId);
-
-		/**
-		 * @brief	Plays all queued commands. Should only be called from the render thread,
-		 * 			and is normally called by the RenderSystem internally.
-		 */
-		void playbackCommands();
-
-		/**
-		 * @brief	Query if this object has any commands ready for rendering.
-		 */
-		bool hasReadyCommands();
-
-		/**
-		 * @brief	Makes all the currently queued commands available to the GPU. They will be executed
-		 * 			as soon as the render thread is ready.
-		 * 			
-		 * @note	This is expected to be called once per frame. If the previous set of commands hasn't even started rendering
-		 * 			yet, it will be discarded. This is to prevent lag if the simulation executes faster than the render thread.
-		 */
-		void submitToGpu();
-	};
-}

+ 0 - 3
CamelotRenderer/Include/CmPrerequisites.h

@@ -105,8 +105,6 @@ namespace CamelotEngine {
 	class RenderCommandBuffer;
 	class WorkQueue;
 	class PassParameters;
-	class DeferredRenderSystem;
-	class DeferredGpuCommand;
 	class RenderSystemContext;
 	class AsyncOp;
 	// Asset import
@@ -146,7 +144,6 @@ namespace CamelotEngine
 	typedef std::shared_ptr<RendererFactory> RendererFactoryPtr;
 	typedef std::shared_ptr<WorkQueue> WorkQueuePtr;
 	typedef std::shared_ptr<PassParameters> PassParametersPtr;
-	typedef std::shared_ptr<DeferredRenderSystem> DeferredRenderSystemPtr;
 	typedef std::shared_ptr<RenderSystemContext> RenderSystemContextPtr;
 
 	typedef std::shared_ptr<Component> ComponentPtr;

+ 0 - 3
CamelotRenderer/Source/CmApplication.cpp

@@ -51,9 +51,6 @@ namespace CamelotEngine
 		RenderSystem* renderSystem = RenderSystemManager::getActive();
 		renderSystem->startUp();
 
-		//mPrimaryDeferredRenderSystem = renderSystem->createRenderSystemContext();
-		mPrimaryDeferredRenderSystem = nullptr;
-
 		mPrimaryRenderWindow = renderSystem->createRenderWindow("Camelot Renderer", 1280, 720, false);
 
 		SceneManager::startUp(new SceneManager());

+ 0 - 370
CamelotRenderer/Source/CmDeferredGpuCommands.cpp

@@ -1,370 +0,0 @@
-#include "CmDeferredGpuCommands.h"
-#include "CmRenderSystem.h"
-
-namespace CamelotEngine
-{
-	DeferredGpuCommand::DeferredGpuCommand()
-	{ }
-
-	DfrdRSStartUpCommand::DfrdRSStartUpCommand()
-	{ }
-
-	void DfrdRSStartUpCommand::submitCommand(RenderSystem* rs)
-	{
-		//rs->startUp_internal();
-	}
-
-	DfrdRenderGpuCommand::DfrdRenderGpuCommand(RenderOperation& _renderOp)
-		:renderOp(_renderOp)
-	{ }
-
-	void DfrdRenderGpuCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->render(renderOp);
-	}
-
-	DfrdBindGpuProgramCommand::DfrdBindGpuProgramCommand(GpuProgramRef _gpuProgram)
-		:gpuProgram(_gpuProgram)
-	{ }
-
-	void DfrdBindGpuProgramCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->bindGpuProgram(gpuProgram);
-	}
-
-	DfrdUnbindGpuProgramCommand::DfrdUnbindGpuProgramCommand(GpuProgramType _type)
-		:type(_type)
-	{ }
-
-	void DfrdUnbindGpuProgramCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->unbindGpuProgram(type);
-	}
-
-	DfrdBindGpuParamsCommand::DfrdBindGpuParamsCommand(GpuProgramType _type, GpuProgramParametersPtr& _progParams)
-		:type(_type), progParams(_progParams)
-	{ }
-
-	void DfrdBindGpuParamsCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->bindGpuProgramParameters(type, progParams, GPV_ALL);
-	}
-
-	DfrdInvVertWindingCommand::DfrdInvVertWindingCommand(bool _invert)
-		:invert(_invert)
-	{ }
-
-	void DfrdInvVertWindingCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setInvertVertexWinding(invert);
-	}
-
-	DfrdScissorTestCommand::DfrdScissorTestCommand(bool _enabled, size_t _left, size_t _top, size_t _right, size_t _bottom)
-		:enabled(_enabled), left(_left), top(_top), right(_right), bottom(_bottom)
-	{ }
-
-	void DfrdScissorTestCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setScissorTest(enabled, left, top, right, bottom);
-	}
-
-	DfrdStencilBufferParamsCommand::DfrdStencilBufferParamsCommand(CompareFunction _func, UINT32 _refValue, UINT32 _mask, 
-		StencilOperation _stencilFailOp, StencilOperation _depthFailOp, 
-		StencilOperation _passOp, bool _twoSidedOperation)
-		:func(_func), refValue(_refValue), mask(_mask), stencilFailOp(_stencilFailOp), depthFailOp(_depthFailOp),
-		passOp(_passOp), twoSidedOperation(_twoSidedOperation)
-	{ }
-
-	void DfrdStencilBufferParamsCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setStencilBufferParams(func, refValue, mask, stencilFailOp, depthFailOp, passOp, twoSidedOperation);
-	}
-
-// TODO !
-	DfrdVertexDeclCommand::DfrdVertexDeclCommand()
-	{ }
-
-	void DfrdVertexDeclCommand::submitCommand(RenderSystem* rs)
-	{
-
-	}
-
-// TODO !
-	DfrdVertBufferBindCommand::DfrdVertBufferBindCommand()
-	{ }
-
-	void DfrdVertBufferBindCommand::submitCommand(RenderSystem* rs)
-	{
-
-	}
-
-	DfrdPolygonModeCommand::DfrdPolygonModeCommand(PolygonMode _mode)
-		:mode(_mode)
-	{ }
-
-	void DfrdPolygonModeCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setPolygonMode(mode);
-	}
-
-	DfrdStencilCheckCommand::DfrdStencilCheckCommand(bool _enabled)
-		:enabled(_enabled)
-	{ }
-
-	void DfrdStencilCheckCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setStencilCheckEnabled(enabled);
-	}
-
-	DfrdWaitForVerticalBlankCommand::DfrdWaitForVerticalBlankCommand(bool _enabled)
-		:enabled(_enabled)
-	{ }
-
-	void DfrdWaitForVerticalBlankCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setWaitForVerticalBlank(enabled);
-	}
-
-	DfrdTextureUnitSettingsCommand::DfrdTextureUnitSettingsCommand(size_t _texUnit, const TexturePtr& _tex, 
-		const SamplerState& _samplerState)
-		:texUnit(_texUnit), tex(_tex), samplerState(_samplerState)
-	{ }
-
-	void DfrdTextureUnitSettingsCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTextureUnitSettings(texUnit, tex, samplerState);
-	}
-
-	DfrdPointParamsCommand::DfrdPointParamsCommand(float _size, bool _attenuationEnabled, 
-		float _constant, float _linear, float _quadratic, float _minSize, float _maxSize)
-		:size(_size), attenuationEnabled(_attenuationEnabled), constant(_constant), linear(_linear),
-		quadratic(_quadratic), minSize(_minSize), maxSize(_maxSize)
-	{ }
-
-	void DfrdPointParamsCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setPointParameters(size, attenuationEnabled, constant, linear, quadratic, minSize, maxSize);
-	}
-
-	DfrdTextureCommand::DfrdTextureCommand(size_t _texUnit, bool _enabled, const TexturePtr& _tex)
-		:texUnit(_texUnit), enabled(_enabled), tex(_tex)
-	{ }
-
-	void DfrdTextureCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTexture(texUnit, enabled, tex);
-	}
-
-	DfrdVertexTextureCommand::DfrdVertexTextureCommand(size_t _texUnit, const TexturePtr& _tex)
-		:texUnit(_texUnit), tex(_tex)
-	{ }
-
-	void DfrdVertexTextureCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setVertexTexture(texUnit, tex);
-	}
-
-	DfrdTextureFilteringCommand::DfrdTextureFilteringCommand(size_t _texUnit, FilterType _ftype, FilterOptions _filter)
-		:texUnit(_texUnit), ftype(_ftype), filter(_filter)
-	{ }
-
-	void DfrdTextureFilteringCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTextureFiltering(texUnit, ftype, filter);
-	}
-
-	DfrdTextureAnisotropyCommand::DfrdTextureAnisotropyCommand(size_t _texUnit, unsigned int _maxAnisotropy)
-		:texUnit(_texUnit), maxAnisotropy(_maxAnisotropy)
-	{ }
-
-	void DfrdTextureAnisotropyCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTextureAnisotropy(texUnit, maxAnisotropy);
-	}
-
-	DfrdTextureAddrModeCommand::DfrdTextureAddrModeCommand(size_t _texUnit, const SamplerState::UVWAddressingMode& _uvw)
-		:texUnit(_texUnit), uvw(_uvw)
-	{ }
-
-	void DfrdTextureAddrModeCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTextureAddressingMode(texUnit, uvw);
-	}
-
-	DfrdTextureBorderColorCommand::DfrdTextureBorderColorCommand(size_t _texUnit, const Color& _color)
-		:texUnit(_texUnit), color(_color)
-	{ }
-
-	void DfrdTextureBorderColorCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTextureBorderColor(texUnit, color);
-	}
-
-	DfrdTextureMipBiasCommand::DfrdTextureMipBiasCommand(size_t _texUnit, float _bias)
-		:texUnit(_texUnit), bias(_bias)
-	{ }
-
-	void DfrdTextureMipBiasCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setTextureMipmapBias(texUnit, bias);
-	}
-
-	DfrdSceneBlendingCommand::DfrdSceneBlendingCommand(SceneBlendFactor _sourceFactor, 
-		SceneBlendFactor _destFactor, SceneBlendOperation _op)
-		:sourceFactor(_sourceFactor), destFactor(_destFactor), op(_op)
-	{ }
-
-	void DfrdSceneBlendingCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setSceneBlending(sourceFactor, destFactor, op);
-	}
-
-	DfrdSeparateSceneBlendingCommand::DfrdSeparateSceneBlendingCommand(SceneBlendFactor _sourceFactor, 
-		SceneBlendFactor _destFactor, SceneBlendFactor _sourceFactorAlpha, 
-		SceneBlendFactor _destFactorAlpha, SceneBlendOperation _op, 
-		SceneBlendOperation _alphaOp)
-		:sourceFactor(_sourceFactor), destFactor(_destFactor), sourceFactorAlpha(_sourceFactorAlpha),
-		destFactorAlpha(_destFactorAlpha), op(_op), alphaOp(_alphaOp)
-	{ }
-
-	void DfrdSeparateSceneBlendingCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setSeparateSceneBlending(sourceFactor, destFactor, sourceFactorAlpha, destFactorAlpha, op, alphaOp);
-	}
-
-	DfrdAlphaRejectParamsCommand::DfrdAlphaRejectParamsCommand(CompareFunction _func, 
-		unsigned char _value, bool _alphaToCoverage)
-		:func(_func), value(_value), alphaToCoverage(_alphaToCoverage)
-	{ }
-
-	void DfrdAlphaRejectParamsCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setAlphaRejectSettings(func, value, alphaToCoverage);
-	}
-
-	DfrdViewportCommand::DfrdViewportCommand(const Viewport& _vp)
-		:vp(_vp)
-	{ }
-
-	void DfrdViewportCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setViewport(vp);
-	}
-
-	DfrdCullingCommand::DfrdCullingCommand(CullingMode _mode)
-		:mode(_mode)
-	{ }
-
-	void DfrdCullingCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setCullingMode(mode);
-	}
-
-	DfrdDepthBufferParamsCommand::DfrdDepthBufferParamsCommand(bool _depthTest, bool _depthWrite, 
-		CompareFunction _depthFunction)
-		:depthTest(_depthTest)
-	{ }
-
-	void DfrdDepthBufferParamsCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setDepthBufferParams(depthTest, depthWrite, depthFunction);
-	}
-
-	DfrdDepthBufferCheckCommand::DfrdDepthBufferCheckCommand(bool _enabled)
-		:enabled(_enabled)
-	{ }
-
-	void DfrdDepthBufferCheckCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setDepthBufferCheckEnabled(enabled);
-	}
-
-	DfrdDepthBufferWriteCommand::DfrdDepthBufferWriteCommand(bool _enabled)
-		:enabled(_enabled)
-	{ }
-
-	void DfrdDepthBufferWriteCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setDepthBufferWriteEnabled(enabled);
-	}
-
-	DfrdDepthBufferFuncCommand::DfrdDepthBufferFuncCommand(CompareFunction _func)
-		:func(_func)
-	{ }
-
-	void DfrdDepthBufferFuncCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setDepthBufferFunction(func);
-	}
-
-	DfrdDepthBiasCommand::DfrdDepthBiasCommand(float _constantBias, float _slopeScaleBias)
-		:constantBias(_constantBias), slopeScaleBias(_slopeScaleBias)
-	{ }
-
-	void DfrdDepthBiasCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setDepthBias(constantBias, slopeScaleBias);
-	}
-
-	DfrdColorBufferWriteCommand::DfrdColorBufferWriteCommand(bool _red, bool _green, bool _blue, bool _alpha)
-		:red(_red), green(_green), blue(_blue), alpha(_alpha)
-	{ }
-
-	void DfrdColorBufferWriteCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->setColorBufferWriteEnabled(red, green, blue, alpha);
-	}
-
-	DfrdDisableTextureUnitCommand::DfrdDisableTextureUnitCommand(size_t _texUnit)
-		:texUnit(_texUnit)
-	{ }
-
-	void DfrdDisableTextureUnitCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->disableTextureUnit(texUnit);
-	}
-
-	DfrdDisableTextureUnitsFromCommand::DfrdDisableTextureUnitsFromCommand(size_t _texUnit)
-		:texUnit(_texUnit)
-	{ }
-
-	void DfrdDisableTextureUnitsFromCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->disableTextureUnitsFrom(texUnit);
-	}
-
-	DfrdBeginFrameCommand::DfrdBeginFrameCommand()
-	{ }
-
-	void DfrdBeginFrameCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->beginFrame();
-	}
-
-	DfrdEndFrameCommand::DfrdEndFrameCommand()
-	{ }
-
-	void DfrdEndFrameCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->endFrame();
-	}
-
-	DfrdClearFrameBufferCommand::DfrdClearFrameBufferCommand(unsigned int _buffers, 
-		const Color& _color, float _depth, unsigned short _stencil)
-		:buffers(_buffers), color(_color), depth(_depth), stencil(_stencil)
-	{ }
-
-	void DfrdClearFrameBufferCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->clearFrameBuffer(buffers, color, depth, stencil);
-	}
-
-	DfrdSwapAllRenderTargetBuffersCommand::DfrdSwapAllRenderTargetBuffersCommand(bool _waitForVsync)
-		:waitForVsync(_waitForVsync)
-	{ }
-
-	void DfrdSwapAllRenderTargetBuffersCommand::submitCommand(RenderSystem* rs)
-	{
-		rs->swapAllRenderTargetBuffers(waitForVsync);
-	}
-}

+ 0 - 428
CamelotRenderer/Source/CmDeferredRenderSystem.cpp

@@ -1,428 +0,0 @@
-#include "CmDeferredRenderSystem.h"
-#include "CmDeferredGpuCommands.h"
-#include "CmRenderSystemManager.h"
-#include "CmException.h"
-
-namespace CamelotEngine
-{
-	DeferredRenderSystem::DeferredRenderSystem(CM_THREAD_ID_TYPE threadId)
-		:mMyThreadId(threadId), mReadyRenderCommandBuffer(nullptr)
-	{
-		mActiveRenderCommandBuffer = new vector<DeferredGpuCommand*>::type();
-	}
-
-	DeferredRenderSystem::~DeferredRenderSystem()
-	{
-		CM_LOCK_MUTEX(mCommandBufferMutex)
-
-		if(mReadyRenderCommandBuffer != nullptr)
-		{
-			for(auto iter = mReadyRenderCommandBuffer->begin(); iter != mReadyRenderCommandBuffer->end(); ++iter)
-				delete *iter;
-
-			delete mReadyRenderCommandBuffer;
-			mReadyRenderCommandBuffer = nullptr;
-		}
-
-		if(mActiveRenderCommandBuffer != nullptr)
-		{
-			for(auto iter = mActiveRenderCommandBuffer->begin(); iter != mActiveRenderCommandBuffer->end(); ++iter)
-				delete *iter;
-
-			delete mActiveRenderCommandBuffer;
-			mActiveRenderCommandBuffer = nullptr;
-		}
-	}
-
-	void DeferredRenderSystem::render(const RenderOperation& op)
-	{
-		throwIfInvalidThread();
-
-		RenderOperation opCopy = op;
-
-		DfrdRenderGpuCommand* newCommand = new DfrdRenderGpuCommand(opCopy);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::bindGpuProgram(GpuProgramRef prg)
-	{
-		throwIfInvalidThread();
-
-		DfrdBindGpuProgramCommand* newCommand = new DfrdBindGpuProgramCommand(prg);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::unbindGpuProgram(GpuProgramType gptype)
-	{
-		throwIfInvalidThread();
-
-		DfrdUnbindGpuProgramCommand* newCommand = new DfrdUnbindGpuProgramCommand(gptype);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params)
-	{
-		throwIfInvalidThread();
-
-		// We need to copy the constant buffers in order to prevent the user from modifying the parameters before rendering is done.
-		// Because of the way how GpuProgramParameters copy constructor works, only constants are copied and rest of the data is shared.
-		// Shared data is data that is only modified on shader change, and that should only occur on render thread, so it won't interfere
-		// with rendering.
-		GpuProgramParametersSharedPtr paramCopy = GpuProgramParametersSharedPtr(new GpuProgramParameters(*params));
-
-		DfrdBindGpuParamsCommand* newCommand = new DfrdBindGpuParamsCommand(gptype, paramCopy);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::setInvertVertexWinding(bool invert)
-	{
-		throwIfInvalidThread();
-
-		DfrdInvVertWindingCommand* newCommand = new DfrdInvVertWindingCommand(invert);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setScissorTest(bool enabled, size_t left, size_t top, size_t right, size_t bottom)
-	{
-		throwIfInvalidThread();
-
-		DfrdScissorTestCommand* newCommand = new DfrdScissorTestCommand(enabled, left, top, right, bottom);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setStencilBufferParams(CompareFunction func, UINT32 refValue, UINT32 mask, 
-		StencilOperation stencilFailOp, StencilOperation depthFailOp, StencilOperation passOp, bool twoSidedOperation)
-	{
-		throwIfInvalidThread();
-
-		DfrdStencilBufferParamsCommand* newCommand = new DfrdStencilBufferParamsCommand(func, refValue, mask, stencilFailOp, depthFailOp, passOp, twoSidedOperation);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::setVertexDeclaration(VertexDeclarationPtr decl)
-	{
-		throwIfInvalidThread();
-
-		DfrdVertexDeclCommand* newCommand = new DfrdVertexDeclCommand();
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setVertexBufferBinding(VertexBufferBinding* binding)
-	{
-		throwIfInvalidThread();
-
-		DfrdVertBufferBindCommand* newCommand = new DfrdVertBufferBindCommand();
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setPolygonMode(PolygonMode mode)
-	{
-		throwIfInvalidThread();
-
-		DfrdPolygonModeCommand* newCommand = new DfrdPolygonModeCommand(mode);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setStencilCheckEnabled(bool enabled)
-	{
-		throwIfInvalidThread();
-
-		DfrdStencilCheckCommand* newCommand = new DfrdStencilCheckCommand(enabled);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setWaitForVerticalBlank(bool enabled)
-	{
-		throwIfInvalidThread();
-
-		DfrdWaitForVerticalBlankCommand* newCommand = new DfrdWaitForVerticalBlankCommand(enabled);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTextureUnitSettings(size_t texUnit, const TexturePtr& texture, const SamplerState& samplerState)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureUnitSettingsCommand* newCommand = new DfrdTextureUnitSettingsCommand(texUnit, texture, samplerState);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setPointParameters(float size, bool attenuationEnabled, 
-		float constant, float linear, float quadratic, float minSize, float maxSize)
-	{
-		throwIfInvalidThread();
-
-		DfrdPointParamsCommand* newCommand = new DfrdPointParamsCommand(size, attenuationEnabled, constant, linear, quadratic, minSize, maxSize);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTexture(size_t unit, bool enabled, const TexturePtr &texPtr)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureCommand* newCommand = new DfrdTextureCommand(unit, enabled, texPtr);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setVertexTexture(size_t unit, const TexturePtr& tex)
-	{
-		throwIfInvalidThread();
-
-		DfrdVertexTextureCommand* newCommand = new DfrdVertexTextureCommand(unit, tex);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTextureFiltering(size_t unit, FilterOptions minFilter,
-		FilterOptions magFilter, FilterOptions mipFilter)
-	{
-		throwIfInvalidThread();
-
-		setTextureFiltering(unit, FT_MIN, minFilter);
-		setTextureFiltering(unit, FT_MAG, magFilter);
-		setTextureFiltering(unit, FT_MIP, mipFilter);
-	}
-		
-	void DeferredRenderSystem::setTextureFiltering(size_t unit, FilterType ftype, FilterOptions filter)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureFilteringCommand* newCommand = new DfrdTextureFilteringCommand(unit, ftype, filter);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTextureAnisotropy(size_t unit, unsigned int maxAnisotropy)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureAnisotropyCommand* newCommand = new DfrdTextureAnisotropyCommand(unit, maxAnisotropy);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTextureAddressingMode(size_t unit, const SamplerState::UVWAddressingMode& uvw)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureAddrModeCommand* newCommand = new DfrdTextureAddrModeCommand(unit, uvw);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTextureBorderColor(size_t unit, const Color& color)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureBorderColorCommand* newCommand = new DfrdTextureBorderColorCommand(unit, color);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setTextureMipmapBias(size_t unit, float bias)
-	{
-		throwIfInvalidThread();
-
-		DfrdTextureMipBiasCommand* newCommand = new DfrdTextureMipBiasCommand(unit, bias);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op)
-	{
-		throwIfInvalidThread();
-
-		DfrdSceneBlendingCommand* newCommand = new DfrdSceneBlendingCommand(sourceFactor, destFactor, op);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setSeparateSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
-		SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp)
-	{
-		throwIfInvalidThread();
-
-		DfrdSeparateSceneBlendingCommand* newCommand = new DfrdSeparateSceneBlendingCommand(sourceFactor, destFactor, sourceFactorAlpha, destFactorAlpha, op, alphaOp);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage)
-	{
-		throwIfInvalidThread();
-
-		DfrdAlphaRejectParamsCommand* newCommand = new DfrdAlphaRejectParamsCommand(func, value, alphaToCoverage);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setViewport(const Viewport& vp)
-	{
-		throwIfInvalidThread();
-
-		DfrdViewportCommand* newCommand = new DfrdViewportCommand(vp);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setCullingMode(CullingMode mode)
-	{
-		throwIfInvalidThread();
-
-		DfrdCullingCommand* newCommand = new DfrdCullingCommand(mode);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setDepthBufferParams(bool depthTest, bool depthWrite, CompareFunction depthFunction)
-	{
-		throwIfInvalidThread();
-
-		DfrdDepthBufferParamsCommand* newCommand = new DfrdDepthBufferParamsCommand(depthTest, depthWrite, depthFunction);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setDepthBufferCheckEnabled(bool enabled)
-	{
-		throwIfInvalidThread();
-
-		DfrdDepthBufferCheckCommand* newCommand = new DfrdDepthBufferCheckCommand(enabled);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setDepthBufferWriteEnabled(bool enabled)
-	{
-		throwIfInvalidThread();
-
-		DfrdDepthBufferWriteCommand* newCommand = new DfrdDepthBufferWriteCommand(enabled);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setDepthBufferFunction(CompareFunction func)
-	{
-		throwIfInvalidThread();
-
-		DfrdDepthBufferFuncCommand* newCommand = new DfrdDepthBufferFuncCommand(func);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::setDepthBias(float constantBias, float slopeScaleBias)
-	{
-		throwIfInvalidThread();
-
-		DfrdDepthBiasCommand* newCommand = new DfrdDepthBiasCommand(constantBias, slopeScaleBias);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha)
-	{
-		throwIfInvalidThread();
-
-		DfrdColorBufferWriteCommand* newCommand = new DfrdColorBufferWriteCommand(red, green, blue, alpha);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::disableTextureUnit(size_t texUnit)
-	{
-		throwIfInvalidThread();
-
-		DfrdDisableTextureUnitCommand* newCommand = new DfrdDisableTextureUnitCommand(texUnit);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-		
-	void DeferredRenderSystem::disableTextureUnitsFrom(size_t texUnit)
-	{
-		throwIfInvalidThread();
-
-		DfrdDisableTextureUnitsFromCommand* newCommand = new DfrdDisableTextureUnitsFromCommand(texUnit);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::beginFrame(void)
-	{
-		throwIfInvalidThread();
-
-		DfrdBeginFrameCommand* newCommand = new DfrdBeginFrameCommand();
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::endFrame(void)
-	{
-		throwIfInvalidThread();
-
-		DfrdEndFrameCommand* newCommand = new DfrdEndFrameCommand();
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::clearFrameBuffer(unsigned int buffers, 
-		const Color& color, float depth, unsigned short stencil)
-	{
-		throwIfInvalidThread();
-
-		DfrdClearFrameBufferCommand* newCommand = new DfrdClearFrameBufferCommand(buffers, color, depth, stencil);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::swapAllRenderTargetBuffers(bool waitForVsync)
-	{
-		throwIfInvalidThread();
-
-		DfrdSwapAllRenderTargetBuffersCommand* newCommand = new DfrdSwapAllRenderTargetBuffersCommand(waitForVsync);
-		mActiveRenderCommandBuffer->push_back(newCommand);
-	}
-
-	void DeferredRenderSystem::submitToGpu()
-	{
-		{
-			CM_LOCK_MUTEX(mCommandBufferMutex)
-
-			if(mReadyRenderCommandBuffer != nullptr)
-			{
-				for(auto iter = mReadyRenderCommandBuffer->begin(); iter != mReadyRenderCommandBuffer->end(); ++iter)
-					delete *iter;
-
-				delete mReadyRenderCommandBuffer;
-				mReadyRenderCommandBuffer = nullptr;
-			}
-
-			mReadyRenderCommandBuffer = mActiveRenderCommandBuffer;
-			mActiveRenderCommandBuffer = new vector<DeferredGpuCommand*>::type();
-		}
-	}
-
-	void DeferredRenderSystem::playbackCommands()
-	{
-		RenderSystem* rs = RenderSystemManager::getActive();
-
-		if(rs->getRenderThreadId() != CM_THREAD_CURRENT_ID)
-			CM_EXCEPT(InternalErrorException, "This method should only be called from the render thread.");
-
-		vector<DeferredGpuCommand*>::type* currentCommands = nullptr;
-		{
-			CM_LOCK_MUTEX(mCommandBufferMutex)
-
-			currentCommands = mReadyRenderCommandBuffer;
-			mReadyRenderCommandBuffer = nullptr;
-		}
-
-		if(currentCommands == nullptr)
-			return;
-
-		for(auto iter = currentCommands->begin(); iter != currentCommands->end(); ++iter)
-		{
-			(*iter)->submitCommand(rs);
-			delete *iter;
-		}
-
-		delete currentCommands;
-	}
-
-	bool DeferredRenderSystem::hasReadyCommands()
-	{
-		CM_LOCK_MUTEX(mCommandBufferMutex)
-
-			if(mReadyRenderCommandBuffer != nullptr && mReadyRenderCommandBuffer->size() > 0)
-				return true;
-
-		return false;
-	}
-
-	void DeferredRenderSystem::throwIfInvalidThread()
-	{
-#if CM_THREAD_SUPPORT != 0
-		if(CM_THREAD_CURRENT_ID != mMyThreadId)
-		{
-			CM_EXCEPT(InternalErrorException, "Deferred render system method called on an invalid thread.");
-		}
-#endif
-	}
-}

+ 0 - 1
CamelotRenderer/Source/CmRenderSystem.cpp

@@ -39,7 +39,6 @@ THE SOFTWARE.
 #include "CmRenderWindow.h"
 #include "CmHardwarePixelBuffer.h"
 #include "CmHardwareOcclusionQuery.h"
-#include "CmDeferredRenderSystem.h"
 #include "CmRenderSystemContext.h"
 #include "boost/bind.hpp"
 

+ 10 - 28
CamelotRenderer/TODO.txt

@@ -17,35 +17,16 @@ High-level TODO:
 
 Command buffer TODO:
  Immediate:
- - Rename ResourceRef to ResourceHandle?
- - setVertexDeclaration/setVertexBufferBinding still need their deferred versions
- - schedule startUp to happen on render thread
-   - do the same in OpenGL
- - surround the thread checks with #if _DEBUG
-
-MAYBE:
- - Create DeferredRenderSystem class that has exactly the same public interface as RenderSystem, but defers all calls to a command buffer
-   - As its methods are called we can also filter out values that exactly match the previous ones and minimize number of state changes
-      (Although this should probably be on a higher level, because 1 class 1 use)
-
-RESOURCE COMMANDS!!:
- - They get queued up into the RenderSystem same like render commands
- - They handle all resource creation/updates/destroy
- - They are high level:
-   - i.e. CmndInitializeTexture - contains Texture to initialize and data to initialize it with
- - This allows makes it possible not to store temporary texture or mesh data in the texture/mesh objects between initialization. The data is stored with the command instead.
- - Also we don't need to handle resource loading in two steps. After loading is complete, resource gets queued up and initialized before next render frame.
- - Make sure to clearly separate CPU and GPU commands on resources. Tell the user that GPU commands are deferred and will only be executed later. (Provide option to let him choose?)
-
-Essential TODO for deferred rendering:
- - Block all calls to RenderSystem outside of Render thread (or at least warn)
- - Prevent user from accessing vertex/index buffers and similar outside of render thread as well (e.g. GpuProgram, Texture)
-
- - Modify resource creation so it calls RenderContext and just schedules resource creation
-
- - Figure out how to handle reading of resources properly
-
+  - Port the rest of the RenderSystem of use RenderContext
+  - Port resource creation to use RenderContext (texture/mesh/shader/etc initialization and updates)
+  - Make sure to add thread checks (surrounded by #if DEBUG) to RenderSystem and Vertex/Index/Pixel buffers, textures, meshes, etc.
 
+ Later:
+  - Add resource creation "culling" to avoid updating some resource multiple times in a single frame
+  - Modify resource loading so we don't need a special Response handler on the main thread. We should be able to immediately queue up resource command instead.
+  - Provide Async versions of all read commands
+  - Add documentation that tells the user that reading a resource non-async will block the thread and execute all queued render commands first
+  - Add documentation that tells the user that resource updates only get applied at the end of the frame, unless you manually override it.
 
 HIGH PRIORITY TODO:
  - Issue with deserialization and value types:
@@ -55,6 +36,7 @@ HIGH PRIORITY TODO:
  - HLSL & Cg don't handle include files yet
 
 Mid priority TODO:
+ - Rename ResourceRef to ResourceHandle?
  - Add a field that tracks % of resource deserialization in BinarySerializer
 
  - Separate render thread