Bladeren bron

Added RTTI for shader programs

Marko Pintera 13 jaren geleden
bovenliggende
commit
c5c0aca2dc
27 gewijzigde bestanden met toevoegingen van 244 en 1 verwijderingen
  1. 1 0
      CamelotD3D9Renderer/CamelotD3D9Renderer.vcxproj
  2. 6 0
      CamelotD3D9Renderer/CamelotD3D9Renderer.vcxproj.filters
  3. 8 0
      CamelotD3D9Renderer/Include/CmD3D9HLSLProgram.h
  4. 1 0
      CamelotD3D9Renderer/Include/CmD3D9HLSLProgramFactory.h
  5. 33 0
      CamelotD3D9Renderer/Include/CmD3D9HLSLProgramRTTI.h
  6. 5 0
      CamelotD3D9Renderer/Include/CmD3D9Prerequisites.h
  7. 14 0
      CamelotD3D9Renderer/Source/CmD3D9HLSLProgram.cpp
  8. 7 0
      CamelotD3D9Renderer/Source/CmD3D9HLSLProgramFactory.cpp
  9. 1 0
      CamelotGLRenderer/CamelotGLRenderer.vcxproj
  10. 6 0
      CamelotGLRenderer/CamelotGLRenderer.vcxproj.filters
  11. 5 0
      CamelotGLRenderer/Include/CmGLPrerequisites.h
  12. 33 0
      CamelotGLRenderer/Include/CmGLSLProgramRTTI.h
  13. 7 0
      CamelotGLRenderer/Source/GLSL/include/CmGLSLProgram.h
  14. 1 0
      CamelotGLRenderer/Source/GLSL/include/CmGLSLProgramFactory.h
  15. 16 0
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgram.cpp
  16. 7 0
      CamelotGLRenderer/Source/GLSL/src/CmGLSLProgramFactory.cpp
  17. 1 0
      CamelotRenderer/CamelotRenderer.vcxproj
  18. 3 0
      CamelotRenderer/CamelotRenderer.vcxproj.filters
  19. 7 0
      CamelotRenderer/Include/CmCgProgram.h
  20. 1 0
      CamelotRenderer/Include/CmCgProgramFactory.h
  21. 33 0
      CamelotRenderer/Include/CmCgProgramRTTI.h
  22. 9 0
      CamelotRenderer/Include/CmHighLevelGpuProgramManager.h
  23. 2 1
      CamelotRenderer/Include/CmPrerequisites.h
  24. 14 0
      CamelotRenderer/Source/CmCgProgram.cpp
  25. 7 0
      CamelotRenderer/Source/CmCgProgramFactory.cpp
  26. 12 0
      CamelotRenderer/Source/CmHighLevelGpuProgramManager.cpp
  27. 4 0
      CamelotRenderer/TODO.txt

+ 1 - 0
CamelotD3D9Renderer/CamelotD3D9Renderer.vcxproj

@@ -91,6 +91,7 @@
     <ClInclude Include="Include\CmD3D9HardwareVertexBuffer.h" />
     <ClInclude Include="Include\CmD3D9HardwareVertexBuffer.h" />
     <ClInclude Include="Include\CmD3D9HLSLProgram.h" />
     <ClInclude Include="Include\CmD3D9HLSLProgram.h" />
     <ClInclude Include="Include\CmD3D9HLSLProgramFactory.h" />
     <ClInclude Include="Include\CmD3D9HLSLProgramFactory.h" />
+    <ClInclude Include="Include\CmD3D9HLSLProgramRTTI.h" />
     <ClInclude Include="Include\CmD3D9Mappings.h" />
     <ClInclude Include="Include\CmD3D9Mappings.h" />
     <ClInclude Include="Include\CmD3D9MultiRenderTarget.h" />
     <ClInclude Include="Include\CmD3D9MultiRenderTarget.h" />
     <ClInclude Include="Include\CmD3D9Prerequisites.h" />
     <ClInclude Include="Include\CmD3D9Prerequisites.h" />

+ 6 - 0
CamelotD3D9Renderer/CamelotD3D9Renderer.vcxproj.filters

@@ -13,6 +13,9 @@
       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
     </Filter>
     </Filter>
+    <Filter Include="Header Files\RTTI">
+      <UniqueIdentifier>{975ebce1-e98b-4380-bb4c-080103baa245}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\CmD3D9Device.h">
     <ClInclude Include="Include\CmD3D9Device.h">
@@ -93,6 +96,9 @@
     <ClInclude Include="Include\CmD3D9VideoModeList.h">
     <ClInclude Include="Include\CmD3D9VideoModeList.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\CmD3D9HLSLProgramRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CmD3D9Device.cpp">
     <ClCompile Include="Source\CmD3D9Device.cpp">

+ 8 - 0
CamelotD3D9Renderer/Include/CmD3D9HLSLProgram.h

@@ -120,6 +120,14 @@ namespace CamelotEngine {
         GpuProgramParametersSharedPtr createParameters(void);
         GpuProgramParametersSharedPtr createParameters(void);
         /// Overridden from GpuProgram
         /// Overridden from GpuProgram
         const String& getLanguage(void) const;
         const String& getLanguage(void) const;
+
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		friend class D3D9HLSLProgramRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const;
     };
     };
 }
 }
 
 

+ 1 - 0
CamelotD3D9Renderer/Include/CmD3D9HLSLProgramFactory.h

@@ -44,6 +44,7 @@ namespace CamelotEngine
 		/// Get the name of the language this factory creates programs for
 		/// Get the name of the language this factory creates programs for
 		const String& getLanguage(void) const;
 		const String& getLanguage(void) const;
         HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
         HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
+		HighLevelGpuProgram* create();
 		void destroy(HighLevelGpuProgram* prog);
 		void destroy(HighLevelGpuProgram* prog);
 
 
     };
     };

+ 33 - 0
CamelotD3D9Renderer/Include/CmD3D9HLSLProgramRTTI.h

@@ -0,0 +1,33 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmRTTIType.h"
+#include "CmHighLevelGpuProgramManager.h"
+#include "CmHighLevelGpuProgram.h"
+#include "CmD3D9HLSLProgram.h"
+
+namespace CamelotEngine
+{
+	class CM_D3D9_EXPORT D3D9HLSLProgramRTTI : public RTTIType<D3D9HLSLProgram, HighLevelGpuProgram, D3D9HLSLProgramRTTI>
+	{
+	public:
+		D3D9HLSLProgramRTTI()
+		{ }
+
+		virtual const String& getRTTIName()
+		{
+			static String name = "D3D9HLSLProgram";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return TID_D3D9_HLSLProgram;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject()
+		{
+			return HighLevelGpuProgramManager::instance().createProgram("hlsl");
+		}
+	};
+}

+ 5 - 0
CamelotD3D9Renderer/Include/CmD3D9Prerequisites.h

@@ -94,6 +94,11 @@ namespace CamelotEngine
     class D3D9VertexDeclaration;
     class D3D9VertexDeclaration;
 	class D3D9Resource;
 	class D3D9Resource;
 
 
+	enum TypeID_D3D9
+	{
+		TID_D3D9_HLSLProgram = 10000
+	};
+
 // Should we ask D3D to manage vertex/index buffers automatically?
 // Should we ask D3D to manage vertex/index buffers automatically?
 // Doing so avoids lost devices, but also has a performance impact
 // Doing so avoids lost devices, but also has a performance impact
 // which is unacceptably bad when using very large buffers
 // which is unacceptably bad when using very large buffers

+ 14 - 0
CamelotD3D9Renderer/Source/CmD3D9HLSLProgram.cpp

@@ -31,6 +31,7 @@ THE SOFTWARE.
 #include "CmException.h"
 #include "CmException.h"
 #include "CmRenderSystem.h"
 #include "CmRenderSystem.h"
 #include "CmRenderSystemManager.h"
 #include "CmRenderSystemManager.h"
+#include "CmD3D9HLSLProgramRTTI.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 	class CM_D3D9_EXPORT HLSLIncludeHandler : public ID3DXInclude
 	class CM_D3D9_EXPORT HLSLIncludeHandler : public ID3DXInclude
@@ -568,4 +569,17 @@ namespace CamelotEngine {
 
 
         return language;
         return language;
     }
     }
+
+	/************************************************************************/
+	/* 								SERIALIZATION                      		*/
+	/************************************************************************/
+	RTTITypeBase* D3D9HLSLProgram::getRTTIStatic()
+	{
+		return D3D9HLSLProgramRTTI::instance();
+	}
+
+	RTTITypeBase* D3D9HLSLProgram::getRTTI() const
+	{
+		return D3D9HLSLProgram::getRTTIStatic();
+	}
 }
 }

+ 7 - 0
CamelotD3D9Renderer/Source/CmD3D9HLSLProgramFactory.cpp

@@ -56,6 +56,13 @@ namespace CamelotEngine {
 
 
         return prog;
         return prog;
     }
     }
+	//-----------------------------------------------------------------------
+	HighLevelGpuProgram* D3D9HLSLProgramFactory::create()
+	{
+		D3D9HLSLProgram* prog = new D3D9HLSLProgram();
+
+		return prog;
+	}
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
 	void D3D9HLSLProgramFactory::destroy(HighLevelGpuProgram* prog)
 	void D3D9HLSLProgramFactory::destroy(HighLevelGpuProgram* prog)
     {
     {

+ 1 - 0
CamelotGLRenderer/CamelotGLRenderer.vcxproj

@@ -98,6 +98,7 @@
     <ClInclude Include="Include\CmGLRenderSystem.h" />
     <ClInclude Include="Include\CmGLRenderSystem.h" />
     <ClInclude Include="Include\CmGLRenderSystemFactory.h" />
     <ClInclude Include="Include\CmGLRenderSystemFactory.h" />
     <ClInclude Include="Include\CmGLRenderTexture.h" />
     <ClInclude Include="Include\CmGLRenderTexture.h" />
+    <ClInclude Include="Include\CmGLSLProgramRTTI.h" />
     <ClInclude Include="Include\CmGLSupport.h" />
     <ClInclude Include="Include\CmGLSupport.h" />
     <ClInclude Include="Include\CmGLTexture.h" />
     <ClInclude Include="Include\CmGLTexture.h" />
     <ClInclude Include="Include\CmGLTextureManager.h" />
     <ClInclude Include="Include\CmGLTextureManager.h" />

+ 6 - 0
CamelotGLRenderer/CamelotGLRenderer.vcxproj.filters

@@ -22,6 +22,9 @@
     <Filter Include="Win32">
     <Filter Include="Win32">
       <UniqueIdentifier>{c85ecca8-4719-49f1-879b-93a27c8da4aa}</UniqueIdentifier>
       <UniqueIdentifier>{c85ecca8-4719-49f1-879b-93a27c8da4aa}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="Header Files\RTTI">
+      <UniqueIdentifier>{f65cdae4-61c9-4f4f-a4af-9fc39a49704d}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\CmGLATIFSInit.h">
     <ClInclude Include="Include\CmGLATIFSInit.h">
@@ -141,6 +144,9 @@
     <ClInclude Include="Source\win32\CmGLUtil.h">
     <ClInclude Include="Source\win32\CmGLUtil.h">
       <Filter>Win32</Filter>
       <Filter>Win32</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\CmGLSLProgramRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\atifs\src\ATI_FS_GLGpuProgram.cpp">
     <ClCompile Include="Source\atifs\src\ATI_FS_GLGpuProgram.cpp">

+ 5 - 0
CamelotGLRenderer/Include/CmGLPrerequisites.h

@@ -42,6 +42,11 @@ namespace CamelotEngine {
     class GLFBOManager;
     class GLFBOManager;
     class GLHardwarePixelBuffer;
     class GLHardwarePixelBuffer;
     class GLRenderBuffer;
     class GLRenderBuffer;
+
+	enum TypeID_D3D9
+	{
+		TID_GL_GLSLProgram = 11000
+	};
 }
 }
 
 
 #if CM_THREAD_SUPPORT == 1
 #if CM_THREAD_SUPPORT == 1

+ 33 - 0
CamelotGLRenderer/Include/CmGLSLProgramRTTI.h

@@ -0,0 +1,33 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmRTTIType.h"
+#include "CmHighLevelGpuProgramManager.h"
+#include "CmHighLevelGpuProgram.h"
+#include "CmGLSLProgram.h"
+
+namespace CamelotEngine
+{
+	class CM_RSGL_EXPORT GLSLProgramRTTI : public RTTIType<GLSLProgram, HighLevelGpuProgram, GLSLProgramRTTI>
+	{
+	public:
+		GLSLProgramRTTI()
+		{ }
+
+		virtual const String& getRTTIName()
+		{
+			static String name = "GLSLProgram";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return TID_GL_GLSLProgram;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject()
+		{
+			return HighLevelGpuProgramManager::instance().createProgram("glsl");
+		}
+	};
+}

+ 7 - 0
CamelotGLRenderer/Source/GLSL/include/CmGLSLProgram.h

@@ -150,6 +150,13 @@ namespace CamelotEngine {
 		typedef GLSLProgramContainer::iterator GLSLProgramContainerIterator;
 		typedef GLSLProgramContainer::iterator GLSLProgramContainerIterator;
 		GLSLProgramContainer mAttachedGLSLPrograms;
 		GLSLProgramContainer mAttachedGLSLPrograms;
 
 
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		friend class GLSLProgramRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const;
     };
     };
 }
 }
 
 

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

@@ -47,6 +47,7 @@ namespace CamelotEngine
 		const String& getLanguage(void) const;
 		const String& getLanguage(void) const;
 		/// create an instance of GLSLProgram
 		/// create an instance of GLSLProgram
         HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
         HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile);
+		HighLevelGpuProgram* create();
 		void destroy(HighLevelGpuProgram* prog);
 		void destroy(HighLevelGpuProgram* prog);
     };
     };
 }
 }

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

@@ -38,6 +38,8 @@ THE SOFTWARE.
 #include "CmGLSLLinkProgramManager.h"
 #include "CmGLSLLinkProgramManager.h"
 #include "CmGLSLPreprocessor.h"
 #include "CmGLSLPreprocessor.h"
 
 
+#include "CmGLSLProgramRTTI.h"
+
 namespace CamelotEngine {
 namespace CamelotEngine {
     //---------------------------------------------------------------------------
     //---------------------------------------------------------------------------
     GLSLProgram::~GLSLProgram()
     GLSLProgram::~GLSLProgram()
@@ -334,6 +336,20 @@ namespace CamelotEngine {
 
 
         return language;
         return language;
     }
     }
+
+	/************************************************************************/
+	/* 								SERIALIZATION                      		*/
+	/************************************************************************/
+	RTTITypeBase* GLSLProgram::getRTTIStatic()
+	{
+		return GLSLProgramRTTI::instance();
+	}
+
+	RTTITypeBase* GLSLProgram::getRTTI() const
+	{
+		return GLSLProgram::getRTTIStatic();
+	}
+
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
 	RenderOperation::OperationType parseOperationType(const String& val)
 	RenderOperation::OperationType parseOperationType(const String& val)
 	{
 	{

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

@@ -58,6 +58,13 @@ namespace CamelotEngine {
 
 
 		return prog;
 		return prog;
     }
     }
+	//-----------------------------------------------------------------------
+	HighLevelGpuProgram* GLSLProgramFactory::create()
+	{
+		GLSLProgram* prog = new GLSLProgram();
+
+		return prog;
+	}
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
 	void GLSLProgramFactory::destroy(HighLevelGpuProgram* prog)
 	void GLSLProgramFactory::destroy(HighLevelGpuProgram* prog)
     {
     {

+ 1 - 0
CamelotRenderer/CamelotRenderer.vcxproj

@@ -99,6 +99,7 @@
     <ClInclude Include="Include\CmCameraRTTI.h" />
     <ClInclude Include="Include\CmCameraRTTI.h" />
     <ClInclude Include="Include\CmCgProgram.h" />
     <ClInclude Include="Include\CmCgProgram.h" />
     <ClInclude Include="Include\CmCgProgramFactory.h" />
     <ClInclude Include="Include\CmCgProgramFactory.h" />
+    <ClInclude Include="Include\CmCgProgramRTTI.h" />
     <ClInclude Include="Include\CmCommon.h" />
     <ClInclude Include="Include\CmCommon.h" />
     <ClInclude Include="Include\CmComponentRTTI.h" />
     <ClInclude Include="Include\CmComponentRTTI.h" />
     <ClInclude Include="Include\CmConfigOptionMap.h" />
     <ClInclude Include="Include\CmConfigOptionMap.h" />

+ 3 - 0
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -283,6 +283,9 @@
     <ClInclude Include="Include\CmRendererManager.h">
     <ClInclude Include="Include\CmRendererManager.h">
       <Filter>Header Files\Renderer</Filter>
       <Filter>Header Files\Renderer</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\CmCgProgramRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CamelotRenderer.cpp">
     <ClCompile Include="Source\CamelotRenderer.cpp">

+ 7 - 0
CamelotRenderer/Include/CmCgProgram.h

@@ -106,6 +106,13 @@ namespace CamelotEngine {
 		/// scan the file for #include and replace with source from the OGRE resources
 		/// scan the file for #include and replace with source from the OGRE resources
 		static String resolveCgIncludes(const String& source, Resource* resourceBeingLoaded, const String& fileName);
 		static String resolveCgIncludes(const String& source, Resource* resourceBeingLoaded, const String& fileName);
 
 
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		friend class CgProgramRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const;
     };
     };
 
 
 	/** Utility function, checks Cg for errors, throw exception if detected.
 	/** Utility function, checks Cg for errors, throw exception if detected.

+ 1 - 0
CamelotRenderer/Include/CmCgProgramFactory.h

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

+ 33 - 0
CamelotRenderer/Include/CmCgProgramRTTI.h

@@ -0,0 +1,33 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmRTTIType.h"
+#include "CmHighLevelGpuProgramManager.h"
+#include "CmHighLevelGpuProgram.h"
+#include "CmCgProgram.h"
+
+namespace CamelotEngine
+{
+	class CM_EXPORT CgProgramRTTI : public RTTIType<CgProgram, HighLevelGpuProgram, CgProgramRTTI>
+	{
+	public:
+		CgProgramRTTI()
+		{ }
+
+		virtual const String& getRTTIName()
+		{
+			static String name = "CgProgram";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return TID_CgProgram;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject()
+		{
+			return HighLevelGpuProgramManager::instance().createProgram("cg");
+		}
+	};
+}

+ 9 - 0
CamelotRenderer/Include/CmHighLevelGpuProgramManager.h

@@ -50,6 +50,7 @@ namespace CamelotEngine {
 		/// Get the name of the language this factory creates programs for
 		/// Get the name of the language this factory creates programs for
 		virtual const String& getLanguage(void) const = 0;
 		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, GpuProgramProfile profile) = 0;
+		virtual HighLevelGpuProgram* create() = 0;
 		virtual void destroy(HighLevelGpuProgram* prog) = 0;
 		virtual void destroy(HighLevelGpuProgram* prog) = 0;
 	};
 	};
 	/** This ResourceManager manages high-level vertex and fragment programs. 
 	/** This ResourceManager manages high-level vertex and fragment programs. 
@@ -101,6 +102,14 @@ namespace CamelotEngine {
 		@param gptype The type of program to create
 		@param gptype The type of program to create
 		*/
 		*/
 		HighLevelGpuProgramPtr createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
 		HighLevelGpuProgramPtr createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
+
+		/** Create a new, unloaded HighLevelGpuProgram. 
+		@par
+			This method creates a new program of the specified language. You need to set other 
+			properties like source, entry point, type, profile manually.
+		@param language Code of the language to use (e.g. "cg")
+		*/
+		HighLevelGpuProgramPtr createProgram(const String& language);
 	};
 	};
 	/** @} */
 	/** @} */
 	/** @} */
 	/** @} */

+ 2 - 1
CamelotRenderer/Include/CmPrerequisites.h

@@ -157,7 +157,8 @@ namespace CamelotEngine
 		TID_Renderable = 1008,
 		TID_Renderable = 1008,
 		TID_ResourceRef = 1009,
 		TID_ResourceRef = 1009,
 		TID_GpuProgram = 1010,
 		TID_GpuProgram = 1010,
-		TID_ResourceRefData = 1011
+		TID_ResourceRefData = 1011,
+		TID_CgProgram = 1012
 	};
 	};
 }
 }
 
 

+ 14 - 0
CamelotRenderer/Source/CmCgProgram.cpp

@@ -30,6 +30,7 @@ THE SOFTWARE.
 #include "CmHighLevelGpuProgramManager.h"
 #include "CmHighLevelGpuProgramManager.h"
 #include "CmDebug.h"
 #include "CmDebug.h"
 #include "CmException.h"
 #include "CmException.h"
+#include "CmCgProgramRTTI.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
@@ -620,4 +621,17 @@ namespace CamelotEngine {
 
 
         return language;
         return language;
     }
     }
+
+	/************************************************************************/
+	/* 								SERIALIZATION                      		*/
+	/************************************************************************/
+	RTTITypeBase* CgProgram::getRTTIStatic()
+	{
+		return CgProgramRTTI::instance();
+	}
+
+	RTTITypeBase* CgProgram::getRTTI() const
+	{
+		return CgProgram::getRTTIStatic();
+	}
 }
 }

+ 7 - 0
CamelotRenderer/Source/CmCgProgramFactory.cpp

@@ -63,6 +63,13 @@ namespace CamelotEngine {
 
 
 		return prog;
 		return prog;
     }
     }
+	//----------------------------------------------------------------------
+	HighLevelGpuProgram* CgProgramFactory::create()
+	{
+		CgProgram* prog = new CgProgram(mCgContext);
+
+		return prog;
+	}
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
 	void CgProgramFactory::destroy(HighLevelGpuProgram* prog)
 	void CgProgramFactory::destroy(HighLevelGpuProgram* prog)
     {
     {

+ 12 - 0
CamelotRenderer/Source/CmHighLevelGpuProgramManager.cpp

@@ -85,6 +85,11 @@ namespace CamelotEngine {
 		{
 		{
 			return new NullProgram();
 			return new NullProgram();
 		}
 		}
+		HighLevelGpuProgram* create()
+		{
+			return new NullProgram();
+		}
+
 		void destroy(HighLevelGpuProgram* prog)
 		void destroy(HighLevelGpuProgram* prog)
 		{
 		{
 			delete prog;
 			delete prog;
@@ -150,6 +155,13 @@ namespace CamelotEngine {
 
 
         return prg;
         return prg;
     }
     }
+	//---------------------------------------------------------------------------
+	HighLevelGpuProgramPtr HighLevelGpuProgramManager::createProgram(const String& language)
+	{
+		HighLevelGpuProgramPtr ret = HighLevelGpuProgramPtr(getFactory(language)->create());
+
+		return ret;
+	}
     //---------------------------------------------------------------------------
     //---------------------------------------------------------------------------
     HighLevelGpuProgramFactory::~HighLevelGpuProgramFactory() 
     HighLevelGpuProgramFactory::~HighLevelGpuProgramFactory() 
     {
     {

+ 4 - 0
CamelotRenderer/TODO.txt

@@ -26,6 +26,10 @@ Mid priority TODO:
   - Search for all remaining "TODO PORT" comments and fix them
   - Search for all remaining "TODO PORT" comments and fix them
   - How do I serialize derived classes, without rewriting all the base class serialization?
   - How do I serialize derived classes, without rewriting all the base class serialization?
   - Ogre performed special DDS loading. I removed that. I'm not sure if I'll need to re-add it?
   - Ogre performed special DDS loading. I removed that. I'm not sure if I'll need to re-add it?
+ - RTTI:
+     When defining RTTIType like so: 
+      RTTIType<D3D9HLSLProgram, HighLevelGpuProgram, D3D9HLSLProgramRTTI>
+     I need to make sure that HighLevelGpuProgram class has valid RTTI type as well. Otherwise the inheritance hierarchy will not be correct. Right now this isn't checked anywhere.
 
 
 Low priority TODO:
 Low priority TODO:
  - Mesh loading:
  - Mesh loading: