Просмотр исходного кода

Removing unused stuff from GpuPrograms

Marko Pintera 13 лет назад
Родитель
Сommit
655f82b5a4
37 измененных файлов с 174 добавлено и 265 удалено
  1. 12 18
      CamelotClient/CamelotClient.cpp
  2. 3 3
      CamelotD3D9Renderer/Include/CmD3D9GpuProgram.h
  3. 1 1
      CamelotD3D9Renderer/Include/CmD3D9GpuProgramManager.h
  4. 2 3
      CamelotD3D9Renderer/Include/CmD3D9HLSLProgram.h
  5. 1 1
      CamelotD3D9Renderer/Include/CmD3D9HLSLProgramFactory.h
  6. 6 6
      CamelotD3D9Renderer/Source/CmD3D9GpuProgram.cpp
  7. 3 3
      CamelotD3D9Renderer/Source/CmD3D9GpuProgramManager.cpp
  8. 6 3
      CamelotD3D9Renderer/Source/CmD3D9HLSLProgram.cpp
  9. 3 6
      CamelotD3D9Renderer/Source/CmD3D9HLSLProgramFactory.cpp
  10. 5 7
      CamelotGLRenderer/Include/CmGLGpuProgram.h
  11. 2 2
      CamelotGLRenderer/Include/CmGLGpuProgramManager.h
  12. 7 10
      CamelotGLRenderer/Source/CmGLGpuProgram.cpp
  13. 4 4
      CamelotGLRenderer/Source/CmGLGpuProgramManager.cpp
  14. 6 8
      CamelotGLRenderer/Source/CmGLRenderSystem.cpp
  15. 2 1
      CamelotGLRenderer/Source/GLSL/include/CmGLSLGpuProgram.h
  16. 4 1
      CamelotGLRenderer/Source/GLSL/include/CmGLSLProgram.h
  17. 1 1
      CamelotGLRenderer/Source/GLSL/include/CmGLSLProgramFactory.h
  18. 3 2
      CamelotGLRenderer/Source/GLSL/src/CmGLSLGpuProgram.cpp
  19. 3 3
      CamelotGLRenderer/Source/GLSL/src/CmGLSLLinkProgram.cpp
  20. 13 13
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp
  21. 3 6
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp
  22. 3 2
      CamelotGLRenderer/Source/atifs/include/ATI_FS_GLGpuProgram.h
  23. 3 2
      CamelotGLRenderer/Source/atifs/src/ATI_FS_GLGpuProgram.cpp
  24. 2 8
      CamelotRenderer/Include/CmCgProgram.h
  25. 1 1
      CamelotRenderer/Include/CmCgProgramFactory.h
  26. 3 20
      CamelotRenderer/Include/CmGpuProgram.h
  27. 2 17
      CamelotRenderer/Include/CmGpuProgramManager.h
  28. 36 36
      CamelotRenderer/Include/CmHighLevelGpuProgram.h
  29. 1 1
      CamelotRenderer/Include/CmHighLevelGpuProgramManager.h
  30. 5 15
      CamelotRenderer/Source/CmCgProgram.cpp
  31. 3 6
      CamelotRenderer/Source/CmCgProgramFactory.cpp
  32. 10 19
      CamelotRenderer/Source/CmGpuProgram.cpp
  33. 3 18
      CamelotRenderer/Source/CmGpuProgramManager.cpp
  34. 0 5
      CamelotRenderer/Source/CmGpuProgramParams.cpp
  35. 7 4
      CamelotRenderer/Source/CmHighLevelGpuProgram.cpp
  36. 4 8
      CamelotRenderer/Source/CmHighLevelGpuProgramManager.cpp
  37. 1 1
      CamelotRenderer/TODO.txt

+ 12 - 18
CamelotClient/CamelotClient.cpp

@@ -27,8 +27,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 = RenderSystemManager::getActive();
 	RenderWindow* renderWindow = gApplication().getPrimaryRenderWindow();
@@ -59,7 +59,6 @@ int _tmain(int argc, _TCHAR* argv[])
 	//						}";
 
 	//fragProg =  HighLevelGpuProgram::create(fragShaderCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-	//fragProg->load();
 
 	//String vertShaderCode = "float4x4 matViewProjection;	\
 	//						void vs_main(										\
@@ -73,9 +72,6 @@ int _tmain(int argc, _TCHAR* argv[])
 	//						}";
 
 	//vertProg =  HighLevelGpuProgram::create(vertShaderCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-	//vertProg->load();
-
-
 
 	/////////////////// CG SHADERS //////////////////////////
 	String fragShaderCode = "sampler2D tex;					\
@@ -100,16 +96,6 @@ int _tmain(int argc, _TCHAR* argv[])
 
 	vertProg =  HighLevelGpuProgram::create(vertShaderCode, "vs_main", "cg", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
 
-	HighLevelGpuProgramHandle vertProgRef(vertProg);
-
-	gResources().create(vertProgRef, "C:\\vertProgCg.vprog", true);
-	vertProgRef = static_resource_cast<HighLevelGpuProgram>(gResources().load("C:\\vertProgCg.vprog"));
-
-	HighLevelGpuProgramHandle fragProgRef(fragProg);
-
-	gResources().create(fragProgRef, "C:\\fragProgCg.vprog", true);
-	fragProgRef = static_resource_cast<HighLevelGpuProgram>(gResources().load("C:\\fragProgCg.vprog"));
-
 	///////////////// GLSL SHADERS ////////////////////////////
 	//String fragShaderCode = "uniform sampler2D tex; \
 	//							void main() \
@@ -119,7 +105,6 @@ int _tmain(int argc, _TCHAR* argv[])
 	//							  }";
 
 	//fragProg = HighLevelGpuProgram::create(fragShaderCode, "main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-	//fragProg->load();
 
 	//// TODO - Ogres GLSL parsing requires some strict parameter naming, can that be avoided?
 	//String vertShaderCode = "uniform mat4 matViewProjection; \
@@ -131,7 +116,16 @@ int _tmain(int argc, _TCHAR* argv[])
 	//							  }";
 
 	//vertProg = HighLevelGpuProgram::create(vertShaderCode, "main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-	//vertProg->load();
+
+	HighLevelGpuProgramHandle vertProgRef(vertProg);
+
+	gResources().create(vertProgRef, "C:\\vertProgCg.vprog", true);
+	vertProgRef = static_resource_cast<HighLevelGpuProgram>(gResources().load("C:\\vertProgCg.vprog"));
+
+	HighLevelGpuProgramHandle fragProgRef(fragProg);
+
+	gResources().create(fragProgRef, "C:\\fragProgCg.vprog", true);
+	fragProgRef = static_resource_cast<HighLevelGpuProgram>(gResources().load("C:\\fragProgCg.vprog"));
 
 	ShaderPtr testShader = ShaderPtr(new Shader("TestShader"));
 	TechniquePtr newTechniqueGL = testShader->addTechnique("GLRenderSystem", "ForwardRenderer");

+ 3 - 3
CamelotD3D9Renderer/Include/CmD3D9GpuProgram.h

@@ -65,7 +65,7 @@ namespace CamelotEngine {
     protected:
 		friend class D3D9GpuProgramManager;
 
-		D3D9GpuProgram();
+		D3D9GpuProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
         /** Overridden from GpuProgram */
         void loadFromSource(void);
@@ -109,7 +109,7 @@ namespace CamelotEngine {
     protected:
 		friend class D3D9GpuProgramManager;
 
-		D3D9GpuVertexProgram();
+		D3D9GpuVertexProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
         void loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode);
 
@@ -140,7 +140,7 @@ namespace CamelotEngine {
     protected:
 		friend class D3D9GpuProgramManager;
 
-		D3D9GpuFragmentProgram();
+		D3D9GpuFragmentProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
         void loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode);
 

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9GpuProgramManager.h

@@ -41,7 +41,7 @@ namespace CamelotEngine {
 		~D3D9GpuProgramManager();
 
 	protected:
-		GpuProgram* create( GpuProgramType gptype, const String& syntaxCode);
+		GpuProgram* create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
     };
 
 }

+ 2 - 3
CamelotD3D9Renderer/Include/CmD3D9HLSLProgram.h

@@ -67,8 +67,6 @@ namespace CamelotEngine {
     public:
         ~D3D9HLSLProgram();
 
-        /** Sets the entry point for this program ie the first method called. */
-        void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
         /** Gets the entry point defined for this program. */
         const String& getEntryPoint(void) const { return mEntryPoint; }
         /** Sets the shader target to compile down to, e.g. 'vs_1_1'. */
@@ -101,7 +99,8 @@ namespace CamelotEngine {
     protected:
 		friend class D3D9HLSLProgramFactory;
 
-		D3D9HLSLProgram();
+		D3D9HLSLProgram(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
 
         /** Internal load implementation, must be implemented by subclasses.
         */

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9HLSLProgramFactory.h

@@ -43,7 +43,7 @@ namespace CamelotEngine
         ~D3D9HLSLProgramFactory();
 		/// Get the name of the language this factory creates programs for
 		const String& getLanguage(void) const;
-        HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
+        HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 		HighLevelGpuProgram* create();
 		void destroy_internal(HighLevelGpuProgram* prog);
 

+ 6 - 6
CamelotD3D9Renderer/Source/CmD3D9GpuProgram.cpp

@@ -34,8 +34,8 @@ THE SOFTWARE.
 
 namespace CamelotEngine {
     //-----------------------------------------------------------------------------
-    D3D9GpuProgram::D3D9GpuProgram() 
-        : GpuProgram(), mpExternalMicrocode(NULL), mColumnMajorMatrices(false)
+    D3D9GpuProgram::D3D9GpuProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) 
+        : GpuProgram(source, entryPoint, language, gptype, profile), mpExternalMicrocode(NULL), mColumnMajorMatrices(false)
     {
     }
 
@@ -169,8 +169,8 @@ namespace CamelotEngine {
         params->setTransposeMatrices(mColumnMajorMatrices);
     }	
 	//-----------------------------------------------------------------------------
-    D3D9GpuVertexProgram::D3D9GpuVertexProgram() 
-        : D3D9GpuProgram()       
+	D3D9GpuVertexProgram::D3D9GpuVertexProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) 
+        : D3D9GpuProgram(source, entryPoint, language, gptype, profile)       
     {
         mType = GPT_VERTEX_PROGRAM;		
     }
@@ -275,8 +275,8 @@ namespace CamelotEngine {
 
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-    D3D9GpuFragmentProgram::D3D9GpuFragmentProgram() 
-        : D3D9GpuProgram()       
+    D3D9GpuFragmentProgram::D3D9GpuFragmentProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) 
+		: D3D9GpuProgram(source, entryPoint, language, gptype, profile)       
     {
         mType = GPT_FRAGMENT_PROGRAM;
     }

+ 3 - 3
CamelotD3D9Renderer/Source/CmD3D9GpuProgramManager.cpp

@@ -42,15 +42,15 @@ namespace CamelotEngine {
 
     }
     //-----------------------------------------------------------------------------
-    GpuProgram* D3D9GpuProgramManager::create(GpuProgramType gptype, const String& syntaxCode)
+    GpuProgram* D3D9GpuProgramManager::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
     {
         if (gptype == GPT_VERTEX_PROGRAM)
         {
-            return new D3D9GpuVertexProgram();
+            return new D3D9GpuVertexProgram(source, entryPoint, language, gptype, profile);
         }
         else
         {
-            return new D3D9GpuFragmentProgram();
+            return new D3D9GpuFragmentProgram(source, entryPoint, language, gptype, profile);
         }
     }
 }

+ 6 - 3
CamelotD3D9Renderer/Source/CmD3D9HLSLProgram.cpp

@@ -241,8 +241,10 @@ namespace CamelotEngine {
 			mAssemblerProgram = 
 				GpuProgramManager::instance().createProgram(
 					"",// dummy source, since we'll be using microcode
+					"",
+					hlslProfile,
 					mType, 
-					hlslProfile);
+					GPP_NONE);
 			static_cast<D3D9GpuProgram*>(mAssemblerProgram.get())->setExternalMicrocode(mpMicroCode);
 		}
 
@@ -522,8 +524,9 @@ namespace CamelotEngine {
 	}
 
     //-----------------------------------------------------------------------
-    D3D9HLSLProgram::D3D9HLSLProgram()
-        : HighLevelGpuProgram()
+	D3D9HLSLProgram::D3D9HLSLProgram(const String& source, const String& entryPoint, const String& language, 
+		GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+        : HighLevelGpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired)
         , mPreprocessorDefines()
         , mColumnMajorMatrices(true)
         , mpMicroCode(NULL), mpConstTable(NULL)

+ 3 - 6
CamelotD3D9Renderer/Source/CmD3D9HLSLProgramFactory.cpp

@@ -47,19 +47,16 @@ namespace CamelotEngine {
         return sLanguageName;
     }
     //-----------------------------------------------------------------------
-    HighLevelGpuProgram* D3D9HLSLProgramFactory::create(const String& source, const String& entryPoint, GpuProgramProfile profile)
+	HighLevelGpuProgram* D3D9HLSLProgramFactory::create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
     {
-		D3D9HLSLProgram* prog = new D3D9HLSLProgram();
-		prog->setSource(source);
-		prog->setEntryPoint(entryPoint);
-		prog->setProfile(profile);
+		D3D9HLSLProgram* prog = new D3D9HLSLProgram(source, entryPoint, sLanguageName, gptype, profile);
 
         return prog;
     }
 	//-----------------------------------------------------------------------
 	HighLevelGpuProgram* D3D9HLSLProgramFactory::create()
 	{
-		D3D9HLSLProgram* prog = new D3D9HLSLProgram();
+		D3D9HLSLProgram* prog = new D3D9HLSLProgram("", "", sLanguageName, GPT_VERTEX_PROGRAM, GPP_NONE);
 
 		return prog;
 	}

+ 5 - 7
CamelotGLRenderer/Include/CmGLGpuProgram.h

@@ -67,7 +67,8 @@ namespace CamelotEngine {
 		static GLuint getFixedAttributeIndex(VertexElementSemantic semantic, UINT32 index);
 
     protected:
-		GLGpuProgram();
+		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) {}
@@ -84,10 +85,6 @@ namespace CamelotEngine {
     public:
         virtual ~GLArbGpuProgram();
 
-        /// @copydoc GpuProgram::setType
-        void setType(GpuProgramType t);
-
-
         /// Execute the binding functions for this program
         void bindProgram(void);
         /// Execute the unbinding functions for this program
@@ -100,9 +97,10 @@ namespace CamelotEngine {
         { return mProgramType; }
 
     protected:
-		friend GpuProgram* createGLArbGpuProgram(GpuProgramType gptype, const String& syntaxCode);
+		friend GpuProgram* createGLArbGpuProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
-		GLArbGpuProgram();
+		GLArbGpuProgram(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
 
         void loadFromSource(void);
         /// @copydoc Resource::unloadImpl

+ 2 - 2
CamelotGLRenderer/Include/CmGLGpuProgramManager.h

@@ -37,7 +37,7 @@ namespace CamelotEngine {
 class CM_RSGL_EXPORT GLGpuProgramManager : public GpuProgramManager
 {
 public:
-    typedef GpuProgram* (*CreateGpuProgramCallback)(GpuProgramType gptype, const String& syntaxCode);
+    typedef GpuProgram* (*CreateGpuProgramCallback)(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
 private:
     typedef map<String, CreateGpuProgramCallback>::type ProgramMap;
@@ -45,7 +45,7 @@ private:
 
 protected:
     /// Specialised create method with specific parameters
-    GpuProgram* create(GpuProgramType gptype, const String& syntaxCode);
+    GpuProgram* create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
 public:
     GLGpuProgramManager();

+ 7 - 10
CamelotGLRenderer/Source/CmGLGpuProgram.cpp

@@ -45,8 +45,9 @@ GLenum getGLShaderType(GpuProgramType programType)
 	}
 }
 
-GLGpuProgram::GLGpuProgram() 
-    : GpuProgram()
+GLGpuProgram::GLGpuProgram(const String& source, const String& entryPoint, const String& language, 
+						   GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired) 
+    : GpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired)
 {
     //if (createParamDictionary("GLGpuProgram"))
     //{
@@ -136,10 +137,12 @@ bool GLGpuProgram::isAttributeValid(VertexElementSemantic semantic, CamelotEngin
     return false;
 }
 
-GLArbGpuProgram::GLArbGpuProgram() 
-    : GLGpuProgram()
+GLArbGpuProgram::GLArbGpuProgram(const String& source, const String& entryPoint, const String& language, 
+								 GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired) 
+	: GLGpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired)
 {
     glGenProgramsARB(1, &mProgramID);
+	mProgramType = getGLShaderType(gptype);
 }
 
 GLArbGpuProgram::~GLArbGpuProgram()
@@ -149,12 +152,6 @@ GLArbGpuProgram::~GLArbGpuProgram()
     unload(); 
 }
 
-void GLArbGpuProgram::setType(GpuProgramType t)
-{
-    GLGpuProgram::setType(t);
-	mProgramType = getGLShaderType(t);
-}
-
 void GLArbGpuProgram::bindProgram(void)
 {
     glEnable(mProgramType);

+ 4 - 4
CamelotGLRenderer/Source/CmGLGpuProgramManager.cpp

@@ -52,14 +52,14 @@ bool GLGpuProgramManager::unregisterProgramFactory(const String& syntaxCode)
     return mProgramMap.erase(syntaxCode) != 0;
 }
 
-GpuProgram* GLGpuProgramManager::create(GpuProgramType gptype, const String& syntaxCode)
+GpuProgram* GLGpuProgramManager::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
 {
-    ProgramMap::const_iterator iter = mProgramMap.find(syntaxCode);
+    ProgramMap::const_iterator iter = mProgramMap.find(language);
     if(iter == mProgramMap.end())
     {
-        CM_EXCEPT(InternalErrorException, "Cannot find propery factory to create GpuProgram of type: " + syntaxCode);
+        CM_EXCEPT(InternalErrorException, "Cannot find propery factory to create GpuProgram of type: " + language);
     }
     
-    return (iter->second)(gptype, syntaxCode);
+    return (iter->second)(source, entryPoint, language, gptype, profile);
 }
 

+ 6 - 8
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -63,19 +63,17 @@ GLenum glewContextInit (CamelotEngine::GLSupport *glSupport);
 namespace CamelotEngine {
 
 	// Callback function used when registering GLGpuPrograms
-	GpuProgram* createGLArbGpuProgram(GpuProgramType gptype, const String& syntaxCode)
+	GpuProgram* createGLArbGpuProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
 	{
-		GLArbGpuProgram* ret = new GLArbGpuProgram();
-		ret->setType(gptype);
-		ret->setSyntaxCode(syntaxCode);
+		GLArbGpuProgram* ret = new GLArbGpuProgram(source, entryPoint, language, gptype, profile);
+
 		return ret;
 	}
 
-	GpuProgram* createGL_ATI_FS_GpuProgram(GpuProgramType gptype, const String& syntaxCode)
+	GpuProgram* createGL_ATI_FS_GpuProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
 	{
-		ATI_FS_GLGpuProgram* ret = new ATI_FS_GLGpuProgram();
-		ret->setType(gptype);
-		ret->setSyntaxCode(syntaxCode);
+		ATI_FS_GLGpuProgram* ret = new ATI_FS_GLGpuProgram(source, entryPoint, language, gptype, profile);
+
 		return ret;
 	}
 

+ 2 - 1
CamelotGLRenderer/Source/GLSL/include/CmGLSLGpuProgram.h

@@ -60,7 +60,8 @@ namespace CamelotEngine {
 
 	public:
 		~GLSLGpuProgram();
-		GLSLGpuProgram(GLSLProgram* parent);
+		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);

+ 4 - 1
CamelotGLRenderer/Source/GLSL/include/CmGLSLProgram.h

@@ -56,7 +56,6 @@ namespace CamelotEngine {
     class CM_RSGL_EXPORT GLSLProgram : public HighLevelGpuProgram
     {
     public:
-        GLSLProgram();
 		~GLSLProgram();
 
 		const GLhandleARB getGLHandle() const { return mGLHandle; }
@@ -108,6 +107,10 @@ namespace CamelotEngine {
 		{ mMaxOutputVertices = maxOutputVertices; }
 
 	protected:
+		friend class GLSLProgramFactory;
+
+		GLSLProgram(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
 
         /** Internal load implementation, must be implemented by subclasses.
         */

+ 1 - 1
CamelotGLRenderer/Source/GLSL/include/CmGLSLProgramFactory.h

@@ -46,7 +46,7 @@ namespace CamelotEngine
 		/// Get the name of the language this factory creates programs for
 		const String& getLanguage(void) const;
 		/// create an instance of GLSLProgram
-        HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
+        HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 		HighLevelGpuProgram* create();
 		void destroy_internal(HighLevelGpuProgram* prog);
     };

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

@@ -39,8 +39,9 @@ namespace CamelotEngine {
 	GLuint GLSLGpuProgram::mFragmentShaderCount = 0;
 	GLuint GLSLGpuProgram::mGeometryShaderCount = 0;
     //-----------------------------------------------------------------------------
-	GLSLGpuProgram::GLSLGpuProgram(GLSLProgram* parent) : 
-        GLGpuProgram(), mGLSLProgram(parent)
+	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)
     {
         mType = parent->getType();
         mSyntaxCode = "glsl";

+ 3 - 3
CamelotGLRenderer/Source/GLSL/src/CmGLSLLinkProgram.cpp

@@ -280,15 +280,15 @@ namespace CamelotEngine {
 			const GpuConstantDefinitionMap* geomParams = 0;
 			if (mVertexProgram)
 			{
-				vertParams = &(mVertexProgram->getGLSLProgram()->getConstantDefinitions().map);
+				vertParams = &(mVertexProgram->getGLSLProgram()->getConstantDefinitions_internal().map);
 			}
 			if (mGeometryProgram)
 			{
-				geomParams = &(mGeometryProgram->getGLSLProgram()->getConstantDefinitions().map);
+				geomParams = &(mGeometryProgram->getGLSLProgram()->getConstantDefinitions_internal().map);
 			}
 			if (mFragmentProgram)
 			{
-				fragParams = &(mFragmentProgram->getGLSLProgram()->getConstantDefinitions().map);
+				fragParams = &(mFragmentProgram->getGLSLProgram()->getConstantDefinitions_internal().map);
 			}
 
 			GLSLLinkProgramManager::instance().extractUniforms(

+ 13 - 13
CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp

@@ -46,6 +46,17 @@ namespace CamelotEngine {
     {
         unload();
     }
+	//-----------------------------------------------------------------------
+	GLSLProgram::GLSLProgram(const String& source, const String& entryPoint, const String& language, 
+		GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+		: HighLevelGpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired),
+		mInputOperationType(RenderOperation::OT_TRIANGLE_LIST),
+		mOutputOperationType(RenderOperation::OT_TRIANGLE_LIST), mMaxOutputVertices(3)
+	{
+		// Manually assign language now since we use it immediately
+		mSyntaxCode = "glsl";
+
+	}
     //-----------------------------------------------------------------------
 	void GLSLProgram::loadFromSource(void)
 	{
@@ -181,7 +192,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void GLSLProgram::createLowLevelImpl(void)
 	{
-		mAssemblerProgram = GpuProgramPtr(new GLSLGpuProgram( this ));
+		mAssemblerProgram = GpuProgramPtr(new GLSLGpuProgram( this, mSource, mEntryPoint, mSyntaxCode, mType, mProfile));
 	}
 	//---------------------------------------------------------------------------
 	void GLSLProgram::unloadImpl()
@@ -205,7 +216,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void GLSLProgram::populateParameterNames(GpuProgramParametersSharedPtr params)
 	{
-		getConstantDefinitions();
+		getConstantDefinitions_internal();
 		params->_setNamedConstants(mConstantDefs);
 		// Don't set logical / physical maps here, as we can't access parameters by logical index in GLHL.
 	}
@@ -232,17 +243,6 @@ namespace CamelotEngine {
 
 		}
 	}
-
-	//-----------------------------------------------------------------------
-    GLSLProgram::GLSLProgram()
-        : HighLevelGpuProgram(),
-            mInputOperationType(RenderOperation::OT_TRIANGLE_LIST),
-            mOutputOperationType(RenderOperation::OT_TRIANGLE_LIST), mMaxOutputVertices(3)
-    {
-        // Manually assign language now since we use it immediately
-        mSyntaxCode = "glsl";
-        
-    }
 	//---------------------------------------------------------------------
 	bool GLSLProgram::getPassSurfaceAndLightStates(void) const
 	{

+ 3 - 6
CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp

@@ -49,19 +49,16 @@ namespace CamelotEngine {
         return sLanguageName;
     }
     //-----------------------------------------------------------------------
-    HighLevelGpuProgram* GLSLProgramFactory::create(const String& source, const String& entryPoint, GpuProgramProfile profile)
+    HighLevelGpuProgram* GLSLProgramFactory::create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
     {
-		GLSLProgram* prog = new GLSLProgram();
-		prog->setSource(source);
-		prog->setEntryPoint(entryPoint);
-		prog->setProfile(profile);
+		GLSLProgram* prog = new GLSLProgram(source, entryPoint, sLanguageName, gptype, profile);
 
 		return prog;
     }
 	//-----------------------------------------------------------------------
 	HighLevelGpuProgram* GLSLProgramFactory::create()
 	{
-		GLSLProgram* prog = new GLSLProgram();
+		GLSLProgram* prog = new GLSLProgram("", "", sLanguageName, GPT_VERTEX_PROGRAM, GPP_NONE);
 
 		return prog;
 	}

+ 3 - 2
CamelotGLRenderer/Source/atifs/include/ATI_FS_GLGpuProgram.h

@@ -53,9 +53,10 @@ namespace CamelotEngine {
 		{ return mProgramID; }
 
 	protected:
-		friend GpuProgram* createGL_ATI_FS_GpuProgram(GpuProgramType gptype, const String& syntaxCode);
+		friend GpuProgram* createGL_ATI_FS_GpuProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 
-		ATI_FS_GLGpuProgram();
+		ATI_FS_GLGpuProgram(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
 
 		/// @copydoc Resource::unload
 		void unloadImpl(void);

+ 3 - 2
CamelotGLRenderer/Source/atifs/src/ATI_FS_GLGpuProgram.cpp

@@ -35,8 +35,9 @@ THE SOFTWARE.
 using namespace CamelotEngine;
 
 
-ATI_FS_GLGpuProgram::ATI_FS_GLGpuProgram() :
-    GLGpuProgram()
+ATI_FS_GLGpuProgram::ATI_FS_GLGpuProgram(const String& source, const String& entryPoint, const String& language, 
+										 GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired) 
+										 :GLGpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired)
 {
 	mProgramType = GL_FRAGMENT_SHADER_ATI;
     mProgramID = glGenFragmentShadersATI(1);

+ 2 - 8
CamelotRenderer/Include/CmCgProgram.h

@@ -47,14 +47,8 @@ namespace CamelotEngine {
     public:
         ~CgProgram();
 
-        /** Sets the entry point for this program ie the first method called. */
-        void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
         /** Gets the entry point defined for this program. */
         const String& getEntryPoint(void) const { return mEntryPoint; }
-        /** Sets the Cg profiles which can be supported by the program. */
-        void setProfiles(const vector<String>::type& profiles);
-        /** Gets the Cg profiles which can be supported by the program. */
-        const vector<String>::type& getProfiles(void) const { return mProfiles; }
         /** Sets the compilation arguments for this program ie the first method called. */
         void setCompileArguments(const String& args) { mCompileArgs = args; }
         /** Gets the entry point defined for this program. */
@@ -75,7 +69,8 @@ namespace CamelotEngine {
         /// Program handle
         CGprogram mCgProgram;
 
-		CgProgram(CGcontext context);
+		CgProgram(CGcontext context, const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
 
         /** Internal load implementation, must be implemented by subclasses.
         */
@@ -93,7 +88,6 @@ namespace CamelotEngine {
 		/// Turn a Cg type into a GpuConstantType and number of elements
 		void mapTypeAndElementSize(CGtype cgType, bool isRegisterCombiner, GpuConstantDefinition& def) const;
 
-        vector<String>::type mProfiles;
         String mSelectedProfile;
         CGprofile mSelectedCgProfile;
         String mCompileArgs;

+ 1 - 1
CamelotRenderer/Include/CmCgProgramFactory.h

@@ -45,7 +45,7 @@ namespace CamelotEngine
         ~CgProgramFactory();
 		/// Get the name of the language this factory creates programs for
 		const String& getLanguage(void) const;
-        HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
+        HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
 		HighLevelGpuProgram* create();
 		void destroy_internal(HighLevelGpuProgram* prog);
 

+ 3 - 20
CamelotRenderer/Include/CmGpuProgram.h

@@ -131,29 +131,14 @@ namespace CamelotEngine {
 		virtual void initialize_internal();
 		virtual void unload() {}
 
-		/** Sets the source assembly for this program from an in-memory string.
-        @remarks
-            Setting this will have no effect until you (re)load the program.
-        */
-        virtual void setSource(const String& source);
-
         /** Gets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
         virtual const String& getSyntaxCode(void) const { return mSyntaxCode; }
 
-		/** Sets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
-		virtual void setSyntaxCode(const String& syntax);
-
         /** Gets the assembler source for this program. */
         virtual const String& getSource(void) const { return mSource; }
-		/// Set the program type (only valid before load)
-		virtual void setType(GpuProgramType t);
         /// Get the program type
         virtual GpuProgramType getType(void) const { return mType; }
-		/// Sets the gpu program profile (e.g. vs_1_1, etc.). Make sure it matches the program type.
-		virtual void setProfile(GpuProgramProfile profile) { mProfile = profile; }
 		virtual GpuProgramProfile getProfile() const { return mProfile; }
-		/// Sets the name of the entry method for the program
-		virtual void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
 		virtual const String& getEntryPoint() const { return mEntryPoint; }
 
         /** Returns the GpuProgram which should be bound to the pipeline.
@@ -197,22 +182,20 @@ namespace CamelotEngine {
 		*/
 		virtual void resetCompileError(void) { mCompileError = false; }
 
-		/// Get a read-only reference to the named constants registered for this program (manually or automatically)
-		virtual const GpuNamedConstants& getNamedConstants() const { return *mConstantDefs.get(); }
-
 		/** Get the full list of named constants.
 		@note
 		Only available if this parameters object has named parameters, which means either
 		a high-level program which loads them, or a low-level program which has them
 		specified manually.
 		*/
-		virtual const GpuNamedConstants& getConstantDefinitions() const { return *mConstantDefs.get(); }
+		virtual const GpuNamedConstants& getConstantDefinitions_internal() const;
 
 
     protected:
 		friend class GpuProgramManager;
 
-		GpuProgram();
+		GpuProgram(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
 
         /// Virtual method which must be implemented by subclasses, load from mSource
         virtual void loadFromSource(void) = 0;

+ 2 - 17
CamelotRenderer/Include/CmGpuProgramManager.h

@@ -51,7 +51,7 @@ namespace CamelotEngine {
 	protected:
 		/** General create method
         */
-        virtual GpuProgram* create(GpuProgramType gptype, const String& syntaxCode) = 0;
+        virtual GpuProgram* create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) = 0;
 
 		void destroy(GpuProgram* program);
 		virtual void destroy_internal(GpuProgram* program);
@@ -60,20 +60,6 @@ namespace CamelotEngine {
 		GpuProgramManager();
 		virtual ~GpuProgramManager();
 
-		/** Loads a GPU program from a string of assembly code.
-		@remarks
-			The assembly code must be compatible with this manager - call the 
-			getSupportedSyntax method for details of the supported syntaxes 
-		@param name The identifying name to give this program, which can be used to
-			retrieve this program later with getByName.
-		@param groupName The name of the resource group
-		@param code A string of assembly code which will form the program to run
-		@param gptype The type of program to create.
-        @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
-		*/
-		virtual GpuProgramPtr load(const String& code, GpuProgramType gptype,
-            const String& syntaxCode);
-
 		/** Returns the syntaxes that this manager supports. */
 		virtual const SyntaxCodes& getSupportedSyntax(void) const;
 		 
@@ -109,8 +95,7 @@ namespace CamelotEngine {
 		@param gptype The type of program to create.
         @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
 		*/
-		GpuProgramPtr createProgram(const String& code, 
-            GpuProgramType gptype, const String& syntaxCode);
+		GpuProgramPtr createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 	};
 
 	/** @} */

+ 36 - 36
CamelotRenderer/Include/CmHighLevelGpuProgram.h

@@ -62,40 +62,7 @@ namespace CamelotEngine {
     */
     class CM_EXPORT HighLevelGpuProgram : public GpuProgram
     {
-    protected:
-        /// Whether the high-level program (and it's parameter defs) is loaded
-        bool mHighLevelLoaded;
-        /// The underlying assembler program
-        GpuProgramPtr mAssemblerProgram;
-		/// Have we built the name->index parameter map yet?
-		mutable bool mConstantDefsBuilt;
-
-        /// Internal load high-level portion if not loaded
-        virtual void loadHighLevel(void);
-        /// Internal unload high-level portion if loaded
-        virtual void unloadHighLevel(void);
-        /** Internal load implementation, loads just the high-level portion, enough to 
-            get parameters.
-        */
-        virtual void loadHighLevelImpl(void);
-        /** Internal method for creating an appropriate low-level program from this
-        high-level program, must be implemented by subclasses. */
-        virtual void createLowLevelImpl(void) = 0;
-        /// Internal unload implementation, must be implemented by subclasses
-        virtual void unloadHighLevelImpl(void) = 0;
-        /// Populate the passed parameters with name->index map
-        virtual void populateParameterNames(GpuProgramParametersSharedPtr params);
-		/** Build the constant definition map, must be overridden.
-		@note The implementation must fill in the (inherited) mConstantDefs field at a minimum, 
-			and if the program requires that parameters are bound using logical 
-			parameter indexes then the mFloatLogicalToPhysical and mIntLogicalToPhysical
-			maps must also be populated.
-		*/
-		virtual void buildConstantDefinitions() const = 0;
-
     public:
-        /** Constructor, should be used only by factory classes. */
-        HighLevelGpuProgram();
         ~HighLevelGpuProgram();
 
 		/**
@@ -129,14 +96,47 @@ namespace CamelotEngine {
 		@note
 		Only available if this parameters object has named parameters.
 		*/
-		const GpuNamedConstants& getConstantDefinitions() const;
+		const GpuNamedConstants& getConstantDefinitions_internal() const;
 
-		/// Override GpuProgram::getNamedConstants to ensure built
-		const GpuNamedConstants& getNamedConstants() const { return getConstantDefinitions(); }
+    protected:
+		/** Constructor, should be used only by factory classes. */
+		HighLevelGpuProgram(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
+
+        /// Whether the high-level program (and it's parameter defs) is loaded
+        bool mHighLevelLoaded;
+        /// The underlying assembler program
+        GpuProgramPtr mAssemblerProgram;
+		/// Have we built the name->index parameter map yet?
+		mutable bool mConstantDefsBuilt;
+
+        /// Internal load high-level portion if not loaded
+        virtual void loadHighLevel(void);
+        /// Internal unload high-level portion if loaded
+        virtual void unloadHighLevel(void);
+        /** Internal load implementation, loads just the high-level portion, enough to 
+            get parameters.
+        */
+        virtual void loadHighLevelImpl(void);
+        /** Internal method for creating an appropriate low-level program from this
+        high-level program, must be implemented by subclasses. */
+        virtual void createLowLevelImpl(void) = 0;
+        /// Internal unload implementation, must be implemented by subclasses
+        virtual void unloadHighLevelImpl(void) = 0;
+        /// Populate the passed parameters with name->index map
+        virtual void populateParameterNames(GpuProgramParametersSharedPtr params);
+		/** Build the constant definition map, must be overridden.
+		@note The implementation must fill in the (inherited) mConstantDefs field at a minimum, 
+			and if the program requires that parameters are bound using logical 
+			parameter indexes then the mFloatLogicalToPhysical and mIntLogicalToPhysical
+			maps must also be populated.
+		*/
+		virtual void buildConstantDefinitions() const = 0;
 
 		/************************************************************************/
 		/* 								STATICS		                     		*/
 		/************************************************************************/
+	public:
 		static HighLevelGpuProgramPtr create(const String& source, const String& entryPoint, 
 			const String& language, GpuProgramType gptype, GpuProgramProfile profile);
     };

+ 1 - 1
CamelotRenderer/Include/CmHighLevelGpuProgramManager.h

@@ -49,7 +49,7 @@ namespace CamelotEngine {
         virtual ~HighLevelGpuProgramFactory();
 		/// Get the name of the language this factory creates programs for
 		virtual const String& getLanguage(void) const = 0;
-        virtual HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile) = 0;
+        virtual HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile) = 0;
 		virtual HighLevelGpuProgram* create() = 0;
 
 		void destroy(HighLevelGpuProgram* prog);

+ 5 - 15
CamelotRenderer/Source/CmCgProgram.cpp

@@ -181,9 +181,9 @@ namespace CamelotEngine {
 				// Create a low-level program, give it the same name as us
 				mAssemblerProgram = 
 					GpuProgramManager::instance().createProgram(
-					shaderAssemblerCode,
+					shaderAssemblerCode, "", mSelectedProfile,
 					mType, 
-					mSelectedProfile);
+					GPP_NONE);
 			}
 			// Shader params need to be forwarded to low level implementation
 			mAssemblerProgram->setAdjacencyInfoRequired(isAdjacencyInfoRequired());
@@ -463,8 +463,9 @@ namespace CamelotEngine {
 		}
 	}
     //-----------------------------------------------------------------------
-    CgProgram::CgProgram(CGcontext context)
-        : HighLevelGpuProgram(), 
+		CgProgram::CgProgram(CGcontext context, const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+        : HighLevelGpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired), 
         mCgContext(context), mCgProgram(0), 
         mSelectedCgProfile(CG_PROFILE_UNKNOWN), mCgArguments(0)
     {
@@ -488,17 +489,6 @@ namespace CamelotEngine {
 			return true;
 
         return false;
-    }
-    //-----------------------------------------------------------------------
-    void CgProgram::setProfiles(const vector<String>::type& profiles)
-    {
-        mProfiles.clear();
-        vector<String>::type::const_iterator i, iend;
-        iend = profiles.end();
-        for (i = profiles.begin(); i != iend; ++i)
-        {
-            mProfiles.push_back(*i);
-        }
     }
 	//-----------------------------------------------------------------------
 	String CgProgram::resolveCgIncludes(const String& inSource, Resource* resourceBeingLoaded, const String& fileName)

+ 3 - 6
CamelotRenderer/Source/CmCgProgramFactory.cpp

@@ -54,19 +54,16 @@ namespace CamelotEngine {
         return sLanguageName;
     }
     //-----------------------------------------------------------------------
-    HighLevelGpuProgram* CgProgramFactory::create(const String& source, const String& entryPoint, GpuProgramProfile profile)
+    HighLevelGpuProgram* CgProgramFactory::create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
     {
-		CgProgram* prog = new CgProgram(mCgContext);
-		prog->setSource(source);
-		prog->setEntryPoint(entryPoint);
-		prog->setProfile(profile);
+		CgProgram* prog = new CgProgram(mCgContext, source, entryPoint, sLanguageName, gptype, profile);
 
 		return prog;
     }
 	//----------------------------------------------------------------------
 	HighLevelGpuProgram* CgProgramFactory::create()
 	{
-		CgProgram* prog = new CgProgram(mCgContext);
+		CgProgram* prog = new CgProgram(mCgContext, "", "", sLanguageName, GPT_VERTEX_PROGRAM, GPP_NONE);
 
 		return prog;
 	}

+ 10 - 19
CamelotRenderer/Source/CmGpuProgram.cpp

@@ -45,9 +45,10 @@ THE SOFTWARE.
 namespace CamelotEngine
 {
     //-----------------------------------------------------------------------------
-    GpuProgram::GpuProgram() 
-        :mType(GPT_VERTEX_PROGRAM),
-		mCompileError(false), mProfile(GPP_NONE)
+    GpuProgram::GpuProgram(const String& source, const String& entryPoint, const String& language, 
+		GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired) 
+        :mSource(source), mEntryPoint(entryPoint), mSyntaxCode(language), mType(gptype),
+		mProfile(profile), mNeedsAdjacencyInfo(isAdjacencyInfoRequired), mCompileError(false)
     {
 		createParameterMappingStructures();
     }
@@ -56,22 +57,6 @@ namespace CamelotEngine
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 	}
-    //-----------------------------------------------------------------------------
-    void GpuProgram::setType(GpuProgramType t)
-    {
-        mType = t;
-    }
-    //-----------------------------------------------------------------------------
-    void GpuProgram::setSyntaxCode(const String& syntax)
-    {
-        mSyntaxCode = syntax;
-    }
-    //-----------------------------------------------------------------------------
-    void GpuProgram::setSource(const String& source)
-    {
-        mSource = source;
-		mCompileError = false;
-    }
 	//-----------------------------------------------------------------------------
 	void GpuProgram::initialize()
 	{
@@ -165,6 +150,12 @@ namespace CamelotEngine
 
         return language;
     }
+	const GpuNamedConstants& GpuProgram::getConstantDefinitions_internal() const 
+	{ 
+		THROW_IF_NOT_RENDER_THREAD;
+
+		return *mConstantDefs.get();
+	}
 	//----------------------------------------------------------------------------- 
 	void GpuProgram::throwIfNotRenderThread() const
 	{

+ 3 - 18
CamelotRenderer/Source/CmGpuProgramManager.cpp

@@ -54,25 +54,10 @@ namespace CamelotEngine {
 			delete program;
 	}
     //---------------------------------------------------------------------------
-	GpuProgramPtr GpuProgramManager::load(const String& code, 
-        GpuProgramType gptype, const String& syntaxCode)
+	GpuProgramPtr GpuProgramManager::createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
     {
-		GpuProgramPtr prg;
-		{
-			prg = createProgram( code, gptype, syntaxCode);
-		}
-        prg->initialize();
-        return prg;
-    }
-    //---------------------------------------------------------------------------
-	GpuProgramPtr GpuProgramManager::createProgram(const String& code, GpuProgramType gptype, 
-		const String& syntaxCode)
-    {
-		GpuProgramPtr prg = GpuProgramPtr(create(gptype, syntaxCode), boost::bind(&GpuProgramManager::destroy, this, _1));
-        // Set all prarmeters (create does not set, just determines factory)
-		prg->setType(gptype);
-		prg->setSyntaxCode(syntaxCode);
-		prg->setSource(code);
+		GpuProgramPtr prg = GpuProgramPtr(create(source, entryPoint, language, gptype, profile), boost::bind(&GpuProgramManager::destroy, this, _1));
+
         return prg;
     }
     //---------------------------------------------------------------------------

+ 0 - 5
CamelotRenderer/Source/CmGpuProgramParams.cpp

@@ -739,11 +739,6 @@ namespace CamelotEngine
 			if(mTextures[def->physicalIndex] == nullptr)
 				mTextures[def->physicalIndex] = GpuTextureEntryPtr(new GpuTextureEntry());
 
-			if(val == nullptr)
-			{
-				int a = 5;
-			}
-
 			mTextures[def->physicalIndex]->texture = val;
 		}
 	}

+ 7 - 4
CamelotRenderer/Source/CmHighLevelGpuProgram.cpp

@@ -43,8 +43,9 @@ THE SOFTWARE.
 namespace CamelotEngine
 {
     //---------------------------------------------------------------------------
-    HighLevelGpuProgram::HighLevelGpuProgram()
-        : GpuProgram(), 
+	HighLevelGpuProgram::HighLevelGpuProgram(const String& source, const String& entryPoint, const String& language, 
+		GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+        : GpuProgram(source, entryPoint, language, gptype, profile, isAdjacencyInfoRequired), 
         mHighLevelLoaded(false), mAssemblerProgram(0), mConstantDefsBuilt(false)
     {
     }
@@ -148,8 +149,10 @@ namespace CamelotEngine
 
     }
 	//---------------------------------------------------------------------
-	const GpuNamedConstants& HighLevelGpuProgram::getConstantDefinitions() const
+	const GpuNamedConstants& HighLevelGpuProgram::getConstantDefinitions_internal() const
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		if (!mConstantDefsBuilt)
 		{
 			buildConstantDefinitions();
@@ -161,7 +164,7 @@ namespace CamelotEngine
 	//---------------------------------------------------------------------
 	void HighLevelGpuProgram::populateParameterNames(GpuProgramParametersSharedPtr params)
 	{
-		getConstantDefinitions();
+		getConstantDefinitions_internal();
 		params->_setNamedConstants(mConstantDefs);
 		// also set logical / physical maps for programs which use this
 		params->_setLogicalIndexes(mFloatLogicalToPhysical, mIntLogicalToPhysical, mSamplerLogicalToPhysical);

+ 4 - 8
CamelotRenderer/Source/CmHighLevelGpuProgramManager.cpp

@@ -57,7 +57,7 @@ namespace CamelotEngine {
 		}
 	public:
 		NullProgram()
-			: HighLevelGpuProgram(){}
+			: HighLevelGpuProgram("", "", "", GPT_VERTEX_PROGRAM, GPP_NONE){}
 		~NullProgram() {}
 		/// Overridden from GpuProgram - never supported
 		bool isSupported(void) const { return false; }
@@ -83,7 +83,7 @@ namespace CamelotEngine {
 		{ 
 			return sNullLang;
 		}
-		HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile)
+		HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile)
 		{
 			return new NullProgram();
 		}
@@ -155,14 +155,10 @@ namespace CamelotEngine {
     HighLevelGpuProgramPtr HighLevelGpuProgramManager::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile)
     {
 		HighLevelGpuProgramFactory* factory = getFactory(language);
-        HighLevelGpuProgramPtr ret = HighLevelGpuProgramPtr(factory->create(source, entryPoint, profile), boost::bind(&HighLevelGpuProgramFactory::destroy, factory, _1));
-
-        HighLevelGpuProgramPtr prg = ret;
-        prg->setType(gptype);
-        prg->setSyntaxCode(language);
+        HighLevelGpuProgramPtr ret = HighLevelGpuProgramPtr(factory->create(source, entryPoint, gptype, profile), boost::bind(&HighLevelGpuProgramFactory::destroy, factory, _1));
 		ret->initialize();
 
-        return prg;
+        return ret;
     }
 	//---------------------------------------------------------------------------
 	HighLevelGpuProgramPtr HighLevelGpuProgramManager::create(const String& language)

+ 1 - 1
CamelotRenderer/TODO.txt

@@ -16,7 +16,7 @@ High-level TODO:
 
 
 Command buffer TODO:
- - Make sure window gets created on the main, and not the render thread
+ - When importing a resource, and registering it with Resources I don't think it properly gets added to the loaded resources array? For some reason shaders get created twice.
  - My current approach doesn't allow multiple threads to use the RenderSystem (contexts should be handled differently)
    - Instead of requiring the user to constantly call setActiveContext, make the call peristent per thread. 
    - Store sequential thread idx in local thread storage, and then we can easily look up a context for a thread and