ソースを参照

Removed most of the old parameter system
Removed GL link program & link manager

Marko Pintera 13 年 前
コミット
284bb02672
29 ファイル変更153 行追加1609 行削除
  1. 2 2
      CamelotClient/CamelotClient.cpp
  2. 20 2
      CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h
  3. 19 151
      CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp
  4. 0 6
      CamelotGLRenderer/CamelotGLRenderer.vcxproj
  5. 0 18
      CamelotGLRenderer/CamelotGLRenderer.vcxproj.filters
  6. 0 83
      CamelotGLRenderer/Include/CmGLGpuProgram.h
  7. 0 8
      CamelotGLRenderer/Include/CmGLRenderSystem.h
  8. 0 122
      CamelotGLRenderer/Source/CmGLGpuProgram.cpp
  9. 0 2
      CamelotGLRenderer/Source/CmGLGpuProgramManager.cpp
  10. 57 146
      CamelotGLRenderer/Source/CmGLRenderSystem.cpp
  11. 7 18
      CamelotGLRenderer/Source/GLSL/include/CmGLSLGpuProgram.h
  12. 0 122
      CamelotGLRenderer/Source/GLSL/include/CmGLSLLinkProgram.h
  13. 0 130
      CamelotGLRenderer/Source/GLSL/include/CmGLSLLinkProgramManager.h
  14. 0 2
      CamelotGLRenderer/Source/GLSL/include/CmGLSLProgramFactory.h
  15. 2 105
      CamelotGLRenderer/Source/GLSL/src/CmGLSLGpuProgram.cpp
  16. 0 424
      CamelotGLRenderer/Source/GLSL/src/CmGLSLLinkProgram.cpp
  17. 0 176
      CamelotGLRenderer/Source/GLSL/src/CmGLSLLinkProgramManager.cpp
  18. 0 1
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp
  19. 0 11
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp
  20. 1 0
      CamelotRenderer.sln
  21. 0 2
      CamelotRenderer/Include/CmDeferredRenderContext.h
  22. 29 1
      CamelotRenderer/Include/CmGpuProgram.h
  23. 0 7
      CamelotRenderer/Include/CmGpuProgramManager.h
  24. 0 3
      CamelotRenderer/Include/CmPrerequisites.h
  25. 0 12
      CamelotRenderer/Include/CmRenderSystem.h
  26. 7 32
      CamelotRenderer/Include/CmRenderSystemCapabilities.h
  27. 0 7
      CamelotRenderer/Source/CmDeferredRenderContext.cpp
  28. 7 14
      CamelotRenderer/Source/CmGpuProgramManager.cpp
  29. 2 2
      CamelotRenderer/Source/CmHighLevelGpuProgram.cpp

+ 2 - 2
CamelotClient/CamelotClient.cpp

@@ -26,8 +26,8 @@ using namespace CamelotEngine;
 
 int _tmain(int argc, _TCHAR* argv[])
 {
-	gApplication().startUp("CamelotGLRenderSystem", "CamelotForwardRenderer");
-	//gApplication().startUp("CamelotD3D9RenderSystem", "CamelotForwardRenderer");
+	//gApplication().startUp("CamelotGLRenderSystem", "CamelotForwardRenderer");
+	gApplication().startUp("CamelotD3D9RenderSystem", "CamelotForwardRenderer");
 
 	RenderSystem* renderSystem = RenderSystem::instancePtr();
 	RenderWindowPtr renderWindow = gApplication().getPrimaryRenderWindow();

+ 20 - 2
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -52,14 +52,30 @@ namespace CamelotEngine
 		const String& getName() const;
 
 		void destroyRenderTarget(RenderTarget* renderTarget);
+
+		/**
+		 * @copydoc RenderSystem::setRenderTarget()
+		 */
 		void setRenderTarget(RenderTarget* target);
 
+		/**
+		 * @copydoc RenderSystem::bindGpuProgram()
+		 */
 		void bindGpuProgram(GpuProgramHandle prg);
+
+		/**
+		 * @copydoc RenderSystem::unbindGpuProgram()
+		 */
 		void unbindGpuProgram(GpuProgramType gptype);
-		void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
 
+		/**
+		 * @copydoc RenderSystem::bindGpuParams()
+		 */
 		void bindGpuParams(GpuProgramType gptype, GpuParamsPtr params);
 
+		/**
+		 * @copydoc RenderSystem::setSamplerState()
+		 */
 		void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const TexturePtr &texPtr);
 
 		/**
@@ -151,7 +167,9 @@ namespace CamelotEngine
 			IDirect3DBaseTexture9 *pTex;
 			/// vertex texture 
 			IDirect3DBaseTexture9 *pVertexTex;
-		} mTexStageDesc[CM_MAX_TEXTURE_LAYERS];
+		};
+
+		sD3DTextureStageDesc* mTexStageDesc;
 
 		D3D9DriverList* getDirect3DDrivers();
 				

+ 19 - 151
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -89,6 +89,7 @@ namespace CamelotEngine
 
 	//---------------------------------------------------------------------
 	D3D9RenderSystem::D3D9RenderSystem( HINSTANCE hInstance )
+		:mTexStageDesc(nullptr)
 	{
 		// update singleton access pointer.
 		msD3D9RenderSystem = this;
@@ -153,15 +154,6 @@ namespace CamelotEngine
 		if( NULL == (mpD3D = Direct3DCreate9(D3D_SDK_VERSION)) )
 			CM_EXCEPT(InternalErrorException, "Failed to create Direct3D9 object");
 
-		// set stages desc. to defaults
-		for (size_t n = 0; n < CM_MAX_TEXTURE_LAYERS; n++)
-		{
-			mTexStageDesc[n].coordIndex = 0;
-			mTexStageDesc[n].texType = D3D9Mappings::D3D_TEX_TYPE_NORMAL;
-			mTexStageDesc[n].pTex = 0;
-			mTexStageDesc[n].pVertexTex = 0;
-		}
-
 		mLastVertexSourceCount = 0;
 
 		RenderWindow* autoWindow = NULL;
@@ -205,6 +197,12 @@ namespace CamelotEngine
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::destroy_internal()
 	{
+		if(mTexStageDesc != nullptr)
+		{
+			delete[] mTexStageDesc;
+			mTexStageDesc = nullptr;
+		}
+
 		RenderSystem::destroy_internal();
 
 		SAFE_DELETE( mDeviceManager );
@@ -296,7 +294,6 @@ namespace CamelotEngine
 		switch(gptype)
 		{
 		case GPT_VERTEX_PROGRAM:
-			mActiveVertexGpuProgramParameters = nullptr;
 			hr = getActiveD3D9Device()->SetVertexShader(NULL);
 			if (FAILED(hr))
 			{
@@ -304,7 +301,6 @@ namespace CamelotEngine
 			}
 			break;
 		case GPT_FRAGMENT_PROGRAM:
-			mActiveFragmentGpuProgramParameters = nullptr;
 			hr = getActiveD3D9Device()->SetPixelShader(NULL);
 			if (FAILED(hr))
 			{
@@ -315,145 +311,6 @@ namespace CamelotEngine
 
 		RenderSystem::unbindGpuProgram(gptype);
 	}
-
-	void D3D9RenderSystem::bindGpuProgramParameters(GpuProgramType gptype, 
-		GpuProgramParametersSharedPtr params, UINT16 variability)
-	{
-		THROW_IF_NOT_RENDER_THREAD;
-
-		HRESULT hr;
-		GpuLogicalBufferStructPtr floatLogical = params->getFloatLogicalBufferStruct();
-		GpuLogicalBufferStructPtr intLogical = params->getIntLogicalBufferStruct();
-
-		GpuLogicalBufferStructPtr samplerLogical = params->getSamplerLogicalBufferStruct();
-		GpuLogicalBufferStructPtr textureLogical = params->getTextureLogicalBufferStruct();
-
-		// Set texture & sampler
-		{
-			for (GpuLogicalIndexUseMap::const_iterator i = samplerLogical->map.begin(); i != samplerLogical->map.end(); ++i)
-			{
-				if (i->second.variability & variability)
-				{
-					UINT32 logicalIndex = i->first;
-
-					SamplerStatePtr samplerState = params->getSamplerState(i->second.physicalIndex);
-					if(samplerState == nullptr)
-						setSamplerState(gptype, logicalIndex, SamplerState::getDefault());
-					else
-						setSamplerState(gptype, logicalIndex, *samplerState);
-				}
-			}
-
-			for (GpuLogicalIndexUseMap::const_iterator i = textureLogical->map.begin(); i != textureLogical->map.end(); ++i)
-			{
-				if (i->second.variability & variability)
-				{
-					UINT32 logicalIndex = i->first;
-					TextureHandle texture = params->getTexture(i->second.physicalIndex);
-
-					if(!texture.isLoaded())
-						continue;
-
-					setTexture(gptype, logicalIndex, true, texture.getInternalPtr());
-				}
-			}
-		}
-
-		switch(gptype)
-		{
-		case GPT_VERTEX_PROGRAM:
-			mActiveVertexGpuProgramParameters = params;
-			{
-				for (GpuLogicalIndexUseMap::const_iterator i = floatLogical->map.begin();
-					i != floatLogical->map.end(); ++i)
-				{
-					if (i->second.variability & variability)
-					{
-						UINT32 logicalIndex = i->first;
-						const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
-						UINT32 slotCount = i->second.currentSize / 4;
-						assert (i->second.currentSize % 4 == 0 && "Should not have any "
-							"elements less than 4 wide for D3D9");
-
-						if (FAILED(hr = getActiveD3D9Device()->SetVertexShaderConstantF( // TODO Low priority. Binding parameters 1 by 1 is slow. It would be better to keep them in a sequential
-							(UINT)logicalIndex, pFloat, (UINT)slotCount)))               // buffer and then only call this method once
-						{
-							CM_EXCEPT(RenderingAPIException, "Unable to upload vertex shader float parameters");
-						}
-					}
-
-				}
-			}
-			// bind ints
-			{
-				for (GpuLogicalIndexUseMap::const_iterator i = intLogical->map.begin();
-					i != intLogical->map.end(); ++i)
-				{
-					if (i->second.variability & variability)
-					{
-						UINT32 logicalIndex = i->first;
-						const int* pInt = params->getIntPointer(i->second.physicalIndex);
-						UINT32 slotCount = i->second.currentSize / 4;
-						assert (i->second.currentSize % 4 == 0 && "Should not have any "
-							"elements less than 4 wide for D3D9");
-
-						if (FAILED(hr = getActiveD3D9Device()->SetVertexShaderConstantI(
-							static_cast<UINT>(logicalIndex), pInt, static_cast<UINT>(slotCount))))
-						{
-							CM_EXCEPT(RenderingAPIException, "Unable to upload vertex shader int parameters");
-						}
-					}
-				}
-			}
-
-			break;
-		case GPT_FRAGMENT_PROGRAM:
-			mActiveFragmentGpuProgramParameters = params;
-			{
-				for (GpuLogicalIndexUseMap::const_iterator i = floatLogical->map.begin();
-					i != floatLogical->map.end(); ++i)
-				{
-					if (i->second.variability & variability)
-					{
-						UINT32 logicalIndex = i->first;
-						const float* pFloat = params->getFloatPointer(i->second.physicalIndex);
-						UINT32 slotCount = i->second.currentSize / 4;
-						assert (i->second.currentSize % 4 == 0 && "Should not have any "
-							"elements less than 4 wide for D3D9");
-
-						if (FAILED(hr = getActiveD3D9Device()->SetPixelShaderConstantF(
-							static_cast<UINT>(logicalIndex), pFloat, static_cast<UINT>(slotCount))))
-						{
-							CM_EXCEPT(RenderingAPIException, "Unable to upload pixel shader float parameters");
-						}
-					}
-				}
-			}
-			// bind ints
-			{
-				for (GpuLogicalIndexUseMap::const_iterator i = intLogical->map.begin();
-					i != intLogical->map.end(); ++i)
-				{
-					if (i->second.variability & variability)
-					{
-						UINT32 logicalIndex = i->first;
-						const int* pInt = params->getIntPointer(i->second.physicalIndex);
-						UINT32 slotCount = i->second.currentSize / 4;
-						assert (i->second.currentSize % 4 == 0 && "Should not have any "
-							"elements less than 4 wide for D3D9");
-
-						if (FAILED(hr = getActiveD3D9Device()->SetPixelShaderConstantI(
-							static_cast<UINT>(logicalIndex), pInt, static_cast<UINT>(slotCount))))
-						{
-							CM_EXCEPT(RenderingAPIException, "Unable to upload pixel shader int parameters");
-						}
-					}
-
-				}
-			}
-			break;
-		};
-	}
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::bindGpuParams(GpuProgramType gptype, GpuParamsPtr params)
 	{
@@ -612,7 +469,6 @@ namespace CamelotEngine
 			}
 		}
 		
-
 		// Do the real removal
 		RenderSystem::destroyRenderTarget(renderTarget);	
 	}
@@ -2382,6 +2238,18 @@ namespace CamelotEngine
 
 		if (caps->isShaderProfileSupported("cg"))
 			HighLevelGpuProgramManager::instance().addFactory(mCgProgramFactory);
+
+		UINT32 maxNumCombinedTextures = caps->getNumCombinedTextureUnits();
+		mTexStageDesc = new sD3DTextureStageDesc[maxNumCombinedTextures];
+
+		// set stages desc. to defaults
+		for (UINT32 n = 0; n < maxNumCombinedTextures; n++)
+		{
+			mTexStageDesc[n].coordIndex = 0;
+			mTexStageDesc[n].texType = D3D9Mappings::D3D_TEX_TYPE_NORMAL;
+			mTexStageDesc[n].pTex = 0;
+			mTexStageDesc[n].pVertexTex = 0;
+		}
 	}
 
 	//-----------------------------------------------------------------------

+ 0 - 6
CamelotGLRenderer/CamelotGLRenderer.vcxproj

@@ -151,7 +151,6 @@
     <ClInclude Include="Include\CmGLDefaultHardwareBufferManager.h" />
     <ClInclude Include="Include\CmGLDepthStencilBuffer.h" />
     <ClInclude Include="Include\CmGLFrameBufferObject.h" />
-    <ClInclude Include="Include\CmGLGpuProgram.h" />
     <ClInclude Include="Include\CmGLGpuProgramManager.h" />
     <ClInclude Include="Include\CmGLHardwareBufferManager.h" />
     <ClInclude Include="Include\CmGLHardwareIndexBuffer.h" />
@@ -175,8 +174,6 @@
     <ClInclude Include="Include\CmWin32Window.h" />
     <ClInclude Include="Source\GLSL\include\CmGLSLExtSupport.h" />
     <ClInclude Include="Source\GLSL\include\CmGLSLGpuProgram.h" />
-    <ClInclude Include="Source\GLSL\include\CmGLSLLinkProgram.h" />
-    <ClInclude Include="Source\GLSL\include\CmGLSLLinkProgramManager.h" />
     <ClInclude Include="Source\GLSL\include\CmGLSLPreprocessor.h" />
     <ClInclude Include="Source\GLSL\include\CmGLSLProgram.h" />
     <ClInclude Include="Source\GLSL\include\CmGLSLProgramFactory.h" />
@@ -188,7 +185,6 @@
     <ClCompile Include="Source\CmGLDefaultHardwareBufferManager.cpp" />
     <ClCompile Include="Source\CmGLDepthStencilBuffer.cpp" />
     <ClCompile Include="Source\CmGLFrameBufferObject.cpp" />
-    <ClCompile Include="Source\CmGLGpuProgram.cpp" />
     <ClCompile Include="Source\CmGLGpuProgramManager.cpp" />
     <ClCompile Include="Source\CmGLHardwareBufferManager.cpp" />
     <ClCompile Include="Source\CmGLHardwareIndexBuffer.cpp" />
@@ -209,8 +205,6 @@
     <ClCompile Include="Source\glew.cpp" />
     <ClCompile Include="Source\GLSL\src\CmGLSLExtSupport.cpp" />
     <ClCompile Include="Source\GLSL\src\CmGLSLGpuProgram.cpp" />
-    <ClCompile Include="Source\GLSL\src\CmGLSLLinkProgram.cpp" />
-    <ClCompile Include="Source\GLSL\src\CmGLSLLinkProgramManager.cpp" />
     <ClCompile Include="Source\GLSL\src\CmGLSLPreprocessor.cpp" />
     <ClCompile Include="Source\GLSL\src\CmGLSLProgram.cpp" />
     <ClCompile Include="Source\GLSL\src\CmGLSLProgramFactory.cpp" />

+ 0 - 18
CamelotGLRenderer/CamelotGLRenderer.vcxproj.filters

@@ -33,9 +33,6 @@
     <ClInclude Include="Include\CmGLFrameBufferObject.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Include\CmGLGpuProgram.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmGLGpuProgramManager.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -96,12 +93,6 @@
     <ClInclude Include="Source\GLSL\include\CmGLSLGpuProgram.h">
       <Filter>GLSL</Filter>
     </ClInclude>
-    <ClInclude Include="Source\GLSL\include\CmGLSLLinkProgram.h">
-      <Filter>GLSL</Filter>
-    </ClInclude>
-    <ClInclude Include="Source\GLSL\include\CmGLSLLinkProgramManager.h">
-      <Filter>GLSL</Filter>
-    </ClInclude>
     <ClInclude Include="Source\GLSL\include\CmGLSLPreprocessor.h">
       <Filter>GLSL</Filter>
     </ClInclude>
@@ -134,12 +125,6 @@
     <ClCompile Include="Source\GLSL\src\CmGLSLGpuProgram.cpp">
       <Filter>GLSL</Filter>
     </ClCompile>
-    <ClCompile Include="Source\GLSL\src\CmGLSLLinkProgram.cpp">
-      <Filter>GLSL</Filter>
-    </ClCompile>
-    <ClCompile Include="Source\GLSL\src\CmGLSLLinkProgramManager.cpp">
-      <Filter>GLSL</Filter>
-    </ClCompile>
     <ClCompile Include="Source\GLSL\src\CmGLSLPreprocessor.cpp">
       <Filter>GLSL</Filter>
     </ClCompile>
@@ -161,9 +146,6 @@
     <ClCompile Include="Source\CmGLFrameBufferObject.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Source\CmGLGpuProgram.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Source\CmGLGpuProgramManager.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>

+ 0 - 83
CamelotGLRenderer/Include/CmGLGpuProgram.h

@@ -1,83 +0,0 @@
-/*
------------------------------------------------------------------------------
-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 __GLGpuProgram_H__
-#define __GLGpuProgram_H__
-
-#include "CmGLPrerequisites.h"
-#include "CmGpuProgram.h"
-#include "CmHardwareVertexBuffer.h"
-
-namespace CamelotEngine {
-
-    /** Generalised low-level GL program, can be applied to multiple types (eg ARB and NV) */
-    class CM_RSGL_EXPORT GLGpuProgram : public GpuProgram
-    {
-    public:
-        virtual ~GLGpuProgram();
-
-        /// Execute the binding functions for this program
-        virtual void bindProgram(void) {}
-        /// Execute the binding functions for this program
-        virtual void unbindProgram(void) {}
-
-        /// Execute the param binding functions for this program
-		virtual void bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask) {}
-
-        /// Get the assigned GL program id
-        const UINT32 getProgramID(void) const
-        { return mProgramID; }
-
-		/** Get the attribute index for a given semantic. 
-		@remarks
-			This can be used to identify the attribute index to bind non-builtin
-			attributes like tangent and binormal.
-		*/
-		virtual GLuint getAttributeIndex(VertexElementSemantic semantic, UINT32 index);
-		/** Test whether attribute index for a given semantic is valid. 
-		*/
-		virtual bool isAttributeValid(VertexElementSemantic semantic, UINT32 index);
-
-		/** Get the fixed attribute bindings normally used by GL for a semantic. */
-		static GLuint getFixedAttributeIndex(VertexElementSemantic semantic, UINT32 index);
-
-    protected:
-		GLGpuProgram(const String& source, const String& entryPoint, const String& language, 
-			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
-
-		/** Overridden from GpuProgram, do nothing */
-		void loadFromSource(void) {}
-        /// @copydoc Resource::unloadImpl
-        void unloadImpl(void) {}
-
-        UINT32 mProgramID;
-        GLenum mProgramType;
-    };
-}; // namespace CamelotEngine
-
-#endif // __GLGpuProgram_H__

+ 0 - 8
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -116,11 +116,6 @@ namespace CamelotEngine {
 		 */
 		void unbindGpuProgram(GpuProgramType gptype);
 
-		/**
-		 * @copydoc RenderSystem::bindGpuProgramParameters()
-		 */
-		void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 mask);
-		
 		/**
 		 * @copydoc RenderSystem::bindGpuParams()
 		 */
@@ -211,9 +206,6 @@ namespace CamelotEngine {
         /// Holds texture type settings for every stage
         GLenum* mTextureTypes;
 
-		/// Number of fixed-function texture units
-		unsigned short mFixedFunctionTextureUnits;
-
         void initInputDevices(void);
         void processInputDevices(void);
 

+ 0 - 122
CamelotGLRenderer/Source/CmGLGpuProgram.cpp

@@ -1,122 +0,0 @@
-/*
------------------------------------------------------------------------------
-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.
------------------------------------------------------------------------------
-*/
-
-#include "CmGLGpuProgram.h"
-#include "CmException.h"
-
-namespace CamelotEngine
-{
-	GLGpuProgram::GLGpuProgram(const String& source, const String& entryPoint, const String& language, 
-							   GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired) 
-		: GpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired)
-	{
-
-	}
-
-	GLGpuProgram::~GLGpuProgram()
-	{
-		// have to call this here reather than in Resource destructor
-		// since calling virtual methods in base destructors causes crash
-		unload_internal(); 
-	}
-
-	GLuint GLGpuProgram::getAttributeIndex(VertexElementSemantic semantic, CamelotEngine::UINT32 index)
-	{
-		return getFixedAttributeIndex(semantic, index);
-	}
-
-	GLuint GLGpuProgram::getFixedAttributeIndex(VertexElementSemantic semantic, CamelotEngine::UINT32 index)
-	{
-		// Some drivers (e.g. OS X on nvidia) incorrectly determine the attribute binding automatically
-		// and end up aliasing existing built-ins. So avoid! Fixed builtins are: 
-
-		//  a  builtin				custom attrib name
-		// ----------------------------------------------
-		//	0  gl_Vertex			vertex
-		//  1  n/a					blendWeights		
-		//	2  gl_Normal			normal
-		//	3  gl_Color				colour
-		//	4  gl_SecondaryColor	secondary_colour
-		//	5  gl_FogCoord			fog_coord
-		//  7  n/a					blendIndices
-		//	8  gl_MultiTexCoord0	uv0
-		//	9  gl_MultiTexCoord1	uv1
-		//	10 gl_MultiTexCoord2	uv2
-		//	11 gl_MultiTexCoord3	uv3
-		//	12 gl_MultiTexCoord4	uv4
-		//	13 gl_MultiTexCoord5	uv5
-		//	14 gl_MultiTexCoord6	uv6, tangent
-		//	15 gl_MultiTexCoord7	uv7, binormal
-		switch(semantic)
-		{
-		case VES_POSITION:
-			return 0;
-		case VES_BLEND_WEIGHTS:
-			return 1;
-		case VES_NORMAL:
-			return 2;
-		case VES_DIFFUSE:
-			return 3;
-		case VES_SPECULAR:
-			return 4;
-		case VES_BLEND_INDICES:
-			return 7;
-		case VES_TEXTURE_COORDINATES:
-			return 8 + index;
-		case VES_TANGENT:
-			return 14;
-		case VES_BITANGENT:
-			return 15;
-		default:
-			assert(false && "Missing attribute!");
-			return 0;
-		};
-
-	}
-
-	bool GLGpuProgram::isAttributeValid(VertexElementSemantic semantic, CamelotEngine::UINT32 index)
-	{
-		// default implementation
-		switch(semantic)
-		{
-			case VES_POSITION:
-			case VES_NORMAL:
-			case VES_DIFFUSE:
-			case VES_SPECULAR:
-			case VES_TEXTURE_COORDINATES:
-				return false;
-			case VES_BLEND_WEIGHTS:
-			case VES_BLEND_INDICES:
-			case VES_BITANGENT:
-			case VES_TANGENT:
-				return true; // with default binding
-		}
-
-		return false;
-	}
-}

+ 0 - 2
CamelotGLRenderer/Source/CmGLGpuProgramManager.cpp

@@ -27,7 +27,6 @@ THE SOFTWARE.
 */
 
 #include "CmGLGpuProgramManager.h"
-#include "CmGLGpuProgram.h"
 #include "CmException.h"
 
 using namespace CamelotEngine;
@@ -37,7 +36,6 @@ GLGpuProgramManager::GLGpuProgramManager()
     // Superclass sets up members 
 }
 
-
 GLGpuProgramManager::~GLGpuProgramManager()
 {
 }

+ 57 - 146
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -35,7 +35,6 @@ THE SOFTWARE.s
 #include "CmGLHardwareIndexBuffer.h"
 #include "CmGLDefaultHardwareBufferManager.h"
 #include "CmGLUtil.h"
-#include "CmGLGpuProgram.h"
 #include "CmGLSLGpuProgram.h"
 #include "CmGLSLProgram.h"
 #include "CmGLGpuProgramManager.h"
@@ -87,8 +86,6 @@ namespace CamelotEngine
 		mGeometryTexOffset(0),
 		mTextureTypes(nullptr)
 	{
-		size_t i;
-
 		// Get our GLSupport
 		mGLSupport = CamelotEngine::getGLSupport();
 
@@ -260,9 +257,6 @@ namespace CamelotEngine
 			break;
 		}
 
-		// Bind the program
-		glprg->bindProgram();
-
 		RenderSystem::bindGpuProgram(prg);
 	}
 	//---------------------------------------------------------------------
@@ -270,84 +264,10 @@ namespace CamelotEngine
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 
-		if (gptype == GPT_VERTEX_PROGRAM && mCurrentVertexProgram)
-		{
-			mActiveVertexGpuProgramParameters = nullptr;
-			mCurrentVertexProgram->unbindProgram();
-			mCurrentVertexProgram = 0;
-		}
-		else if (gptype == GPT_GEOMETRY_PROGRAM && mCurrentGeometryProgram)
-		{
-			mActiveGeometryGpuProgramParameters = nullptr;
-			mCurrentGeometryProgram->unbindProgram();
-			mCurrentGeometryProgram = 0;
-		}
-		else if (gptype == GPT_FRAGMENT_PROGRAM && mCurrentFragmentProgram)
-		{
-			mActiveFragmentGpuProgramParameters = nullptr;
-			mCurrentFragmentProgram->unbindProgram();
-			mCurrentFragmentProgram = 0;
-		}
-		else if (gptype == GPT_DOMAIN_PROGRAM && mCurrentDomainProgram)
-		{
-			mCurrentDomainProgram->unbindProgram();
-			mCurrentDomainProgram = 0;
-		}
-		else if (gptype == GPT_HULL_PROGRAM && mCurrentHullProgram)
-		{
-			mCurrentHullProgram->unbindProgram();
-			mCurrentHullProgram = 0;
-		}
+		setActiveProgram(gptype, nullptr);
 
 		RenderSystem::unbindGpuProgram(gptype);
 	}
-
-	void GLRenderSystem::bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 mask)
-	{
-		THROW_IF_NOT_RENDER_THREAD;
-
-		// Set textures
-		const GpuNamedConstants& consts = params->getConstantDefinitions();
-		for(auto iter = consts.map.begin(); iter != consts.map.end(); ++iter)
-		{
-			const GpuConstantDefinition& def = iter->second;
-
-			if(def.variability & mask)
-			{
-				if(def.isSampler())
-				{
-					TextureHandle curTexture = params->getTexture(def.physicalIndex);
-
-					if(!curTexture.isLoaded())
-						continue;
-
-					setTexture(gptype, def.physicalIndex, true, curTexture.getInternalPtr());
-
-					SamplerStatePtr samplerState = params->getSamplerState(def.physicalIndex);
-					if(samplerState == nullptr)
-						setSamplerState(gptype, def.physicalIndex, SamplerState::getDefault());
-					else
-						setSamplerState(gptype, def.physicalIndex, *samplerState);
-				}
-			}
-		}
-
-		switch (gptype)
-		{
-		case GPT_VERTEX_PROGRAM:
-			mActiveVertexGpuProgramParameters = params;
-			mCurrentVertexProgram->bindProgramParameters(params, mask);
-			break;
-		case GPT_GEOMETRY_PROGRAM:
-			mActiveGeometryGpuProgramParameters = params;
-			mCurrentGeometryProgram->bindProgramParameters(params, mask);
-			break;
-		case GPT_FRAGMENT_PROGRAM:
-			mActiveFragmentGpuProgramParameters = params;
-			mCurrentFragmentProgram->bindProgramParameters(params, mask);
-			break;
-		}
-	}
 	//-----------------------------------------------------------------------------
 	void GLRenderSystem::bindGpuParams(GpuProgramType gptype, GpuParamsPtr params)
 	{
@@ -696,13 +616,15 @@ namespace CamelotEngine
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 
+		// TODO - Generate pipeline and bind program
+
+
 		// Call super class
 		RenderSystem::render(op);
 
 		void* pBufferData = 0;
 
-        const VertexDeclaration::VertexElementList& decl = 
-            op.vertexData->vertexDeclaration->getElements();
+        const VertexDeclaration::VertexElementList& decl = op.vertexData->vertexDeclaration->getElements();
         VertexDeclaration::VertexElementList::const_iterator elem, elemEnd;
         elemEnd = decl.end();
 		vector<GLuint>::type attribsBound;
@@ -731,45 +653,56 @@ namespace CamelotEngine
 
 			unsigned int i = 0;
 			VertexElementSemantic sem = elem->getSemantic();
+
+
+
+
+
+			// TODO - Vertex elem not set
+			
+
+
+
+
+
+ 			//bool isCustomAttrib = false;
+ 			//if (mCurrentVertexProgram)
+ 			//	isCustomAttrib = mCurrentVertexProgram->isAttributeValid(sem, elem->getIndex());
  
- 			bool isCustomAttrib = false;
- 			if (mCurrentVertexProgram)
- 				isCustomAttrib = mCurrentVertexProgram->isAttributeValid(sem, elem->getIndex());
- 
- 			// Custom attribute support
- 			// tangents, binormals, blendweights etc always via this route
- 			// builtins may be done this way too
- 			if (isCustomAttrib)
- 			{
- 				GLint attrib = mCurrentVertexProgram->getAttributeIndex(sem, elem->getIndex());
-				unsigned short typeCount = VertexElement::getTypeCount(elem->getType());
-				GLboolean normalised = GL_FALSE;
-				switch(elem->getType())
-				{
-				case VET_COLOR:
-				case VET_COLOR_ABGR:
-				case VET_COLOR_ARGB:
-					// Because GL takes these as a sequence of single unsigned bytes, count needs to be 4
-					// VertexElement::getTypeCount treats them as 1 (RGBA)
-					// Also need to normalise the fixed-point data
-					typeCount = 4;
-					normalised = GL_TRUE;
-					break;
-				default:
-					break;
-				};
-
- 				glVertexAttribPointerARB(
- 					attrib,
- 					typeCount, 
-  					GLHardwareBufferManager::getGLType(elem->getType()), 
- 					normalised, 
-  					static_cast<GLsizei>(vertexBuffer->getVertexSize()), 
-  					pBufferData);
- 				glEnableVertexAttribArrayARB(attrib);
+ 			//// Custom attribute support
+ 			//// tangents, binormals, blendweights etc always via this route
+ 			//// builtins may be done this way too
+ 			//if (isCustomAttrib)
+ 			//{
+ 			//	GLint attrib = mCurrentVertexProgram->getAttributeIndex(sem, elem->getIndex());
+				//unsigned short typeCount = VertexElement::getTypeCount(elem->getType());
+				//GLboolean normalised = GL_FALSE;
+				//switch(elem->getType())
+				//{
+				//case VET_COLOR:
+				//case VET_COLOR_ABGR:
+				//case VET_COLOR_ARGB:
+				//	// Because GL takes these as a sequence of single unsigned bytes, count needs to be 4
+				//	// VertexElement::getTypeCount treats them as 1 (RGBA)
+				//	// Also need to normalise the fixed-point data
+				//	typeCount = 4;
+				//	normalised = GL_TRUE;
+				//	break;
+				//default:
+				//	break;
+				//};
+
+ 			//	glVertexAttribPointerARB(
+ 			//		attrib,
+ 			//		typeCount, 
+  		//			GLHardwareBufferManager::getGLType(elem->getType()), 
+ 			//		normalised, 
+  		//			static_cast<GLsizei>(vertexBuffer->getVertexSize()), 
+  		//			pBufferData);
+ 			//	glEnableVertexAttribArrayARB(attrib);
  
- 				attribsBound.push_back(attrib);
- 			}
+ 			//	attribsBound.push_back(attrib);
+ 			//}
         }
 
 		// Find the correct type to render
@@ -1500,14 +1433,6 @@ namespace CamelotEngine
 			mCurrentContext->setInitialized();
 		}
 
-		// Rebind GPU programs to new context
-		if (mCurrentVertexProgram)
-			mCurrentVertexProgram->bindProgram();
-		if (mCurrentGeometryProgram)
-			mCurrentGeometryProgram->bindProgram();
-		if (mCurrentFragmentProgram)
-			mCurrentFragmentProgram->bindProgram();
-
 		// Must reset depth/colour write mask to according with user desired, otherwise,
 		// clearFrameBuffer would be wrong because the value we are recorded may be
 		// difference with the really state stored in GL context.
@@ -1786,21 +1711,6 @@ namespace CamelotEngine
 				"Trying to initialize GLRenderSystem from RenderSystemCapabilities that do not support OpenGL");
 		}
 
-		// set texture the number of texture units
-		mFixedFunctionTextureUnits = caps->getNumTextureUnits();
-
-		//In GL there can be less fixed function texture units than general
-		//texture units. Get the minimum of the two.
-		if (caps->hasCapability(RSC_FRAGMENT_PROGRAM))
-		{
-			GLint maxTexCoords = 0;
-			glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &maxTexCoords);
-			if (mFixedFunctionTextureUnits > maxTexCoords)
-			{
-				mFixedFunctionTextureUnits = maxTexCoords;
-			}
-		}
-
 		if(caps->hasCapability(RSC_GL1_5_NOVBO))
 		{
 			// Assign ARB functions same to GL 1.5 version since
@@ -2249,14 +2159,13 @@ namespace CamelotEngine
 	{
 		if(gptype != GPT_VERTEX_PROGRAM && gptype != GPT_FRAGMENT_PROGRAM && gptype != GPT_GEOMETRY_PROGRAM)
 		{
-			LOGWRN("OpenGL cannot assign textures to this gpu program type: " + toString(gptype));
-			return;
+			CM_EXCEPT(InvalidParametersException, "OpenGL cannot assign textures to this gpu program type: " + toString(gptype));
 		}
 
 		UINT32 numSupportedUnits = mCurrentCapabilities->getNumTextureUnits(gptype);
 		if(unit < 0 || unit >= numSupportedUnits)
 		{
-			LOGWRN("Invalid texture unit index for the provided stage. Unit index: " + toString(unit) + ". Stage: " + 
+			CM_EXCEPT(InvalidParametersException, "Invalid texture unit index for the provided stage. Unit index: " + toString(unit) + ". Stage: " + 
 				toString(gptype) + ". Supported range is 0 .. " + toString(numSupportedUnits - 1));
 		}
 
@@ -2314,6 +2223,8 @@ namespace CamelotEngine
 		case GPT_HULL_PROGRAM:
 			return mCurrentHullProgram;
 			break;
+		default:
+			CM_EXCEPT(InvalidParametersException, "Insupported gpu program type: " + toString(gptype));
 		}
 	}
 	/************************************************************************/

+ 7 - 18
CamelotGLRenderer/Source/GLSL/include/CmGLSLGpuProgram.h

@@ -31,8 +31,7 @@ THE SOFTWARE.
 
 // Precompiler options
 #include "CmGLSLExtSupport.h"
-#include "CmGLGpuProgram.h"
-
+#include "CmGpuProgram.h"
 
 namespace CamelotEngine {
 
@@ -45,7 +44,7 @@ namespace CamelotEngine {
 		interface between the GLSLLinkProgramManager , GLRenderSystem, and the active GLSLProgram
 		instances.
 	*/
-    class CM_RSGL_EXPORT GLSLGpuProgram : public GLGpuProgram
+    class CM_RSGL_EXPORT GLSLGpuProgram : public GpuProgram
     {
     private:
 		/// GL Handle for the shader object
@@ -61,35 +60,25 @@ namespace CamelotEngine {
 		static UINT32 mHullShaderCount;
 		/// keep track of the number of domain shaders created
 		static UINT32 mDomainShaderCount;
+
+		UINT32 mProgramID;
+		GLenum mProgramType;
 	public:
 		~GLSLGpuProgram();
 		GLSLGpuProgram(GLSLProgram* parent, const String& source, const String& entryPoint, const String& language, 
 			GpuProgramType gptype, GpuProgramProfile profile);
 
-		/// Execute the binding functions for this program
-		void bindProgram(void);
-		/// Execute the unbinding functions for this program
-		void unbindProgram(void);
-		/// Execute the param binding functions for this program
-		void bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask);
-
 		/// get the GLSLProgram for the shader object
 		GLSLProgram* getGLSLProgram(void) const { return mGLSLProgram; }
-
-		/// @copydoc GLGpuProgram::getAttributeIndex
-		GLuint getAttributeIndex(VertexElementSemantic semantic, UINT32 index);
-		
-		/// @copydoc GLGpuProgram::isAttributeValid
-		bool isAttributeValid(VertexElementSemantic semantic, UINT32 index);
 		
+		/// Get the assigned GL program id
+		const UINT32 getProgramID(void) const { return mProgramID; }
 
     protected:
 		friend class GLSLProgramFactory;
 
         /// Overridden from GpuProgram
         void loadFromSource(void);
-		/// @copydoc Resource::unloadImpl
-		void unloadImpl(void);
 		/// @copydoc Resource::loadImpl
 		void initialize_internal(void);
     };

+ 0 - 122
CamelotGLRenderer/Source/GLSL/include/CmGLSLLinkProgram.h

@@ -1,122 +0,0 @@
-/*
------------------------------------------------------------------------------
-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 __GLSLLinkProgram_H__
-#define __GLSLLinkProgram_H__
-
-#include "CmGLPrerequisites.h"
-#include "CmGpuProgram.h"
-#include "CmHardwareVertexBuffer.h"
-
-namespace CamelotEngine {
-	/// structure used to keep track of named uniforms in the linked program object
-	struct GLUniformReference
-	{
-		/// GL location handle
-		GLint  mLocation;
-		/// Which type of program params will this value come from?
-		GpuProgramType mSourceProgType;
-		/// The constant definition it relates to
-		const GpuConstantDefinition* mConstantDef;
-	};
-
-	typedef vector<GLUniformReference>::type GLUniformReferenceList;
-	typedef GLUniformReferenceList::iterator GLUniformReferenceIterator;
-
-	/** C++ encapsulation of GLSL Program Object
-
-	*/
-
-	class CM_RSGL_EXPORT GLSLLinkProgram
-	{
-	private:
-		/// container of uniform references that are active in the program object
-		GLUniformReferenceList mGLUniformReferences;
-
-		/// Linked vertex program
-		GLSLGpuProgram* mVertexProgram;
-		/// Linked geometry program
-		GLSLGpuProgram* mGeometryProgram;
-		/// Linked fragment program
-		GLSLGpuProgram* mFragmentProgram;
-		/// Linked domain program
-		GLSLGpuProgram* mDomainProgram;
-		/// Linked hull program
-		GLSLGpuProgram* mHullProgram;
-
-		/// flag to indicate that uniform references have already been built
-		bool		mUniformRefsBuilt;
-		/// GL handle for the program object
-		GLhandleARB mGLHandle;
-		/// flag indicating that the program object has been successfully linked
-		GLint		mLinked;
-
-		/// extract attributes
-		void extractAttributes(void);
-
-		typedef set<GLuint>::type AttributeSet;
-		// Custom attribute bindings
-		AttributeSet mValidAttributes;
-
-		/// Name / attribute list
-		struct CustomAttribute
-		{
-			String name;
-			GLuint attrib;
-			CustomAttribute(const String& _name, GLuint _attrib)
-				:name(_name), attrib(_attrib) {}
-		};
-
-		static CustomAttribute msCustomAttributes[];
-
-	public:
-		/// constructor should only be used by GLSLLinkProgramManager
-		GLSLLinkProgram(GLSLGpuProgram* vertexProgram, GLSLGpuProgram* geometryProgram, GLSLGpuProgram* fragmentProgram,
-			GLSLGpuProgram* hullProgram, GLSLGpuProgram* domainProgram);
-		~GLSLLinkProgram(void);
-
-		/** Makes a program object active by making sure it is linked and then putting it in use.
-
-		*/
-		void activate(void);
-
-		/** updates program object uniforms using data from GpuProgramParamters.
-		normally called by GLSLGpuProgram::bindParameters() just before rendering occurs.
-		*/
-		void updateUniforms(GpuProgramParametersSharedPtr params, UINT16 mask, GpuProgramType fromProgType);
-		/// get the GL Handle for the program object
-		GLhandleARB getGLHandle(void) const { return mGLHandle; }
-
-		/// Get the index of a non-standard attribute bound in the linked code
-		GLuint getAttributeIndex(VertexElementSemantic semantic, UINT32 index);
-		/// Is a non-standard attribute bound in the linked code?
-		bool isAttributeValid(VertexElementSemantic semantic, UINT32 index);
-	};
-
-}
-
-#endif // __GLSLLinkProgram_H__

+ 0 - 130
CamelotGLRenderer/Source/GLSL/include/CmGLSLLinkProgramManager.h

@@ -1,130 +0,0 @@
-/*
------------------------------------------------------------------------------
-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 __GLSLLinkProgramManager_H__
-#define __GLSLLinkProgramManager_H__
-
-#include "CmGLPrerequisites.h"
-#include "CmModule.h"
-
-#include "CmGLSLExtSupport.h"
-#include "CmGLSLLinkProgram.h"
-
-namespace CamelotEngine {
-
-
-	/** Camelot assumes that there are seperate shader programs to deal with but
-		GLSL has one program object that represents the active shader objects
-		during a rendering state.  GLSL shader objects are compiled seperately and then attached to a 
-		program object and then theprogram object is linked.  Since Ogre can only handle one vertex 
-		program and one fragmentprogram being active in a pass, the GLSL Link Program Manager does the same.  
-		The GLSL Link program manager acts as a state machine and activates a program object based on the active
-		shader program.  
-	*/
-
-	class CM_RSGL_EXPORT GLSLLinkProgramManager : public Module<GLSLLinkProgramManager>
-	{
-	private:
-		struct LinkProgramKey
-		{
-			UINT32 vertexProgKey;
-			UINT32 fragmentProgKey;
-			UINT32 geometryProgKey;
-			UINT32 hullProgKey;
-			UINT32 domainProgKey;
-		};
-
-		class LinkProgramKeyHashFunction 
-		{
-		public:
-			::std::size_t operator()(const LinkProgramKey &key) const;
-		};
-
-		class LinkProgramKeyEqual 
-		{
-		public:
-			bool operator()(const LinkProgramKey &a, const LinkProgramKey &b) const;
-		};
-	
-		typedef std::unordered_map<LinkProgramKey, GLSLLinkProgram*, LinkProgramKeyHashFunction, LinkProgramKeyEqual> LinkProgramMap;
-		typedef LinkProgramMap::iterator LinkProgramIterator;
-
-		/// container holding previously created program objects 
-		LinkProgramMap mLinkPrograms; 
-
-		/// active objects defining the active rendering gpu state
-		GLSLGpuProgram* mActiveVertexGpuProgram;
-		GLSLGpuProgram* mActiveGeometryGpuProgram;
-		GLSLGpuProgram* mActiveFragmentGpuProgram;
-		GLSLGpuProgram* mActiveHullGpuProgram;
-		GLSLGpuProgram* mActiveDomainGpuProgram;
-		GLSLLinkProgram* mActiveLinkProgram;
-
-		void determineParamInfo(GpuParamMemberDesc& desc, const String& paramName, GLuint programHandle, GLuint uniformIndex);
-
-	public:
-
-		GLSLLinkProgramManager(void);
-		~GLSLLinkProgramManager(void);
-
-		/**
-			Get the program object that links the two active shader objects together
-			if a program object was not already created and linked a new one is created and linked
-		*/
-		GLSLLinkProgram* getActiveLinkProgram(void);
-
-		/** Set the active fragment shader for the next rendering state.
-			The active program object will be cleared.
-		*/
-		void setActiveFragmentShader(GLSLGpuProgram* fragmentGpuProgram);
-
-		/** Set the active geometry shader for the next rendering state.
-			The active program object will be cleared.
-		*/
-		void setActiveGeometryShader(GLSLGpuProgram* geometryGpuProgram);
-
-		/** Set the active vertex shader for the next rendering state.
-			The active program object will be cleared.
-		*/
-		void setActiveVertexShader(GLSLGpuProgram* vertexGpuProgram);
-
-		/** Set the active hull shader for the next rendering state.
-			The active program object will be cleared.
-		*/
-		void setActiveHullShader(GLSLGpuProgram* hullGpuProgram);
-
-		/** Set the active domain shader for the next rendering state.
-			The active program object will be cleared.
-		*/
-		void setActiveDomainShader(GLSLGpuProgram* domainGpuProgram);
-
-		void extractGpuParams(GLSLLinkProgram* linkProgram, GpuParamDesc& returnParamDesc);
-	};
-
-}
-
-#endif // __GLSLLinkProgramManager_H__

+ 0 - 2
CamelotGLRenderer/Source/GLSL/include/CmGLSLProgramFactory.h

@@ -41,8 +41,6 @@ namespace CamelotEngine
     protected:
 		static String sLanguageName;
     public:
-        GLSLProgramFactory(void);
-        ~GLSLProgramFactory(void);
 		/// Get the name of the language this factory creates programs for
 		const String& getLanguage(void) const;
 		/// create an instance of GLSLProgram

+ 2 - 105
CamelotGLRenderer/Source/GLSL/src/CmGLSLGpuProgram.cpp

@@ -29,8 +29,6 @@ THE SOFTWARE.
 #include "CmException.h"
 #include "CmGLSLExtSupport.h"
 #include "CmGLSLGpuProgram.h"
-#include "CmGLSLLinkProgramManager.h"
-#include "CmGLSLLinkProgram.h"
 #include "CmGLSLProgram.h"
 
 namespace CamelotEngine {
@@ -42,8 +40,8 @@ namespace CamelotEngine {
 	UINT32 GLSLGpuProgram::mHullShaderCount = 0;
     //-----------------------------------------------------------------------------
 	GLSLGpuProgram::GLSLGpuProgram(GLSLProgram* parent, const String& source, const String& entryPoint, const String& language, 
-		GpuProgramType gptype, GpuProgramProfile profile) : 
-        GLGpuProgram(source, entryPoint, language, gptype, profile), mGLSLProgram(parent)
+		GpuProgramType gptype, GpuProgramProfile profile) 
+		:GpuProgram(source, entryPoint, language, gptype, profile), mGLSLProgram(parent)
     {
         mType = parent->getType();
         mSyntaxCode = "glsl";
@@ -82,111 +80,10 @@ namespace CamelotEngine {
 		Resource::initialize_internal();
 		// nothing to load
     }
-
-	//-----------------------------------------------------------------------------
-	void GLSLGpuProgram::unloadImpl(void)
-	{
-		// nothing to unload
-	}
-
 	//-----------------------------------------------------------------------------
     void GLSLGpuProgram::loadFromSource(void)
     {
 		// nothing to load
 	}
-
-	//-----------------------------------------------------------------------------
-	void GLSLGpuProgram::bindProgram(void)
-	{
-		// tell the Link Program Manager what shader is to become active
-		switch (mType)
-		{
-		case GPT_VERTEX_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveVertexShader(this);
-			break;
-		case GPT_FRAGMENT_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveFragmentShader(this);
-			break;
-		case GPT_GEOMETRY_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveGeometryShader(this);
-			break;
-		case GPT_DOMAIN_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveDomainShader(this);
-			break;
-		case GPT_HULL_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveHullShader(this);
-		default:
-			CM_EXCEPT(InternalErrorException, "Invalid gpu program type: " + toString(mType));
-		}
-	}
-
-	//-----------------------------------------------------------------------------
-	void GLSLGpuProgram::unbindProgram(void)
-	{
-		// tell the Link Program Manager what shader is to become inactive
-		switch(mType)
-		{
-		case GPT_VERTEX_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveVertexShader(nullptr);
-			break;
-		case GPT_FRAGMENT_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveFragmentShader(nullptr);
-			break;
-		case GPT_GEOMETRY_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveGeometryShader(nullptr);
-			break;
-		case GPT_DOMAIN_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveDomainShader(nullptr);
-			break;
-		case GPT_HULL_PROGRAM:
-			GLSLLinkProgramManager::instance().setActiveHullShader(nullptr);
-			break;
-		default:
-			CM_EXCEPT(InternalErrorException, "Invalid gpu program type: " + toString(mType));
-		}
-	}
-
-	//-----------------------------------------------------------------------------
-	void GLSLGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask)
-	{
-		// activate the link program object
-		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::instance().getActiveLinkProgram();
-		// pass on parameters from params to program object uniforms
-		linkProgram->updateUniforms(params, mask, mType);
-	}
-
-	//-----------------------------------------------------------------------------
-	GLuint GLSLGpuProgram::getAttributeIndex(VertexElementSemantic semantic, UINT32 index)
-	{
-		// get link program - only call this in the context of bound program
-		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::instance().getActiveLinkProgram();
-
-		if (linkProgram->isAttributeValid(semantic, index))
-		{
-			return linkProgram->getAttributeIndex(semantic, index);
-		}
-		else
-		{
-			// fall back to default implementation, allow default bindings
-			return GLGpuProgram::getAttributeIndex(semantic, index);
-		}
-		
-	}
-	//-----------------------------------------------------------------------------
-	bool GLSLGpuProgram::isAttributeValid(VertexElementSemantic semantic, UINT32 index)
-	{
-		// get link program - only call this in the context of bound program
-		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::instance().getActiveLinkProgram();
-
-		if (linkProgram->isAttributeValid(semantic, index))
-		{
-			return true;
-		}
-		else
-		{
-			// fall back to default implementation, allow default bindings
-			return GLGpuProgram::isAttributeValid(semantic, index);
-		}
-	}
 }
 

+ 0 - 424
CamelotGLRenderer/Source/GLSL/src/CmGLSLLinkProgram.cpp

@@ -1,424 +0,0 @@
-/*
------------------------------------------------------------------------------
-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.
------------------------------------------------------------------------------
-*/
-
-#include "CmGLSLExtSupport.h"
-#include "CmGLSLLinkProgram.h"
-#include "CmGLSLGpuProgram.h"
-#include "CmGLSLProgram.h"
-#include "CmGLSLLinkProgramManager.h"
-#include "CmException.h"
-
-namespace CamelotEngine {
-
-	//  a  builtin				custom attrib name
-	// ----------------------------------------------
-	//	0  gl_Vertex			vertex
-	//  1  n/a					blendWeights		
-	//	2  gl_Normal			normal
-	//	3  gl_Color				colour
-	//	4  gl_SecondaryColor	secondary_colour
-	//	5  gl_FogCoord			fog_coord
-	//  7  n/a					blendIndices
-	//	8  gl_MultiTexCoord0	uv0
-	//	9  gl_MultiTexCoord1	uv1
-	//	10 gl_MultiTexCoord2	uv2
-	//	11 gl_MultiTexCoord3	uv3
-	//	12 gl_MultiTexCoord4	uv4
-	//	13 gl_MultiTexCoord5	uv5
-	//	14 gl_MultiTexCoord6	uv6, tangent
-	//	15 gl_MultiTexCoord7	uv7, binormal
-	GLSLLinkProgram::CustomAttribute GLSLLinkProgram::msCustomAttributes[] = {
-		CustomAttribute("vertex", GLGpuProgram::getFixedAttributeIndex(VES_POSITION, 0)),
-		CustomAttribute("blendWeights", GLGpuProgram::getFixedAttributeIndex(VES_BLEND_WEIGHTS, 0)),
-		CustomAttribute("normal", GLGpuProgram::getFixedAttributeIndex(VES_NORMAL, 0)),
-		CustomAttribute("colour", GLGpuProgram::getFixedAttributeIndex(VES_DIFFUSE, 0)),
-		CustomAttribute("secondary_colour", GLGpuProgram::getFixedAttributeIndex(VES_SPECULAR, 0)),
-		CustomAttribute("blendIndices", GLGpuProgram::getFixedAttributeIndex(VES_BLEND_INDICES, 0)),
-		CustomAttribute("uv0", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 0)),
-		CustomAttribute("uv1", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 1)),
-		CustomAttribute("uv2", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 2)),
-		CustomAttribute("uv3", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 3)),
-		CustomAttribute("uv4", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 4)),
-		CustomAttribute("uv5", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 5)),
-		CustomAttribute("uv6", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 6)),
-		CustomAttribute("uv7", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 7)),
-		CustomAttribute("tangent", GLGpuProgram::getFixedAttributeIndex(VES_TANGENT, 0)),
-		CustomAttribute("binormal", GLGpuProgram::getFixedAttributeIndex(VES_BITANGENT, 0)),
-	};
-
-	GLint getGLGeometryInputPrimitiveType(RenderOperation::OperationType operationType, bool requiresAdjacency)
-	{
-		switch (operationType)
-		{
-		case RenderOperation::OT_POINT_LIST:
-			return GL_POINTS;
-		case RenderOperation::OT_LINE_LIST:
-		case RenderOperation::OT_LINE_STRIP:
-			return requiresAdjacency ? GL_LINES_ADJACENCY_EXT : GL_LINES;
-		default:
-		case RenderOperation::OT_TRIANGLE_LIST:
-		case RenderOperation::OT_TRIANGLE_STRIP:
-		case RenderOperation::OT_TRIANGLE_FAN:
-			return requiresAdjacency ? GL_TRIANGLES_ADJACENCY_EXT : GL_TRIANGLES;
-		}
-	}
-	//-----------------------------------------------------------------------
-	GLint getGLGeometryOutputPrimitiveType(RenderOperation::OperationType operationType)
-	{
-		switch (operationType)
-		{
-		case RenderOperation::OT_POINT_LIST:
-			return GL_POINTS;
-		case RenderOperation::OT_LINE_STRIP:
-			return GL_LINE_STRIP;
-		case RenderOperation::OT_TRIANGLE_STRIP:
-			return GL_TRIANGLE_STRIP;
-		default:
-			CM_EXCEPT(RenderingAPIException,
-				"Geometry shader output operation type can only be point list,"
-				"line strip or triangle strip");
-		}
-	}
-	//-----------------------------------------------------------------------
-	GLSLLinkProgram::GLSLLinkProgram(GLSLGpuProgram* vertexProgram, GLSLGpuProgram* geometryProgram, GLSLGpuProgram* fragmentProgram,
-		GLSLGpuProgram* hullProgram, GLSLGpuProgram* domainProgram)
-        : mVertexProgram(vertexProgram)
-		, mGeometryProgram(geometryProgram)
-		, mFragmentProgram(fragmentProgram)
-		, mHullProgram(hullProgram)
-		, mDomainProgram(domainProgram)
-		, mUniformRefsBuilt(false)
-        , mLinked(false)
-
-	{
-		checkForGLSLError("GLSLLinkProgram::GLSLLinkProgram", "Error prior to Creating GLSL Program Object", 0, GLSLOT_PROGRAM);
-		glGetError(); //Clean up the error. Otherwise will flood log.
-		mGLHandle = glCreateProgram();
-		checkForGLSLError("GLSLLinkProgram::GLSLLinkProgram", "Error Creating GLSL Program Object", 0, GLSLOT_PROGRAM);
-
-		// tell shaders to attach themselves to the LinkProgram
-		// let the shaders do the attaching since they may have several children to attach
-		if (mVertexProgram)
-		{
-			glAttachShader(mGLHandle, mVertexProgram->getGLSLProgram()->getGLHandle());
-			checkForGLSLError("GLSLProgram::attachToProgramObject",
-				"Error attaching shader object to GLSL Program Object", mGLHandle, GLSLOT_PROGRAM);
-		}
-
-		if (mGeometryProgram)
-		{
-			glAttachShader(mGLHandle, mGeometryProgram->getGLSLProgram()->getGLHandle());
-			checkForGLSLError("GLSLProgram::attachToProgramObject",
-				"Error attaching shader object to GLSL Program Object", mGLHandle, GLSLOT_PROGRAM);
-		}
-
-		if (mFragmentProgram)
-		{
-			glAttachShader(mGLHandle, mFragmentProgram->getGLSLProgram()->getGLHandle());
-			checkForGLSLError("GLSLProgram::attachToProgramObject",
-				"Error attaching shader object to GLSL Program Object", mGLHandle, GLSLOT_PROGRAM);
-		}
-
-		if (mDomainProgram)
-		{
-			glAttachShader(mGLHandle, mDomainProgram->getGLSLProgram()->getGLHandle());
-			checkForGLSLError("GLSLProgram::attachToProgramObject",
-				"Error attaching shader object to GLSL Program Object", mGLHandle, GLSLOT_PROGRAM);
-		}
-
-		if (mHullProgram)
-		{
-			glAttachShader(mGLHandle, mHullProgram->getGLSLProgram()->getGLHandle());
-			checkForGLSLError("GLSLProgram::attachToProgramObject",
-				"Error attaching shader object to GLSL Program Object", mGLHandle, GLSLOT_PROGRAM);
-		}
-	}
-
-	//-----------------------------------------------------------------------
-	GLSLLinkProgram::~GLSLLinkProgram(void)
-	{
-		glDeleteProgram(mGLHandle);
-	}
-
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgram::activate(void)
-	{
-		if (!mLinked)
-		{
-			if (mVertexProgram)
-			{
-				// Some drivers (e.g. OS X on nvidia) incorrectly determine the attribute binding automatically
-				// and end up aliasing existing built-ins. So avoid! 
-				// Bind all used attribs - not all possible ones otherwise we'll get 
-				// lots of warnings in the log, and also may end up aliasing names used
-				// as varyings by accident
-				// Because we can't ask GL whether an attribute is used in the shader
-				// until it is linked (chicken and egg!) we have to parse the source
-				
-				size_t numAttribs = sizeof(msCustomAttributes)/sizeof(CustomAttribute);
-				const String& vpSource = mVertexProgram->getGLSLProgram()->getSource();
-				for (size_t i = 0; i < numAttribs; ++i)
-				{
-					const CustomAttribute& a = msCustomAttributes[i];
-					
-					// we're looking for either: 
-					//   attribute vec<n> <semantic_name>
-					//   in vec<n> <semantic_name>
-					// The latter is recommended in GLSL 1.3 onwards 
-					// be slightly flexible about formatting
-					String::size_type pos = vpSource.find(a.name);
-					if (pos != String::npos)
-					{
-						String::size_type startpos = vpSource.find("attribute", pos < 20 ? 0 : pos-20);
-						if (startpos == String::npos)
-							startpos = vpSource.find("in", pos-20);
-						if (startpos != String::npos && startpos < pos)
-						{
-							// final check 
-							String expr = vpSource.substr(startpos, pos + a.name.length() - startpos);
-							std::vector<CamelotEngine::String> vec = StringUtil::split(expr);
-							if ((vec[0] == "in" || vec[0] == "attribute") && vec[2] == a.name)
-								glBindAttribLocationARB(mGLHandle, a.attrib, a.name.c_str());
-						}
-
-					}
-				}
-			}
-
-			if (mGeometryProgram)
-			{
-				RenderOperation::OperationType inputOperationType = mGeometryProgram->getGLSLProgram()->getInputOperationType();
-				glProgramParameteriEXT(mGLHandle,GL_GEOMETRY_INPUT_TYPE_EXT,
-					getGLGeometryInputPrimitiveType(inputOperationType, mGeometryProgram->isAdjacencyInfoRequired()));
-				
-				RenderOperation::OperationType outputOperationType = mGeometryProgram->getGLSLProgram()->getOutputOperationType();
-				switch (outputOperationType)
-				{
-				case RenderOperation::OT_POINT_LIST:
-				case RenderOperation::OT_LINE_STRIP:
-				case RenderOperation::OT_TRIANGLE_STRIP:
-                case RenderOperation::OT_LINE_LIST:
-                case RenderOperation::OT_TRIANGLE_LIST:
-                case RenderOperation::OT_TRIANGLE_FAN:
-					break;
-				
-				}
-				glProgramParameteriEXT(mGLHandle,GL_GEOMETRY_OUTPUT_TYPE_EXT,
-					getGLGeometryOutputPrimitiveType(outputOperationType));
-
-				glProgramParameteriEXT(mGLHandle,GL_GEOMETRY_VERTICES_OUT_EXT,
-					mGeometryProgram->getGLSLProgram()->getMaxOutputVertices());
-			}
-
-			glLinkProgramARB( mGLHandle );
-			glGetObjectParameterivARB( mGLHandle, GL_OBJECT_LINK_STATUS_ARB, &mLinked );
-
-			if(!mLinked)
-				logProgramInfo( String("GLSL link FAILED : "), mGLHandle );
-
-			// force logging and raise exception if not linked
-			checkForGLSLError( "GLSLLinkProgram::Activate",
-				"Error linking GLSL Program Object : ", mGLHandle, GLSLOT_PROGRAM, !mLinked, !mLinked );
-
-			if(mLinked)
-			{
-				logProgramInfo( String("GLSL link result : "), mGLHandle );
-				extractAttributes();
-			}
-		}
-
-		if (mLinked)
-		{
-			checkForGLSLError( "GLSLLinkProgram::Activate",
-				"Error prior to using GLSL Program Object : ", mGLHandle, GLSLOT_PROGRAM, false, false);
-
-		    glUseProgramObjectARB( mGLHandle );
-
-			checkForGLSLError( "GLSLLinkProgram::Activate",
-				"Error using GLSL Program Object : ", mGLHandle, GLSLOT_PROGRAM, false, false);
-		}
-	}
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgram::extractAttributes(void)
-	{
-		size_t numAttribs = sizeof(msCustomAttributes)/sizeof(CustomAttribute);
-
-		for (size_t i = 0; i < numAttribs; ++i)
-		{
-			const CustomAttribute& a = msCustomAttributes[i];
-			GLint attrib = glGetAttribLocationARB(mGLHandle, a.name.c_str());
-
-			if (attrib != -1)
-			{
-				mValidAttributes.insert(a.attrib);
-			}
-		}
-	}
-	//-----------------------------------------------------------------------
-	GLuint GLSLLinkProgram::getAttributeIndex(VertexElementSemantic semantic, UINT32 index)
-	{
-		return GLGpuProgram::getFixedAttributeIndex(semantic, index);
-	}
-	//-----------------------------------------------------------------------
-	bool GLSLLinkProgram::isAttributeValid(VertexElementSemantic semantic, UINT32 index)
-	{
-		return mValidAttributes.find(getAttributeIndex(semantic, index)) != mValidAttributes.end();
-	}
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params, 
-		UINT16 mask, GpuProgramType fromProgType)
-	{
-		// iterate through uniform reference list and update uniform values
-		GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
-		GLUniformReferenceIterator endUniform = mGLUniformReferences.end();
-
-		for (;currentUniform != endUniform; ++currentUniform)
-		{
-			// Only pull values from buffer it's supposed to be in (vertex or fragment)
-			// This method will be called twice, once for vertex program params, 
-			// and once for fragment program params.
-			if (fromProgType == currentUniform->mSourceProgType)
-			{
-				const GpuConstantDefinition* def = currentUniform->mConstantDef;
-				if (def->variability & mask)
-				{
-
-					GLsizei glArraySize = (GLsizei)def->arraySize;
-
-					// get the index in the parameter real list
-					switch (def->constType)
-					{
-					case GCT_FLOAT1:
-						glUniform1fvARB(currentUniform->mLocation, glArraySize, 
-							params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_FLOAT2:
-						glUniform2fvARB(currentUniform->mLocation, glArraySize, 
-							params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_FLOAT3:
-						glUniform3fvARB(currentUniform->mLocation, glArraySize, 
-							params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_FLOAT4:
-						glUniform4fvARB(currentUniform->mLocation, glArraySize, 
-							params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_MATRIX_2X2:
-						glUniformMatrix2fvARB(currentUniform->mLocation, glArraySize, 
-							GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_MATRIX_2X3:
-						if (GLEW_VERSION_2_1)
-						{
-							glUniformMatrix2x3fv(currentUniform->mLocation, glArraySize, 
-								GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						}
-						break;
-					case GCT_MATRIX_2X4:
-						if (GLEW_VERSION_2_1)
-						{
-							glUniformMatrix2x4fv(currentUniform->mLocation, glArraySize, 
-								GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						}
-						break;
-					case GCT_MATRIX_3X2:
-						if (GLEW_VERSION_2_1)
-						{
-							glUniformMatrix3x2fv(currentUniform->mLocation, glArraySize, 
-								GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						}
-						break;
-					case GCT_MATRIX_3X3:
-						glUniformMatrix3fvARB(currentUniform->mLocation, glArraySize, 
-							GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_MATRIX_3X4:
-						if (GLEW_VERSION_2_1)
-						{
-							glUniformMatrix3x4fv(currentUniform->mLocation, glArraySize, 
-								GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						}
-						break;
-					case GCT_MATRIX_4X2:
-						if (GLEW_VERSION_2_1)
-						{
-							glUniformMatrix4x2fv(currentUniform->mLocation, glArraySize, 
-								GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						}
-						break;
-					case GCT_MATRIX_4X3:
-						if (GLEW_VERSION_2_1)
-						{
-							glUniformMatrix4x3fv(currentUniform->mLocation, glArraySize, 
-								GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						}
-						break;
-					case GCT_MATRIX_4X4:
-						glUniformMatrix4fvARB(currentUniform->mLocation, glArraySize, 
-							GL_TRUE, params->getFloatPointer(def->physicalIndex));
-						break;
-					case GCT_INT1:
-						glUniform1ivARB(currentUniform->mLocation, glArraySize, 
-							(GLint*)params->getIntPointer(def->physicalIndex));
-						break;
-					case GCT_INT2:
-						glUniform2ivARB(currentUniform->mLocation, glArraySize, 
-							(GLint*)params->getIntPointer(def->physicalIndex));
-						break;
-					case GCT_INT3:
-						glUniform3ivARB(currentUniform->mLocation, glArraySize, 
-							(GLint*)params->getIntPointer(def->physicalIndex));
-						break;
-					case GCT_INT4:
-						glUniform4ivARB(currentUniform->mLocation, glArraySize, 
-							(GLint*)params->getIntPointer(def->physicalIndex));
-						break;
-					case GCT_SAMPLER1D:
-					case GCT_SAMPLER1DSHADOW:
-					case GCT_SAMPLER2D:
-					case GCT_SAMPLER2DSHADOW:
-					case GCT_SAMPLER3D:
-					case GCT_SAMPLERCUBE:
-						// samplers handled like 1-element ints
-						glUniform1iARB(currentUniform->mLocation, def->physicalIndex);
-						
-						break;
-                    case GCT_UNKNOWN:
-                        break;
-
-					} // end switch
-	#if CM_DEBUG_MODE
-					checkForGLSLError( "GLSLLinkProgram::updateUniforms", "Error updating uniform", 0, GLSLOT_PROGRAM);
-	#endif
-				} // variability & mask
-			} // fromProgType == currentUniform->mSourceProgType
-  
-  		} // end for
-	}
-} // namespace CamelotEngine

+ 0 - 176
CamelotGLRenderer/Source/GLSL/src/CmGLSLLinkProgramManager.cpp

@@ -1,176 +0,0 @@
-/*
------------------------------------------------------------------------------
-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.
------------------------------------------------------------------------------
-*/
-
-#include "CmGLSLLinkProgramManager.h"
-#include "CmGLSLGpuProgram.h"
-#include "CmGLSLProgram.h"
-#include "CmGpuParamDesc.h"
-
-namespace CamelotEngine 
-{
-	template <class T>
-	inline void hash_combine(std::size_t& seed, const T& v)
-	{
-		std::hash<T> hasher;
-		seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
-	}
-
-	::std::size_t GLSLLinkProgramManager::LinkProgramKeyHashFunction::operator()(const GLSLLinkProgramManager::LinkProgramKey &key) const
-	{
-		std::size_t seed = 0;
-		hash_combine(seed, key.vertexProgKey);
-		hash_combine(seed, key.fragmentProgKey);
-		hash_combine(seed, key.geometryProgKey);
-		hash_combine(seed, key.hullProgKey);
-		hash_combine(seed, key.domainProgKey);
-
-		return seed;
-	}
-
-	bool GLSLLinkProgramManager::LinkProgramKeyEqual::operator()(const GLSLLinkProgramManager::LinkProgramKey &a, const GLSLLinkProgramManager::LinkProgramKey &b) const
-	{
-		return a.vertexProgKey == b.vertexProgKey && a.fragmentProgKey == b.fragmentProgKey && a.geometryProgKey == b.geometryProgKey &&
-			a.hullProgKey == b.hullProgKey && a.domainProgKey == b.domainProgKey;
-	}
-
-	//-----------------------------------------------------------------------
-	GLSLLinkProgramManager::GLSLLinkProgramManager(void) : mActiveVertexGpuProgram(nullptr),
-		mActiveGeometryGpuProgram(nullptr), mActiveFragmentGpuProgram(nullptr), mActiveHullGpuProgram(nullptr),
-		mActiveDomainGpuProgram(nullptr), mActiveLinkProgram(nullptr)
-	{
-
-	}
-
-	//-----------------------------------------------------------------------
-	GLSLLinkProgramManager::~GLSLLinkProgramManager(void)
-	{
-		// iterate through map container and delete link programs
-		for (LinkProgramIterator currentProgram = mLinkPrograms.begin();
-			currentProgram != mLinkPrograms.end(); ++currentProgram)
-		{
-			delete currentProgram->second;
-		}
-	}
-
-	//-----------------------------------------------------------------------
-	GLSLLinkProgram* GLSLLinkProgramManager::getActiveLinkProgram(void)
-	{
-		// if there is an active link program then return it
-		if (mActiveLinkProgram)
-			return mActiveLinkProgram;
-
-		LinkProgramKey key;
-		key.vertexProgKey = mActiveVertexGpuProgram != nullptr ? mActiveVertexGpuProgram->getProgramID() : 0;
-		key.fragmentProgKey = mActiveFragmentGpuProgram != nullptr ? mActiveFragmentGpuProgram->getProgramID() : 0;
-		key.geometryProgKey = mActiveGeometryGpuProgram != nullptr ? mActiveGeometryGpuProgram->getProgramID() : 0;
-		key.hullProgKey = mActiveHullGpuProgram != nullptr ? mActiveHullGpuProgram->getProgramID() : 0;
-		key.domainProgKey = mActiveDomainGpuProgram != nullptr ? mActiveDomainGpuProgram->getProgramID() : 0;
-
-		// find the key in the hash map
-		LinkProgramIterator programFound = mLinkPrograms.find(key);
-		// program object not found for key so need to create it
-		if (programFound == mLinkPrograms.end())
-		{
-			mActiveLinkProgram = new GLSLLinkProgram(mActiveVertexGpuProgram, mActiveGeometryGpuProgram, mActiveFragmentGpuProgram, mActiveHullGpuProgram, mActiveDomainGpuProgram);
-			mLinkPrograms[key] = mActiveLinkProgram;
-		}
-		else
-		{
-			// found a link program in map container so make it active
-			mActiveLinkProgram = programFound->second;
-		}
-
-		// make the program object active
-		if (mActiveLinkProgram) 
-			mActiveLinkProgram->activate();
-
-		return mActiveLinkProgram;
-	}
-
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgramManager::setActiveFragmentShader(GLSLGpuProgram* fragmentGpuProgram)
-	{
-		if (fragmentGpuProgram != mActiveFragmentGpuProgram)
-		{
-			mActiveFragmentGpuProgram = fragmentGpuProgram;
-			// ActiveLinkProgram is no longer valid
-			mActiveLinkProgram = nullptr;
-			// change back to fixed pipeline
-			glUseProgramObjectARB(0);
-		}
-	}
-
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgramManager::setActiveVertexShader(GLSLGpuProgram* vertexGpuProgram)
-	{
-		if (vertexGpuProgram != mActiveVertexGpuProgram)
-		{
-			mActiveVertexGpuProgram = vertexGpuProgram;
-			// ActiveLinkProgram is no longer valid
-			mActiveLinkProgram = nullptr;
-			// change back to fixed pipeline
-			glUseProgramObjectARB(0);
-		}
-	}
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgramManager::setActiveGeometryShader(GLSLGpuProgram* geometryGpuProgram)
-	{
-		if (geometryGpuProgram != mActiveGeometryGpuProgram)
-		{
-			mActiveGeometryGpuProgram = geometryGpuProgram;
-			// ActiveLinkProgram is no longer valid
-			mActiveLinkProgram = nullptr;
-			// change back to fixed pipeline
-			glUseProgramObjectARB(0);
-		}
-	}
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgramManager::setActiveHullShader(GLSLGpuProgram* hullGpuProgram)
-	{
-		if (hullGpuProgram != mActiveHullGpuProgram)
-		{
-			mActiveHullGpuProgram = hullGpuProgram;
-			// ActiveLinkProgram is no longer valid
-			mActiveLinkProgram = nullptr;
-			// change back to fixed pipeline
-			glUseProgramObjectARB(0);
-		}
-	}
-	//-----------------------------------------------------------------------
-	void GLSLLinkProgramManager::setActiveDomainShader(GLSLGpuProgram* domainGpuProgram)
-	{
-		if (domainGpuProgram != mActiveDomainGpuProgram)
-		{
-			mActiveDomainGpuProgram = domainGpuProgram;
-			// ActiveLinkProgram is no longer valid
-			mActiveLinkProgram = nullptr;
-			// change back to fixed pipeline
-			glUseProgramObjectARB(0);
-		}
-	}
-}

+ 0 - 1
CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp

@@ -35,7 +35,6 @@ THE SOFTWARE.
 #include "CmGLSLProgram.h"
 #include "CmGLSLGpuProgram.h"
 #include "CmGLSLExtSupport.h"
-#include "CmGLSLLinkProgramManager.h"
 #include "CmGLSLPreprocessor.h"
 
 #include "CmGLSLProgramRTTI.h"

+ 0 - 11
CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp

@@ -27,22 +27,11 @@ THE SOFTWARE.
 */
 
 #include "CmGLSLProgramFactory.h"
-#include "CmGLSLLinkProgramManager.h"
 #include "CmGLSLProgram.h"
 
 namespace CamelotEngine {
     //-----------------------------------------------------------------------
     String GLSLProgramFactory::sLanguageName = "glsl";
-    //-----------------------------------------------------------------------
-	GLSLProgramFactory::GLSLProgramFactory(void)
-    {
-		GLSLLinkProgramManager::startUp(new GLSLLinkProgramManager());
-    }
-    //-----------------------------------------------------------------------
-    GLSLProgramFactory::~GLSLProgramFactory(void)
-    {
-		GLSLLinkProgramManager::shutDown();
-    }
     //-----------------------------------------------------------------------
     const String& GLSLProgramFactory::getLanguage(void) const
     {

+ 1 - 0
CamelotRenderer.sln

@@ -17,6 +17,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamelotClient", "CamelotCli
 	ProjectSection(ProjectDependencies) = postProject
 		{9B21D41C-516B-43BF-9B10-E99B599C7589} = {9B21D41C-516B-43BF-9B10-E99B599C7589}
 		{122B7A22-0C62-4B35-B661-EBF3F394EA79} = {122B7A22-0C62-4B35-B661-EBF3F394EA79}
+		{F58FF869-2EA6-4FFF-AB84-328C531BA9D9} = {F58FF869-2EA6-4FFF-AB84-328C531BA9D9}
 		{08975177-4A13-4EE7-BB21-3BB92FB3F3CC} = {08975177-4A13-4EE7-BB21-3BB92FB3F3CC}
 		{7F449698-73DF-4203-9F31-0877DBF01695} = {7F449698-73DF-4203-9F31-0877DBF01695}
 		{BFEBBAF8-8A84-4899-8899-D0D7196AF9A1} = {BFEBBAF8-8A84-4899-8899-D0D7196AF9A1}

+ 0 - 2
CamelotRenderer/Include/CmDeferredRenderContext.h

@@ -69,8 +69,6 @@ namespace CamelotEngine
 
 		/** @copydoc RenderSystem::bindGpuProgram() */
 		void bindGpuProgram(GpuProgramHandle prg);
-		/** @copydoc RenderSystem::bindGpuProgramParameters() */
-		void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
 		/** @copydoc RenderSystem::unbindGpuProgram() */
 		void unbindGpuProgram(GpuProgramType gptype);
 		/** @copydoc RenderSystem::bindGpuParams() */

+ 29 - 1
CamelotRenderer/Include/CmGpuProgram.h

@@ -32,7 +32,6 @@ THE SOFTWARE.
 #include "CmPrerequisites.h"
 #include "CmRenderOperation.h"
 #include "CmGpuProgramParams.h"
-#include "CmRenderSystemCapabilities.h"
 #include "CmResource.h"
 #include "CmGpuParamDesc.h"
 
@@ -55,6 +54,35 @@ namespace CamelotEngine {
 		GPT_COMPUTE_PROGRAM
 	};
 
+	enum GpuProgramProfile
+	{
+		GPP_NONE,
+		GPP_PS_1_1,
+		GPP_PS_1_2,
+		GPP_PS_1_3,
+		GPP_PS_1_4,
+		GPP_PS_2_0,
+		GPP_PS_2_x,
+		GPP_PS_2_a,
+		GPP_PS_2_b,
+		GPP_PS_3_0,
+		GPP_PS_3_x,
+		GPP_PS_4_0,
+		GPP_PS_5_0,
+		GPP_VS_1_1,
+		GPP_VS_2_0,
+		GPP_VS_2_x,
+		GPP_VS_2_a,
+		GPP_VS_3_0,
+		GPP_VS_4_0,
+		GPP_VS_5_0,
+		GPP_GS_4_0,
+		GPP_GS_5_0,
+		GPP_HS_5_0,
+		GPP_DS_5_0,
+		GPP_CS_5_0
+	};
+
 	/** Defines a program which runs on the GPU such as a vertex or fragment program. 
 	@remarks
 		This class defines the low-level program in assembler code, the sort used to

+ 0 - 7
CamelotRenderer/Include/CmGpuProgramManager.h

@@ -73,13 +73,6 @@ namespace CamelotEngine {
 		*  Returns an empty string if it can't convert it.
 		*/
 		virtual String gpuProgProfileToRSSpecificProfile(GpuProgramProfile gpuProgProfile) const;
-
-		/** Creates a new GpuProgramParameters instance which can be used to bind
-            parameters to your programs.
-        @remarks
-            Program parameters can be shared between multiple programs if you wish.
-        */
-        virtual GpuProgramParametersSharedPtr createParameters(void);
         
 		/** Create a GPU program from a string of assembly code.
         @remarks    

+ 0 - 3
CamelotRenderer/Include/CmPrerequisites.h

@@ -28,7 +28,6 @@ THE SOFTWARE
 
 #include "CmPrerequisitesUtil.h"
 
-#define CM_MAX_TEXTURE_LAYERS 16
 #define CM_MAX_MULTIPLE_RENDER_TARGETS 8
 
 //----------------------------------------------------------------------------
@@ -70,7 +69,6 @@ namespace CamelotEngine {
     class Color;
     class GpuProgram;
     class GpuProgramManager;
-	class GpuProgramParameters;
     class HardwareIndexBuffer;
     class HardwareOcclusionQuery;
     class HardwareVertexBuffer;
@@ -146,7 +144,6 @@ namespace CamelotEngine {
 namespace CamelotEngine
 {
 	typedef std::shared_ptr<GpuProgram> GpuProgramPtr;
-	typedef std::shared_ptr<GpuProgramParameters> GpuProgramParametersPtr;
 	typedef std::shared_ptr<HighLevelGpuProgram> HighLevelGpuProgramPtr;
 	typedef std::shared_ptr<HardwarePixelBuffer> HardwarePixelBufferPtr;
 	typedef std::shared_ptr<VertexDeclaration> VertexDeclarationPtr;

+ 0 - 12
CamelotRenderer/Include/CmRenderSystem.h

@@ -236,14 +236,6 @@ namespace CamelotEngine
 		*/
 		virtual void bindGpuProgram(GpuProgramHandle prg);
 
-		/** Bind Gpu program parameters.
-		@param gptype The type of program to bind the parameters to
-		@param params The parameters to bind
-		@param variabilityMask A mask of GpuParamVariability identifying which params need binding
-		*/
-		virtual void bindGpuProgramParameters(GpuProgramType gptype, 
-			GpuProgramParametersSharedPtr params, UINT16 variabilityMask) = 0;
-
 		/** Bind Gpu program parameters.
 		@param gptype The type of program to bind the parameters to
 		@param params The parameters to bind
@@ -376,10 +368,6 @@ namespace CamelotEngine
 		RenderTargetPriorityMap mPrioritisedRenderTargets;
 		/** The Active render target. */
 		RenderTarget* mActiveRenderTarget;
-		/** The Active GPU programs and gpu program parameters*/
-		GpuProgramParametersSharedPtr mActiveVertexGpuProgramParameters;
-		GpuProgramParametersSharedPtr mActiveGeometryGpuProgramParameters;
-		GpuProgramParametersSharedPtr mActiveFragmentGpuProgramParameters;
 
 		// Active viewport (dest for future rendering operations)
 		Viewport mActiveViewport;

+ 7 - 32
CamelotRenderer/Include/CmRenderSystemCapabilities.h

@@ -228,35 +228,6 @@ namespace CamelotEngine
 		GPU_VENDOR_COUNT = 11
 	};
 
-	enum GpuProgramProfile
-	{
-		GPP_NONE,
-		GPP_PS_1_1,
-		GPP_PS_1_2,
-		GPP_PS_1_3,
-		GPP_PS_1_4,
-		GPP_PS_2_0,
-		GPP_PS_2_x,
-		GPP_PS_2_a,
-		GPP_PS_2_b,
-		GPP_PS_3_0,
-		GPP_PS_3_x,
-		GPP_PS_4_0,
-		GPP_PS_5_0,
-		GPP_VS_1_1,
-		GPP_VS_2_0,
-		GPP_VS_2_x,
-		GPP_VS_2_a,
-		GPP_VS_3_0,
-		GPP_VS_4_0,
-		GPP_VS_5_0,
-		GPP_GS_4_0,
-		GPP_GS_5_0,
-		GPP_HS_5_0,
-		GPP_DS_5_0,
-		GPP_CS_5_0
-	};
-
 	/** singleton class for storing the capabilities of the graphics card. 
 	@remarks
 	This class stores the capabilities of the graphics card.  This
@@ -405,7 +376,7 @@ namespace CamelotEngine
 			mNumTextureUnitsPerStage[type] = num;
 		}
 
-		void setNumCombinedTextureUnits(UINT16 num) const
+		void setNumCombinedTextureUnits(UINT16 num)
 		{
 			mNumCombinedTextureUnits = num;
 		}
@@ -434,9 +405,13 @@ namespace CamelotEngine
 		/** Returns the number of texture units the current output hardware
 		supports, for the specified stage.
 		*/
-		UINT16 getNumTextureUnits(GpuProgramType stage) const
+		UINT16 getNumTextureUnits(GpuProgramType type) const
 		{
-			return mNumTextureUnitsPerStage[type];
+			auto iterFind = mNumTextureUnitsPerStage.find(type);
+			if(iterFind != mNumTextureUnitsPerStage.end())
+				return iterFind->second;
+			else
+				return 0;
 		}
 
 		/** Returns the number of texture units the current output hardware

+ 0 - 7
CamelotRenderer/Source/CmDeferredRenderContext.cpp

@@ -112,13 +112,6 @@ namespace CamelotEngine
 		mCommandQueue->queue(boost::bind(&RenderSystem::unbindGpuProgram, mRenderSystem, gptype));
 	}
 
-	void DeferredRenderContext::bindGpuProgramParameters(GpuProgramType gptype, 
-		GpuProgramParametersSharedPtr params, UINT16 variabilityMask)
-	{
-		GpuProgramParametersSharedPtr paramCopy = GpuProgramParametersSharedPtr(new GpuProgramParameters(*params));
-		mCommandQueue->queue(boost::bind(&RenderSystem::bindGpuProgramParameters, mRenderSystem, gptype, paramCopy, variabilityMask));
-	}
-
 	void DeferredRenderContext::bindGpuParams(GpuProgramType gptype, GpuParamsPtr params)
 	{
 		GpuParamsPtr paramCopy = params->clone();

+ 7 - 14
CamelotRenderer/Source/CmGpuProgramManager.cpp

@@ -60,15 +60,14 @@ namespace CamelotEngine {
         return prg;
     }
     //---------------------------------------------------------------------------
-		const GpuProgramManager::SyntaxCodes& GpuProgramManager::getSupportedSyntax(void) const
-        {
-			// Use the current render system
-			RenderSystem* rs = CamelotEngine::RenderSystem::instancePtr();
-
-			// Get the supported syntaxed from RenderSystemCapabilities 
-			return rs->getCapabilities()->getSupportedShaderProfiles();
-        }
+	const GpuProgramManager::SyntaxCodes& GpuProgramManager::getSupportedSyntax(void) const
+    {
+		// Use the current render system
+		RenderSystem* rs = CamelotEngine::RenderSystem::instancePtr();
 
+		// Get the supported syntaxed from RenderSystemCapabilities 
+		return rs->getCapabilities()->getSupportedShaderProfiles();
+    }
     //---------------------------------------------------------------------------
     bool GpuProgramManager::isSyntaxSupported(const String& syntaxCode) const
         {
@@ -87,10 +86,4 @@ namespace CamelotEngine {
 
 		return  rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(gpuProgProfile);
 	}
-	//-----------------------------------------------------------------------------
-	GpuProgramParametersSharedPtr GpuProgramManager::createParameters(void)
-	{
-		return GpuProgramParametersSharedPtr(new GpuProgramParameters());
-	}
-	//---------------------------------------------------------------------
 }

+ 2 - 2
CamelotRenderer/Source/CmHighLevelGpuProgram.cpp

@@ -65,9 +65,9 @@ namespace CamelotEngine
 			{
 				mAssemblerProgram->initialize_internal();
 			}
-
-			Resource::initialize_internal();
 		}
+
+		Resource::initialize_internal();
     }
     //---------------------------------------------------------------------------
     void HighLevelGpuProgram::unload_internal()