Browse Source

GpuProgram refactor to comply with new CoreObject design

Marko Pintera 11 năm trước cách đây
mục cha
commit
34449b8bd8
65 tập tin đã thay đổi với 768 bổ sung1118 xóa
  1. 6 0
      BansheeCore/BansheeCore.vcxproj
  2. 1 1
      BansheeCore/Include/BsCoreThreadAccessor.h
  3. 112 35
      BansheeCore/Include/BsGpuProgram.h
  4. 52 17
      BansheeCore/Include/BsGpuProgramManager.h
  5. 27 14
      BansheeCore/Include/BsGpuProgramRTTI.h
  6. 1 1
      BansheeCore/Include/BsRenderSystem.h
  7. 2 0
      BansheeCore/Source/BsCoreApplication.cpp
  8. 2 2
      BansheeCore/Source/BsCoreThreadAccessor.cpp
  9. 74 38
      BansheeCore/Source/BsGpuProgram.cpp
  10. 43 30
      BansheeCore/Source/BsGpuProgramManager.cpp
  11. 2 2
      BansheeCore/Source/BsRenderSystem.cpp
  12. 12 12
      BansheeCore/Source/BsRenderer.cpp
  13. 6 1
      BansheeD3D11RenderSystem/BansheeD3D11RenderSystem.vcxproj
  14. 0 6
      BansheeD3D11RenderSystem/BansheeD3D11RenderSystem.vcxproj.filters
  15. 58 125
      BansheeD3D11RenderSystem/Include/BsD3D11GpuProgram.h
  16. 0 170
      BansheeD3D11RenderSystem/Include/BsD3D11GpuProgramRTTI.h
  17. 5 5
      BansheeD3D11RenderSystem/Include/BsD3D11HLSLProgramFactory.h
  18. 4 2
      BansheeD3D11RenderSystem/Include/BsD3D11InputLayoutManager.h
  19. 1 16
      BansheeD3D11RenderSystem/Include/BsD3D11Prerequisites.h
  20. 2 2
      BansheeD3D11RenderSystem/Include/BsD3D11RenderSystem.h
  21. 69 163
      BansheeD3D11RenderSystem/Source/BsD3D11GpuProgram.cpp
  22. 23 23
      BansheeD3D11RenderSystem/Source/BsD3D11HLSLProgramFactory.cpp
  23. 2 2
      BansheeD3D11RenderSystem/Source/BsD3D11InputLayoutManager.cpp
  24. 11 14
      BansheeD3D11RenderSystem/Source/BsD3D11RenderSystem.cpp
  25. 6 1
      BansheeD3D9RenderSystem/BansheeD3D9RenderSystem.vcxproj
  26. 0 6
      BansheeD3D9RenderSystem/BansheeD3D9RenderSystem.vcxproj.filters
  27. 21 65
      BansheeD3D9RenderSystem/Include/BsD3D9GpuProgram.h
  28. 0 78
      BansheeD3D9RenderSystem/Include/BsD3D9GpuProgramRTTI.h
  29. 4 4
      BansheeD3D9RenderSystem/Include/BsD3D9HLSLProgramFactory.h
  30. 1 11
      BansheeD3D9RenderSystem/Include/BsD3D9Prerequisites.h
  31. 1 1
      BansheeD3D9RenderSystem/Include/BsD3D9RenderSystem.h
  32. 33 80
      BansheeD3D9RenderSystem/Source/BsD3D9GpuProgram.cpp
  33. 15 15
      BansheeD3D9RenderSystem/Source/BsD3D9HLSLProgramFactory.cpp
  34. 6 11
      BansheeD3D9RenderSystem/Source/BsD3D9RenderSystem.cpp
  35. 6 0
      BansheeEditor/BansheeEditor.vcxproj
  36. 6 0
      BansheeEditorExec/BansheeEditorExec.vcxproj
  37. 1 1
      BansheeEditorExec/BsEditorExec.cpp
  38. 6 0
      BansheeEngine/BansheeEngine.vcxproj
  39. 6 0
      BansheeFBXImporter/BansheeFBXImporter.vcxproj
  40. 6 0
      BansheeFontImporter/BansheeFontImporter.vcxproj
  41. 6 0
      BansheeFreeImgImporter/BansheeFreeImgImporter.vcxproj
  42. 6 1
      BansheeGLRenderSystem/BansheeGLRenderSystem.vcxproj
  43. 0 6
      BansheeGLRenderSystem/BansheeGLRenderSystem.vcxproj.filters
  44. 1 11
      BansheeGLRenderSystem/Include/BsGLPrerequisites.h
  45. 8 8
      BansheeGLRenderSystem/Include/BsGLRenderSystem.h
  46. 0 32
      BansheeGLRenderSystem/Include/BsGLSLGpuProgramRTTI.h
  47. 1 1
      BansheeGLRenderSystem/Include/BsGLVertexArrayObjectManager.h
  48. 8 9
      BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp
  49. 2 2
      BansheeGLRenderSystem/Source/BsGLVertexArrayObjectManager.cpp
  50. 10 23
      BansheeGLRenderSystem/Source/GLSL/include/BsGLSLGpuProgram.h
  51. 4 4
      BansheeGLRenderSystem/Source/GLSL/include/BsGLSLProgramFactory.h
  52. 2 2
      BansheeGLRenderSystem/Source/GLSL/include/BsGLSLProgramPipelineManager.h
  53. 28 48
      BansheeGLRenderSystem/Source/GLSL/src/BsGLSLGpuProgram.cpp
  54. 7 7
      BansheeGLRenderSystem/Source/GLSL/src/BsGLSLProgramFactory.cpp
  55. 2 2
      BansheeGLRenderSystem/Source/GLSL/src/BsGLSLProgramPipelineManager.cpp
  56. 6 0
      BansheeMono/BansheeMono.vcxproj
  57. 6 0
      BansheeOISInput/BansheeOISInput.vcxproj
  58. 6 0
      BansheeRenderer/BansheeRenderer.vcxproj
  59. 2 3
      BansheeRenderer/Source/BsBansheeLitTexRenderableController.cpp
  60. 6 0
      BansheeSceneManager/BansheeSceneManager.vcxproj
  61. 6 0
      BansheeUtility/BansheeUtility.vcxproj
  62. 6 0
      ExampleProject/ExampleProject.vcxproj
  63. 6 0
      SBansheeEditor/SBansheeEditor.vcxproj
  64. 6 0
      SBansheeEngine/SBansheeEngine.vcxproj
  65. 0 5
      TODO.txt

+ 6 - 0
BansheeCore/BansheeCore.vcxproj

@@ -146,6 +146,7 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;BS_CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>./Include;../BansheeUtility/Include;../Dependencies/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -164,6 +165,7 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;BS_CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>./Include;../BansheeUtility/Include;../Dependencies/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -186,6 +188,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <DebugInformationFormat>None</DebugInformationFormat>
       <BufferSecurityCheck>false</BufferSecurityCheck>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -211,6 +214,7 @@
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -235,6 +239,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <DebugInformationFormat>None</DebugInformationFormat>
       <BufferSecurityCheck>false</BufferSecurityCheck>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -260,6 +265,7 @@
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>

+ 1 - 1
BansheeCore/Include/BsCoreThreadAccessor.h

@@ -73,7 +73,7 @@ namespace BansheeEngine
 		void setRenderTarget(RenderTargetPtr target);
 
 		/** @copydoc RenderSystem::bindGpuProgram() */
-		void bindGpuProgram(HGpuProgram prg);
+		void bindGpuProgram(const GpuProgramPtr& prg);
 
 		/** @copydoc RenderSystem::unbindGpuProgram() */
 		void unbindGpuProgram(GpuProgramType gptype);

+ 112 - 35
BansheeCore/Include/BsGpuProgram.h

@@ -57,35 +57,56 @@ namespace BansheeEngine
 	};
 
 	/**
-	 * @brief	Contains a GPU program such as vertex or fragment program which gets
-	 *			compiled from the provided source code.
-	 *
-	 * @note	Core thread only.
+	 * @brief	Data describing a GpuProgram.
 	 */
-	class BS_CORE_EXPORT GpuProgram : public Resource
+	class BS_CORE_EXPORT GpuProgramProperties
 	{
 	public:
-		virtual ~GpuProgram();
+		GpuProgramProperties(const String& source, const String& entryPoint,
+			GpuProgramType gptype, GpuProgramProfile profile);
+
+		virtual ~GpuProgramProperties() { }
 
         /**
          * @brief	Source used for creating this program.
          */
-        virtual const String& getSource() const { return mSource; }
+        const String& getSource() const { return mSource; }
         
 		/**
 		 * @brief	Type of GPU program (e.g. fragment, vertex)
 		 */
-        virtual GpuProgramType getType() const { return mType; }
+        GpuProgramType getType() const { return mType; }
 
 		/**
 		 * @brief	Profile of the GPU program (e.g. VS_4_0, VS_5_0)
 		 */
-		virtual GpuProgramProfile getProfile() const { return mProfile; }
+		GpuProgramProfile getProfile() const { return mProfile; }
 
 		/**
 		 * @brief	Name of the program entry method (e.g. "main")
 		 */
-		virtual const String& getEntryPoint() const { return mEntryPoint; }
+		const String& getEntryPoint() const { return mEntryPoint; }
+
+	protected:
+		friend class GpuProgramRTTI;
+
+		GpuProgramType mType;
+		String mEntryPoint;
+		GpuProgramProfile mProfile;
+		String mSource;
+	};
+
+	/**
+	 * @brief	Core thread version of a GpuProgram.
+	 *
+	 * @see	GpuProgram
+	 *
+	 * @note	Core thread only.
+	 */
+	class BS_CORE_EXPORT GpuProgramCore : public CoreObjectCore
+	{
+	public:
+		virtual ~GpuProgramCore() { }
 
 		/**
 		 * @brief	Returns whether this program can be supported on the current renderer and hardware.
@@ -94,15 +115,11 @@ namespace BansheeEngine
 
 		/**
 		 * @brief	Returns true if shader was successfully compiled. 
-		 *
-		 * @note	Thread safe. Only valid after core thread has initialized the program.
 		 */
 		virtual bool isCompiled() const { return mIsCompiled; }
 
 		/**
 		 * @brief	Returns an error message returned by the compiler, if the compilation failed.
-		 *
-		 * @note	Thread safe. Only valid after core thread has initialized the program.
 		 */
 		virtual String getCompileErrorMessage() const { return mCompileError; }
 
@@ -123,27 +140,89 @@ namespace BansheeEngine
 		virtual bool isAdjacencyInfoRequired() const { return mNeedsAdjacencyInfo; }
 
 		/**
-		 * @brief	Returns true if matrices need to be transposed before sent to the GPU
-		 *			program as GPU program parameters.
+		 * @copydoc	GpuProgram::createParameters
 		 */
-		virtual bool requiresMatrixTranspose() const { return false; }
+		virtual GpuParamsPtr createParameters();
+
+		/**
+		 * @copydoc	GpuProgram::getParamDesc
+		 */
+		GpuParamDescPtr getParamDesc() const { return mParametersDesc; }
+
+		/**
+		 * @brief	Returns properties that contain information about the GPU program.
+		 */
+		const GpuProgramProperties& getProperties() const { return mProperties; }
+
+	protected:
+		GpuProgramCore(const String& source, const String& entryPoint,
+			GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired = false);
+
+		/**
+		 * @brief	Returns whether required capabilities for this program is supported.
+		 */
+		bool isRequiredCapabilitiesSupported() const;
+
+		bool mNeedsAdjacencyInfo;
+
+		bool mIsCompiled;
+		String mCompileError;
+
+		GpuParamDescPtr mParametersDesc;
+		GpuProgramProperties mProperties;
+	};
+
+	/**
+	 * @brief	Contains a GPU program such as vertex or fragment program which gets
+	 *			compiled from the provided source code.
+	 *
+	 * @note	Sim thread only.
+	 */
+	class BS_CORE_EXPORT GpuProgram : public Resource
+	{
+	public:
+		virtual ~GpuProgram() { }
+
+		/**
+		 * @brief	Returns true if shader was successfully compiled. 
+		 *
+		 * @note	Only valid after core thread has initialized the program.
+		 */
+		bool isCompiled() const;
+
+		/**
+		 * @brief	Returns an error message returned by the compiler, if the compilation failed.
+		 *
+		 * @note	Only valid after core thread has initialized the program.
+		 */
+		String getCompileErrorMessage() const;
 
 		/**
 		 * @brief	Creates a new parameters object compatible with this program definition. You
 		 *			may populate the returned object with actual parameter values and bind it
 		 *			to the pipeline to render an object using those values and this program.
+		 *
+		 * @note	Only valid after core thread has initialized the program.
 		 */
-		virtual GpuParamsPtr createParameters();
+		GpuParamsPtr createParameters();
 
 		/**
 		 * @brief	Returns description of all parameters in this GPU program.
+		 *
+		 * @note	Only valid after core thread has initialized the program.
 		 */
-		GpuParamDescPtr getParamDesc() const { return mParametersDesc; }
+		GpuParamDescPtr getParamDesc() const;
 
 		/**
-		* @brief	Language this shader was created from (e.g. HLSL, GLSL).
-		*/
-        virtual const String& getLanguage() const;
+		 * @brief	Retrieves a core implementation of a gpu program usable only from the
+		 *			core thread.
+		 */
+		SPtr<GpuProgramCore> getCore() const;
+
+		/**
+		 * @brief	Returns properties that contain information about the GPU program.
+		 */
+		const GpuProgramProperties& getProperties() const { return mProperties; }
 
 		/**
 		 * @brief	Creates a new GPU program using the provided source code. If compilation fails or program is not supported
@@ -171,31 +250,29 @@ namespace BansheeEngine
 	protected:
 		friend class GpuProgramManager;
 
-		GpuProgram(const String& source, const String& entryPoint, 
-			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, 
+		GpuProgram(const String& source, const String& entryPoint, const String& language,
+			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes,
 			bool isAdjacencyInfoRequired = false);
 
 		/**
-		 * @brief	Returns whether required capabilities for this program is supported.
+		 * @copydoc	CoreObject::createCore
 		 */
-        bool isRequiredCapabilitiesSupported() const;
+		SPtr<CoreObjectCore> createCore() const;
 
 		/**
 		 * @copydoc Resource::calculateSize
 		 */
 		size_t calculateSize() const { return 0; } // TODO 
 
+		/**
+		 * @brief	Merges the shader code with optional includes.
+		 */
+		static String mergeWithIncludes(const String& source, const Vector<HGpuProgInclude>* includes);
+
 	protected:
-		GpuProgramType mType;
 		bool mNeedsAdjacencyInfo;
-		String mEntryPoint;
-		GpuProgramProfile mProfile;
-        String mSource;
-
-		bool mIsCompiled;
-		String mCompileError;
-
-		GpuParamDescPtr mParametersDesc;
+		String mLanguage;
+		GpuProgramProperties mProperties;
 
 		/************************************************************************/
 		/* 								SERIALIZATION                      		*/

+ 52 - 17
BansheeCore/Include/BsGpuProgramManager.h

@@ -14,7 +14,7 @@ namespace BansheeEngine
 	{
 	public:
         GpuProgramFactory() {}
-        virtual ~GpuProgramFactory();
+		virtual ~GpuProgramFactory() { }
 
 		/**
 		 * @brief	Returns GPU program language this factory is capable creating GPU programs from.
@@ -30,32 +30,66 @@ namespace BansheeEngine
 		 * @param	entryPoint	Name of the entry point function, e.g. "main".
 		 * @param	gptype		Type of the program, e.g. vertex or fragment.
 		 * @param	profile		Program profile specifying supported feature-set. Must match the type.
-		 * @param	includes	Optional includes to append to the source before compiling.
 		 * @param	requiresAdjacency	If true then adjacency information will be provided when rendering using this program.
 		 */
-		virtual GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacencyInformation) = 0;
+		virtual SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool requiresAdjacencyInformation) = 0;
 
 		/**
 		 * @copydoc	GpuProgramManager::createEmpty
 		 */
-		virtual GpuProgramPtr create(GpuProgramType type) = 0;
+		virtual SPtr<GpuProgramCore> create(GpuProgramType type) = 0;
 	};
 
 	/**
 	 * @brief	Manager responsible for creating GPU programs. It will automatically
-	 *			try to find the approriate handler for a specific GPU program language
+	 *			try to find the appropriate handler for a specific GPU program language
 	 *			and create the program if possible.
 	 *
 	 * @note	Sim thread only.
 	 */
 	class BS_CORE_EXPORT GpuProgramManager : public Module<GpuProgramManager>
 	{
+	public:
+		/**
+		 * @brief	Creates a new GPU program using the provided source code. If compilation fails or program is not supported
+		 *			"isCompiled" method on the returned program will return false, and you will be able to retrieve the error message 
+		 *			via "getCompileErrorMessage".
+		 *
+		 * @param	source		Source code to compile the shader from.
+		 * @param	entryPoint	Name of the entry point function, e.g. "main".
+		 * @param	language	Language the source is written in, e.g. "hlsl" or "glsl".
+		 * @param	gptype		Type of the program, e.g. vertex or fragment.
+		 * @param	profile		Program profile specifying supported feature-set. Must match the type.
+		 * @param	includes	Optional includes to append to the source before compiling.
+		 * @param	requiresAdjacency	If true then adjacency information will be provided when rendering using this program.
+		 */
+		GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes,
+			bool requiresAdjacency = false);
+
+		/**
+		 * @brief	Creates a completely empty and uninitialized GpuProgram.
+		 * 			Should only be used for specific purposes, like deserialization,
+		 * 			as it requires additional manual initialization that is not required normally.
+		 */
+		GpuProgramPtr createEmpty(const String& language, GpuProgramType type);
+	};
+
+	/**
+	 * @brief	Manager responsible for creating GPU programs. It will automatically
+	 *			try to find the appropriate handler for a specific GPU program language
+	 *			and create the program if possible.
+	 *
+	 * @note	Core thread only.
+	 */
+	class BS_CORE_EXPORT GpuProgramCoreManager : public Module<GpuProgramCoreManager>
+	{
 	public:
 		
 	public:
-		GpuProgramManager();
-		~GpuProgramManager();
+		GpuProgramCoreManager();
+		virtual ~GpuProgramCoreManager();
 
 		/**
 		 * @brief	Registers a new factory that is able to create GPU programs for a certain language.
@@ -84,21 +118,22 @@ namespace BansheeEngine
 		 * @param	language	Language the source is written in, e.g. "hlsl" or "glsl".
 		 * @param	gptype		Type of the program, e.g. vertex or fragment.
 		 * @param	profile		Program profile specifying supported feature-set. Must match the type.
-		 * @param	includes	Optional includes to append to the source before compiling.
 		 * @param	requiresAdjacency	If true then adjacency information will be provided when rendering using this program.
 		 */
-		GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, 
-			GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes,
-			bool requiresAdjacency = false);
+		SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, const String& language, 
+			GpuProgramType gptype, GpuProgramProfile profile, bool requiresAdjacency = false);
+
+	protected:
+		friend class GpuProgram;
 
 		/**
-		 * @brief	Creates a completely empty and uninitialized GpuProgram.
-		 * 			Should only be used for specific purposes, like deserialization,
-		 * 			as it requires additional manual initialization that is not required normally.
+		 * @brief	Creates a GPU program without initializing it.
+		 *
+		 * @see		create
 		 */
-		GpuProgramPtr createEmpty(const String& language, GpuProgramType type);
+		SPtr<GpuProgramCore> createInternal(const String& source, const String& entryPoint, const String& language,
+			GpuProgramType gptype, GpuProgramProfile profile, bool requiresAdjacency = false);
 
-	protected:
 		/**
 		 * @brief	Attempts to find a factory for the specified language. Returns null if it cannot find one.
 		 */

+ 27 - 14
BansheeCore/Include/BsGpuProgramRTTI.h

@@ -9,24 +9,37 @@ namespace BansheeEngine
 	class BS_CORE_EXPORT GpuProgramRTTI : public RTTIType<GpuProgram, Resource, GpuProgramRTTI>
 	{
 	private:
-		BS_SETGET_MEMBER(mSize, UINT32, GpuProgram)
+		UINT32& getSize(GpuProgram* obj) { return obj->mSize; }
+		void setSize(GpuProgram* obj, UINT32& val) { obj->mSize = val; }
 
-		BS_SETGET_MEMBER(mType, GpuProgramType, GpuProgram);
-		BS_SETGET_MEMBER(mNeedsAdjacencyInfo, bool, GpuProgram);
-		BS_SETGET_MEMBER(mEntryPoint, String, GpuProgram);
-		BS_SETGET_MEMBER(mProfile, GpuProgramProfile, GpuProgram);
-		BS_SETGET_MEMBER(mSource, String, GpuProgram);
+		GpuProgramType& getType(GpuProgram* obj) { return obj->mProperties.mType; }
+		void setType(GpuProgram* obj, GpuProgramType& val) { obj->mProperties.mType = val; }
+
+		bool& getNeedsAjdInfo(GpuProgram* obj) { return obj->mNeedsAdjacencyInfo; }
+		void setNeedsAjdInfo(GpuProgram* obj, bool& val) { obj->mNeedsAdjacencyInfo = val; }
+
+		String& getEntryPoint(GpuProgram* obj) { return obj->mProperties.mEntryPoint; }
+		void setEntryPoint(GpuProgram* obj, String& val) { obj->mProperties.mEntryPoint = val; }
+
+		GpuProgramProfile& getProfile(GpuProgram* obj) { return obj->mProperties.mProfile; }
+		void setProfile(GpuProgram* obj, GpuProgramProfile& val) { obj->mProperties.mProfile = val; }
+
+		String& getSource(GpuProgram* obj) { return obj->mProperties.mSource; }
+		void setSource(GpuProgram* obj, String& val) { obj->mProperties.mSource = val; }
+
+		String& getLanguage(GpuProgram* obj) { return obj->mLanguage; }
+		void setLanguage(GpuProgram* obj, String& val) { obj->mLanguage = val; }
 
 	public:
 		GpuProgramRTTI()
 		{
-			BS_ADD_PLAINFIELD(mSize, 0, GpuProgramRTTI)
-
-			BS_ADD_PLAINFIELD(mType, 2, GpuProgramRTTI)
-			BS_ADD_PLAINFIELD(mNeedsAdjacencyInfo, 3, GpuProgramRTTI)
-			BS_ADD_PLAINFIELD(mEntryPoint, 4, GpuProgramRTTI)
-			BS_ADD_PLAINFIELD(mProfile, 5, GpuProgramRTTI)
-			BS_ADD_PLAINFIELD(mSource, 6, GpuProgramRTTI)
+			addPlainField("mSize", 0, &GpuProgramRTTI::getSize, &GpuProgramRTTI::setSize);
+			addPlainField("mType", 2, &GpuProgramRTTI::getType, &GpuProgramRTTI::setType);
+			addPlainField("mNeedsAdjacencyInfo", 3, &GpuProgramRTTI::getNeedsAjdInfo, &GpuProgramRTTI::setNeedsAjdInfo);
+			addPlainField("mEntryPoint", 4, &GpuProgramRTTI::getEntryPoint, &GpuProgramRTTI::setEntryPoint);
+			addPlainField("mProfile", 5, &GpuProgramRTTI::getProfile, &GpuProgramRTTI::setProfile);
+			addPlainField("mSource", 6, &GpuProgramRTTI::getSource, &GpuProgramRTTI::setSource);
+			addPlainField("mLanguage", 7, &GpuProgramRTTI::getLanguage, &GpuProgramRTTI::setLanguage);
 		}
 
 		virtual void onDeserializationEnded(IReflectable* obj)
@@ -48,7 +61,7 @@ namespace BansheeEngine
 
 		virtual std::shared_ptr<IReflectable> newRTTIObject()
 		{
-			BS_EXCEPT(InternalErrorException, "Cannot instantiate abstract class!"); // TODO - Need to initialize this properly
+			return GpuProgramManager::instance().createEmpty("", GPT_VERTEX_PROGRAM); // Params don't matter, they'll get overwritten
 		}
 	};
 }

+ 1 - 1
BansheeCore/Include/BsRenderSystem.h

@@ -172,7 +172,7 @@ namespace BansheeEngine
 		 *
 		 * @note	You need to bind at least a vertex and a fragment program in order to draw something.
 		 */
-		virtual void bindGpuProgram(HGpuProgram prg);
+		virtual void bindGpuProgram(const SPtr<GpuProgramCore>& prg);
 
 		/**
 		 * @brief	Binds GPU program parameters. Caller must ensure these match the previously

+ 2 - 0
BansheeCore/Source/BsCoreApplication.cpp

@@ -84,6 +84,7 @@ namespace BansheeEngine
 		GameObjectManager::startUp();
 		Resources::startUp();
 		GpuProgramManager::startUp();
+		GpuProgramCoreManager::startUp();
 		RenderSystemManager::startUp();
 
 		mPrimaryWindow = RenderSystemManager::instance().initialize(desc.renderSystem, desc.primaryWindowDesc);
@@ -138,6 +139,7 @@ namespace BansheeEngine
 		gCoreThread().submitAccessors(true);
 
 		RenderSystemManager::shutDown();
+		GpuProgramCoreManager::shutDown();
 		GpuProgramManager::shutDown();
 
 		CoreObjectManager::shutDown(); // Must shut down before DynLibManager to ensure all objects are destroyed before unloading their libraries

+ 2 - 2
BansheeCore/Source/BsCoreThreadAccessor.cpp

@@ -123,9 +123,9 @@ namespace BansheeEngine
 		mCommandQueue->queue(std::bind(&RenderSystem::setRenderTarget, RenderSystem::instancePtr(), target->getCore()));
 	}
 
-	void CoreThreadAccessorBase::bindGpuProgram(HGpuProgram prg)
+	void CoreThreadAccessorBase::bindGpuProgram(const GpuProgramPtr& prg)
 	{
-		mCommandQueue->queue(std::bind(&RenderSystem::bindGpuProgram, RenderSystem::instancePtr(), prg));
+		mCommandQueue->queue(std::bind(&RenderSystem::bindGpuProgram, RenderSystem::instancePtr(), prg->getCore()));
 	}
 
 	void CoreThreadAccessorBase::unbindGpuProgram(GpuProgramType gptype)

+ 74 - 38
BansheeCore/Source/BsGpuProgram.cpp

@@ -13,70 +13,106 @@
 
 namespace BansheeEngine
 {
-    GpuProgram::GpuProgram(const String& source, const String& entryPoint, 
-		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired) 
-		:mEntryPoint(entryPoint), mType(gptype), mIsCompiled(false),
-		mProfile(profile), mNeedsAdjacencyInfo(isAdjacencyInfoRequired)
-    {
-		mParametersDesc = bs_shared_ptr<GpuParamDesc>();
-
-		if(includes != nullptr)
-		{
-			StringStream stringStream;
-			for(auto iter = includes->begin(); iter != includes->end(); ++iter)
-			{
-				if(*iter != nullptr)
-				{
-					stringStream << (*iter)->getString();
-				}
-			}
-
-			stringStream << source;
-
-			mSource = stringStream.str();
-		}
-		else
-		{
-			mSource = source;
-		}
-    }
-
-	GpuProgram::~GpuProgram()
+	GpuProgramProperties::GpuProgramProperties(const String& source, const String& entryPoint,
+		GpuProgramType gptype, GpuProgramProfile profile)
+		:mSource(source), mEntryPoint(entryPoint), mType(gptype), mProfile(profile)
+	{ }
+		
+	GpuProgramCore::GpuProgramCore(const String& source, const String& entryPoint,
+		GpuProgramType gptype, GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+		: mProperties(source, entryPoint, gptype, profile), mIsCompiled(false),
+		mNeedsAdjacencyInfo(isAdjacencyInfoRequired)
 	{
+		mParametersDesc = bs_shared_ptr<GpuParamDesc>();
 	}
 
-    bool GpuProgram::isSupported() const
+	bool GpuProgramCore::isSupported() const
     {
 		if (!isRequiredCapabilitiesSupported())
 			return false;
 
 		RenderSystem* rs = BansheeEngine::RenderSystem::instancePtr();
-		String profile = rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(mProfile);
+		String profile = rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(getProperties().getProfile());
 
 		return rs->getCapabilities()->isShaderProfileSupported(profile);
     }
 
-	bool GpuProgram::isRequiredCapabilitiesSupported() const
+	bool GpuProgramCore::isRequiredCapabilitiesSupported() const
 	{
 		return true;
 	}
 
-	GpuParamsPtr GpuProgram::createParameters()
+	GpuParamsPtr GpuProgramCore::createParameters()
 	{
 		return bs_shared_ptr<GpuParams, PoolAlloc>(mParametersDesc, false);
 	}
 
-    const String& GpuProgram::getLanguage() const
+	GpuProgram::GpuProgram(const String& source, const String& entryPoint, const String& language,
+		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired) 
+		: mProperties(mergeWithIncludes(source, includes), entryPoint, gptype, profile), mLanguage(language),
+		 mNeedsAdjacencyInfo(isAdjacencyInfoRequired)
     {
-        static const String language = "null";
 
-        return language;
     }
 
+	bool GpuProgram::isCompiled() const
+	{
+		return getCore()->isCompiled();
+	}
+
+	String GpuProgram::getCompileErrorMessage() const
+	{
+		return getCore()->getCompileErrorMessage();
+	}
+
+	GpuParamsPtr GpuProgram::createParameters()
+	{
+		return getCore()->createParameters();
+	}
+
+	GpuParamDescPtr GpuProgram::getParamDesc() const
+	{
+		return getCore()->getParamDesc();
+	}
+
+	SPtr<GpuProgramCore> GpuProgram::getCore() const
+	{
+		return std::static_pointer_cast<GpuProgramCore>(mCoreSpecific);
+	}
+
+	SPtr<CoreObjectCore> GpuProgram::createCore() const
+	{
+		return GpuProgramCoreManager::instance().createInternal(mProperties.getSource(), mProperties.getEntryPoint(),
+			mLanguage, mProperties.getType(), mProperties.getProfile(), mNeedsAdjacencyInfo);
+	}
+
+	String GpuProgram::mergeWithIncludes(const String& source, const Vector<HGpuProgInclude>* includes)
+	{
+		if (includes != nullptr)
+		{
+			StringStream stringStream;
+			for (auto iter = includes->begin(); iter != includes->end(); ++iter)
+			{
+				if (*iter != nullptr)
+				{
+					stringStream << (*iter)->getString();
+				}
+			}
+
+			stringStream << source;
+
+			return stringStream.str();
+		}
+		else
+		{
+			return source;
+		}
+	}
+
 	HGpuProgram GpuProgram::create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype,
 		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency)
 	{
-		GpuProgramPtr programPtr = _createPtr(source, entryPoint, language, gptype, profile, includes);
+		GpuProgramPtr programPtr = _createPtr(source, entryPoint, language, gptype, profile, includes, requiresAdjacency);
 
 		return static_resource_cast<GpuProgram>(gResources()._createResourceHandle(programPtr));
 	}
@@ -84,7 +120,7 @@ namespace BansheeEngine
 	GpuProgramPtr GpuProgram::_createPtr(const String& source, const String& entryPoint,
 		const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency)
 	{
-		return GpuProgramManager::instance().create(source, entryPoint, language, gptype, profile, includes);
+		return GpuProgramManager::instance().create(source, entryPoint, language, gptype, profile, includes, requiresAdjacency);
 	}
 
 	/************************************************************************/

+ 43 - 30
BansheeCore/Source/BsGpuProgramManager.cpp

@@ -9,14 +9,14 @@ namespace BansheeEngine
 	 * @brief	Null GPU program used in place of GPU programs we cannot create.
 	 *			Null programs don't do anything.
 	 */
-	class NullProgram : public GpuProgram
+	class NullProgramCore : public GpuProgramCore
 	{
 	public:
-		NullProgram()
-			:GpuProgram("", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr)
+		NullProgramCore()
+			:GpuProgramCore("", "", GPT_VERTEX_PROGRAM, GPP_NONE, nullptr)
 		{ }
 
-		~NullProgram() { }
+		~NullProgramCore() { }
 
 		bool isSupported() const { return false; }
 		const String& getLanguage() const { return sNullLang; }
@@ -24,8 +24,7 @@ namespace BansheeEngine
 	protected:
 		void loadFromSource() {}
 
-		void buildConstantDefinitions() const
-		{ }
+		void buildConstantDefinitions() const { }
 	};
 
 	/**
@@ -42,35 +41,56 @@ namespace BansheeEngine
 			return sNullLang;
 		}
 
-		GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacencyInformation)
+		SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool requiresAdjacencyInformation)
 		{
-			return bs_core_ptr<NullProgram, PoolAlloc>();
+			return bs_shared_ptr<NullProgramCore>();
 		}
 
-		GpuProgramPtr create(GpuProgramType type)
+		SPtr<GpuProgramCore> create(GpuProgramType type)
 		{
-			return bs_core_ptr<NullProgram, PoolAlloc>();
+			return bs_shared_ptr<NullProgramCore>();
 		}
 	};
 
-	GpuProgramManager::GpuProgramManager()
+	GpuProgramPtr GpuProgramManager::create(const String& source, const String& entryPoint, const String& language,
+		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes,
+		bool requiresAdjacencyInformation)
+	{
+		GpuProgram* program = new (bs_alloc<GpuProgram>()) GpuProgram(source, entryPoint, language, gptype, profile, includes, requiresAdjacencyInformation);
+		GpuProgramPtr ret = bs_core_ptr<GpuProgram, GenAlloc>(program);
+		ret->_setThisPtr(ret);
+		ret->initialize();
+
+		return ret;
+	}
+
+	GpuProgramPtr GpuProgramManager::createEmpty(const String& language, GpuProgramType type)
+	{
+		GpuProgram* program = new (bs_alloc<GpuProgram>()) GpuProgram("", "", language, GPT_VERTEX_PROGRAM, GPP_VS_1_1, nullptr, false);
+		GpuProgramPtr ret = bs_core_ptr<GpuProgram, GenAlloc>(program);
+		ret->_setThisPtr(ret);
+
+		return ret;
+	}
+
+	GpuProgramCoreManager::GpuProgramCoreManager()
 	{
 		mNullFactory = bs_new<NullProgramFactory>();
 		addFactory(mNullFactory);
 	}
 
-	GpuProgramManager::~GpuProgramManager()
+	GpuProgramCoreManager::~GpuProgramCoreManager()
 	{
 		bs_delete((NullProgramFactory*)mNullFactory);
 	}
 
-	void GpuProgramManager::addFactory(GpuProgramFactory* factory)
+	void GpuProgramCoreManager::addFactory(GpuProgramFactory* factory)
 	{
 		mFactories[factory->getLanguage()] = factory;
 	}
 
-    void GpuProgramManager::removeFactory(GpuProgramFactory* factory)
+	void GpuProgramCoreManager::removeFactory(GpuProgramFactory* factory)
     {
         FactoryMap::iterator it = mFactories.find(factory->getLanguage());
         if (it != mFactories.end() && it->second == factory)
@@ -79,7 +99,7 @@ namespace BansheeEngine
         }
     }
 
-	GpuProgramFactory* GpuProgramManager::getFactory(const String& language)
+	GpuProgramFactory* GpuProgramCoreManager::getFactory(const String& language)
 	{
 		FactoryMap::iterator i = mFactories.find(language);
 
@@ -89,35 +109,28 @@ namespace BansheeEngine
 		return i->second;
 	}
 
-	bool GpuProgramManager::isLanguageSupported(const String& lang)
+	bool GpuProgramCoreManager::isLanguageSupported(const String& lang)
 	{
 		FactoryMap::iterator i = mFactories.find(lang);
 
 		return i != mFactories.end();
 	}
 
-    GpuProgramPtr GpuProgramManager::create(const String& source, const String& entryPoint, const String& language, 
-		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes,
-		bool requiresAdjacencyInformation)
+	SPtr<GpuProgramCore> GpuProgramCoreManager::create(const String& source, const String& entryPoint, const String& language,
+		GpuProgramType gptype, GpuProgramProfile profile, bool requiresAdjacencyInformation)
     {
-		GpuProgramFactory* factory = getFactory(language);
-		GpuProgramPtr ret = factory->create(source, entryPoint, gptype, profile, includes, requiresAdjacencyInformation);
-		ret->_setThisPtr(ret);
+		SPtr<GpuProgramCore> ret = createInternal(source, entryPoint, language, gptype, profile, requiresAdjacencyInformation);
 		ret->initialize();
 
         return ret;
     }
 
-	GpuProgramPtr GpuProgramManager::createEmpty(const String& language, GpuProgramType type)
+	SPtr<GpuProgramCore> GpuProgramCoreManager::createInternal(const String& source, const String& entryPoint, const String& language,
+		GpuProgramType gptype, GpuProgramProfile profile, bool requiresAdjacencyInformation)
 	{
 		GpuProgramFactory* factory = getFactory(language);
-		GpuProgramPtr ret = factory->create(type);
-		ret->_setThisPtr(ret);
+		SPtr<GpuProgramCore> ret = factory->create(source, entryPoint, gptype, profile, requiresAdjacencyInformation);
 
 		return ret;
 	}
-
-    GpuProgramFactory::~GpuProgramFactory() 
-    {
-    }
 }

+ 2 - 2
BansheeCore/Source/BsRenderSystem.cpp

@@ -130,11 +130,11 @@ namespace BansheeEngine
 		}
 	}
 
-	void RenderSystem::bindGpuProgram(HGpuProgram prg)
+	void RenderSystem::bindGpuProgram(const SPtr<GpuProgramCore>& prg)
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
-		switch(prg->getType())
+		switch(prg->getProperties().getType())
 		{
 		case GPT_VERTEX_PROGRAM:
 			if (!mVertexProgramBound && !mClipPlanes.empty())

+ 12 - 12
BansheeCore/Source/BsRenderer.cpp

@@ -16,49 +16,49 @@ namespace BansheeEngine
 		RenderSystem& rs = RenderSystem::instance();
 
 		const MaterialProxyPass& pass = material.passes[passIdx];
-		if (pass.vertexProg)
+		if (pass.vertexProg && pass.vertexProg.isLoaded())
 		{
-			rs.bindGpuProgram(pass.vertexProg);
+			rs.bindGpuProgram(pass.vertexProg->getCore());
 			rs.bindGpuParams(GPT_VERTEX_PROGRAM, material.params[pass.vertexProgParamsIdx]);
 		}
 		else
 			rs.unbindGpuProgram(GPT_VERTEX_PROGRAM);
 
-		if (pass.fragmentProg)
+		if (pass.fragmentProg && pass.fragmentProg.isLoaded())
 		{
-			rs.bindGpuProgram(pass.fragmentProg);
+			rs.bindGpuProgram(pass.fragmentProg->getCore());
 			rs.bindGpuParams(GPT_FRAGMENT_PROGRAM, material.params[pass.fragmentProgParamsIdx]);
 		}
 		else
 			rs.unbindGpuProgram(GPT_FRAGMENT_PROGRAM);
 
-		if (pass.geometryProg)
+		if (pass.geometryProg && pass.geometryProg.isLoaded())
 		{
-			rs.bindGpuProgram(pass.geometryProg);
+			rs.bindGpuProgram(pass.geometryProg->getCore());
 			rs.bindGpuParams(GPT_GEOMETRY_PROGRAM, material.params[pass.geometryProgParamsIdx]);
 		}
 		else
 			rs.unbindGpuProgram(GPT_GEOMETRY_PROGRAM);
 
-		if (pass.hullProg)
+		if (pass.hullProg && pass.hullProg.isLoaded())
 		{
-			rs.bindGpuProgram(pass.hullProg);
+			rs.bindGpuProgram(pass.hullProg->getCore());
 			rs.bindGpuParams(GPT_HULL_PROGRAM, material.params[pass.hullProgParamsIdx]);
 		}
 		else
 			rs.unbindGpuProgram(GPT_HULL_PROGRAM);
 
-		if (pass.domainProg)
+		if (pass.domainProg && pass.domainProg.isLoaded())
 		{
-			rs.bindGpuProgram(pass.domainProg);
+			rs.bindGpuProgram(pass.domainProg->getCore());
 			rs.bindGpuParams(GPT_DOMAIN_PROGRAM, material.params[pass.domainProgParamsIdx]);
 		}
 		else
 			rs.unbindGpuProgram(GPT_DOMAIN_PROGRAM);
 
-		if (pass.computeProg)
+		if (pass.computeProg && pass.computeProg.isLoaded())
 		{
-			rs.bindGpuProgram(pass.computeProg);
+			rs.bindGpuProgram(pass.computeProg->getCore());
 			rs.bindGpuParams(GPT_COMPUTE_PROGRAM, material.params[pass.computeProgParamsIdx]);
 		}
 		else

+ 6 - 1
BansheeD3D11RenderSystem/BansheeD3D11RenderSystem.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_RSD3D11_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +141,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_RSD3D11_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -159,6 +161,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -180,6 +183,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -201,6 +205,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -222,6 +227,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -247,7 +253,6 @@
     <ClInclude Include="Include\BsD3D11HLSLParamParser.h" />
     <ClInclude Include="Include\BsD3D11IndexBuffer.h" />
     <ClInclude Include="Include\BsD3D11HLSLProgramFactory.h" />
-    <ClInclude Include="Include\BsD3D11GpuProgramRTTI.h" />
     <ClInclude Include="Include\BsD3D11Mappings.h" />
     <ClInclude Include="Include\BsD3D11MultiRenderTexture.h" />
     <ClInclude Include="Include\BsD3D11GpuParamBlockBuffer.h" />

+ 0 - 6
BansheeD3D11RenderSystem/BansheeD3D11RenderSystem.vcxproj.filters

@@ -13,9 +13,6 @@
       <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>
     </Filter>
-    <Filter Include="Header Files\RTTI">
-      <UniqueIdentifier>{13c33212-5974-4214-8658-e58e12142f4b}</UniqueIdentifier>
-    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsD3D11VideoModeInfo.h">
@@ -126,9 +123,6 @@
     <ClInclude Include="Include\BsD3D11BlendState.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsD3D11GpuProgramRTTI.h">
-      <Filter>Header Files\RTTI</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsD3D11VideoModeInfo.cpp">

+ 58 - 125
BansheeD3D11RenderSystem/Include/BsD3D11GpuProgram.h

@@ -8,26 +8,16 @@ namespace BansheeEngine
 	/**
 	 * @brief	Abstraction of a DirectX 11 shader object.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuProgram : public GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuProgramCore : public GpuProgramCore
 	{
 	public:
-		virtual ~D3D11GpuProgram();
+		virtual ~D3D11GpuProgramCore();
 
 		/**
-		 * @copydoc	GpuProgram::getLanguage
-		 */
-		const String& getLanguage() const;
-
-		/**
-		 * @copydoc	GpuProgram::createParameters
+		 * @copydoc	GpuProgramCore::createParameters
 		 */
 		GpuParamsPtr createParameters();
 
-		/**
-		 * @copydoc	GpuProgram::requiresMatrixTranspose
-		 */
-		virtual bool requiresMatrixTranspose() const { return mColumnMajorMatrices; }
-
 		/**
 		 * @brief	Returns compiled shader microcode.
 		 */
@@ -45,20 +35,20 @@ namespace BansheeEngine
 
 	protected:
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuProgram(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired);
+		D3D11GpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
+			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
 
 		/**
-		 * @copydoc GpuProgram::initialize_internal
+		 * @copydoc GpuProgramCore::initialize
 		 */
-		void initialize_internal();
+		void initialize();
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
 		 * @brief	Loads the shader from microcode.
@@ -85,23 +75,15 @@ namespace BansheeEngine
 
 		HLSLMicroCode mMicrocode;
 		VertexDeclarationPtr mInputDeclaration;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	/**
 	 * @brief	Implementation of a DX11 vertex shader.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuVertexProgram : public D3D11GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuVertexProgramCore : public D3D11GpuProgramCore
 	{
 	public:
-		~D3D11GpuVertexProgram();
+		~D3D11GpuVertexProgramCore();
 
 		/**
 		 * @brief	Returns internal DX11 vertex shader object.
@@ -112,40 +94,32 @@ namespace BansheeEngine
 		friend class D3D11HLSLProgramFactory;
 
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuVertexProgram(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes);
+		D3D11GpuVertexProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal().
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D11GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
 		 */
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		ID3D11VertexShader* mVertexShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuVertexProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	/**
 	 * @brief	Implementation of a DX11 pixel shader.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuFragmentProgram : public D3D11GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuFragmentProgramCore : public D3D11GpuProgramCore
 	{
 	public:
-		~D3D11GpuFragmentProgram();
+		~D3D11GpuFragmentProgramCore();
 
 		/**
 		 * @brief	Returns internal DX11 pixel shader object.
@@ -156,40 +130,32 @@ namespace BansheeEngine
 		friend class D3D11HLSLProgramFactory;
 
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuFragmentProgram(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes);
+		D3D11GpuFragmentProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal().
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D11GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
 		 */
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		ID3D11PixelShader* mPixelShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuFragmentProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	/**
 	 * @brief	Implementation of a DX11 domain shader.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuDomainProgram : public D3D11GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuDomainProgramCore : public D3D11GpuProgramCore
 	{
 	public:
-		~D3D11GpuDomainProgram();
+		~D3D11GpuDomainProgramCore();
 
 		/**
 		 * @brief	Returns internal DX11 domain shader object.
@@ -200,40 +166,32 @@ namespace BansheeEngine
 		friend class D3D11HLSLProgramFactory;
 
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuDomainProgram(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes);
+		D3D11GpuDomainProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal().
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D11GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
 		 */
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		ID3D11DomainShader* mDomainShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuDomainProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	/**
 	 * @brief	Implementation of a DX11 hull shader.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuHullProgram : public D3D11GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuHullProgramCore : public D3D11GpuProgramCore
 	{
 	public:
-		~D3D11GpuHullProgram();
+		~D3D11GpuHullProgramCore();
 
 		/**
 		 * @brief	Returns internal DX11 hull shader object.
@@ -244,40 +202,32 @@ namespace BansheeEngine
 		friend class D3D11HLSLProgramFactory;
 
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuHullProgram(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes);
+		D3D11GpuHullProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D11GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
 		 */
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		ID3D11HullShader* mHullShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuHullProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	/**
 	 * @brief	Implementation of a DX11 geometry shader.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuGeometryProgram : public D3D11GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuGeometryProgramCore : public D3D11GpuProgramCore
 	{
 	public:
-		~D3D11GpuGeometryProgram();
+		~D3D11GpuGeometryProgramCore();
 
 		/**
 		 * @brief	Returns internal DX11 geometry shader object.
@@ -288,41 +238,32 @@ namespace BansheeEngine
 		friend class D3D11HLSLProgramFactory;
 
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuGeometryProgram(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes,
-			bool isAdjacencyInfoRequired);
+		D3D11GpuGeometryProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D11GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
 		 */
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		ID3D11GeometryShader* mGeometryShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuGeometryProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	/**
 	 * @brief	Implementation of a DX11 compute shader.
 	 */
-	class BS_D3D11_EXPORT D3D11GpuComputeProgram : public D3D11GpuProgram
+	class BS_D3D11_EXPORT D3D11GpuComputeProgramCore : public D3D11GpuProgramCore
 	{
 	public:
-		~D3D11GpuComputeProgram();
+		~D3D11GpuComputeProgramCore();
 
 		/**
 		 * @brief	Returns internal DX11 compute shader object.
@@ -333,30 +274,22 @@ namespace BansheeEngine
 		friend class D3D11HLSLProgramFactory;
 
 		/**
-		 * @copydoc	GpuProgram::GpuProgram
+		 * @copydoc	GpuProgramCore::GpuProgramCore
 		 */
-		D3D11GpuComputeProgram(const String& source, const String& entryPoint,
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes);
+		D3D11GpuComputeProgramCore(const String& source, const String& entryPoint,
+			GpuProgramProfile profile);
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D11GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D11GpuProgramCore::loadFromMicrocode
 		 */
 		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 
 	protected:
 		ID3D11ComputeShader* mComputeShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D11GpuComputeProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
 	};
 }

+ 0 - 170
BansheeD3D11RenderSystem/Include/BsD3D11GpuProgramRTTI.h

@@ -1,170 +0,0 @@
-#pragma once
-
-#include "BsD3D11Prerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGpuProgramManager.h"
-#include "BsD3D11GpuProgram.h"
-
-namespace BansheeEngine
-{
-	class BS_D3D11_EXPORT D3D11GpuProgramRTTI : public RTTIType<D3D11GpuProgram, GpuProgram, D3D11GpuProgramRTTI>
-	{
-	public:
-		D3D11GpuProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			BS_EXCEPT(InvalidStateException, "Cannot create an instance of an abstract class.");
-		}
-	};
-
-	class BS_D3D11_EXPORT D3D11GpuVertexProgramRTTI : public RTTIType<D3D11GpuVertexProgram, D3D11GpuProgram, D3D11GpuVertexProgramRTTI>
-	{
-	public:
-		D3D11GpuVertexProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuVertexProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuVertexProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_VERTEX_PROGRAM);
-		}
-	};
-
-	class BS_D3D11_EXPORT D3D11GpuFragmentProgramRTTI : public RTTIType<D3D11GpuFragmentProgram, D3D11GpuProgram, D3D11GpuFragmentProgramRTTI>
-	{
-	public:
-		D3D11GpuFragmentProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuFragmentProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuFragmentProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_FRAGMENT_PROGRAM);
-		}
-	};
-
-	class BS_D3D11_EXPORT D3D11GpuGeometryProgramRTTI : public RTTIType<D3D11GpuGeometryProgram, D3D11GpuProgram, D3D11GpuGeometryProgramRTTI>
-	{
-	public:
-		D3D11GpuGeometryProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuGeometryProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuGeometryProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_GEOMETRY_PROGRAM);
-		}
-	};
-
-	class BS_D3D11_EXPORT D3D11GpuHullProgramRTTI : public RTTIType<D3D11GpuHullProgram, D3D11GpuProgram, D3D11GpuHullProgramRTTI>
-	{
-	public:
-		D3D11GpuHullProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuHullProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuHullProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_HULL_PROGRAM);
-		}
-	};
-
-	class BS_D3D11_EXPORT D3D11GpuDomainProgramRTTI : public RTTIType<D3D11GpuDomainProgram, D3D11GpuProgram, D3D11GpuDomainProgramRTTI>
-	{
-	public:
-		D3D11GpuDomainProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuDomainProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuDomainProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_DOMAIN_PROGRAM);
-		}
-	};
-
-	class BS_D3D11_EXPORT D3D11GpuComputeProgramRTTI : public RTTIType<D3D11GpuComputeProgram, D3D11GpuProgram, D3D11GpuComputeProgramRTTI>
-	{
-	public:
-		D3D11GpuComputeProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D11GpuComputeProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D11_GpuComputeProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_COMPUTE_PROGRAM);
-		}
-	};
-}

+ 5 - 5
BansheeD3D11RenderSystem/Include/BsD3D11HLSLProgramFactory.h

@@ -20,16 +20,16 @@ namespace BansheeEngine
 		const String& getLanguage() const;
 
 		/**
-		 * @copydoc	GpuProgramFactory::getLanguage(const String&, const String&, GpuProgramType,
-		 *			GpuProgramProfile, const Vector<HGpuProgInclude>*, bool)
+		 * @copydoc	GpuProgramFactory::create(const String&, const String&, GpuProgramType,
+		 *			GpuProgramProfile, bool)
 		 */
-		GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requireAdjacencyInfo);
+		SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool requireAdjacencyInfo);
 
 		/**
 		* @copydoc	GpuProgramFactory::create(GpuProgramType)
 		*/
-		GpuProgramPtr create(GpuProgramType type);
+		SPtr<GpuProgramCore> create(GpuProgramType type);
 
 	protected:
 		static const String LANGUAGE_NAME;

+ 4 - 2
BansheeD3D11RenderSystem/Include/BsD3D11InputLayoutManager.h

@@ -64,13 +64,15 @@ namespace BansheeEngine
 		 *
 		 * @note	Error will be thrown if the vertex buffer doesn't provide all the necessary data that the shader expects.
 		 */
-		ID3D11InputLayout* retrieveInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgram& vertexProgram);
+		ID3D11InputLayout* retrieveInputLayout(VertexDeclarationPtr vertexShaderDecl, 
+			VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgramCore& vertexProgram);
 
 	private:
 		/**
 		 * @brief	Creates a new input layout using the specified parameters and stores it in the input layout map.
 		 */
-		void addNewInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgram& vertexProgram);
+		void addNewInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, 
+			D3D11GpuProgramCore& vertexProgram);
 
 		/**
 		 * @brief	Destroys least used input layout.

+ 1 - 16
BansheeD3D11RenderSystem/Include/BsD3D11Prerequisites.h

@@ -28,7 +28,6 @@ namespace BansheeEngine
 	class D3D11DriverList;
 	class D3D11VideoMode;
 	class D3D11VideoModeList;
-	class D3D11GpuProgram;
 	class D3D11GpuProgramManager;
 	class D3D11HardwareBufferManager;
 	class D3D11IndexBuffer;
@@ -50,20 +49,7 @@ namespace BansheeEngine
 	class D3D11InputLayoutManager;
 	class D3D11GpuBuffer;
 	class D3D11RenderUtility;
-
-	/**
-	 * @brief	Type IDs used for RTTI.
-	 */
-	enum TypeID_D3D11
-	{
-		TID_D3D11_GpuProgram = 12000,
-		TID_D3D11_GpuVertexProgram = 12001,
-		TID_D3D11_GpuFragmentProgram = 12002,
-		TID_D3D11_GpuGeometryProgram = 12003,
-		TID_D3D11_GpuHullProgram = 12004,
-		TID_D3D11_GpuDomainProgram = 12005,
-		TID_D3D11_GpuComputeProgram = 12006
-	};
+	class D3D11GpuProgramCore;
 
 	/**
 	 * @brief	DirectX 11 specific types to track resource statistics for.
@@ -91,7 +77,6 @@ namespace BansheeEngine
 	typedef std::shared_ptr<D3D11SamplerState> D3D11SamplerStatePtr;
 	typedef std::shared_ptr<D3D11DepthStencilState> D3D11DepthStencilStatePtr;
 	typedef std::shared_ptr<D3D11RenderWindow> D3D11RenderWindowPtr;
-	typedef std::shared_ptr<D3D11GpuProgram> D3D11GpuProgramPtr;
 
 #if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
 #	ifdef BS_RSD3D11_EXPORTS

+ 2 - 2
BansheeD3D11RenderSystem/Include/BsD3D11RenderSystem.h

@@ -129,7 +129,7 @@ namespace BansheeEngine
 		/** 
 		 * @copydoc RenderSystem::bindGpuProgram
 		 */
-		void bindGpuProgram(HGpuProgram prg);
+		void bindGpuProgram(const SPtr<GpuProgramCore>& prg);
 
 		/** 
 		 * @copydoc RenderSystem::unbindGpuProgram
@@ -263,7 +263,7 @@ namespace BansheeEngine
 		D3D11_RECT mScissorRect;
 
 		VertexDeclarationPtr mActiveVertexDeclaration;
-		D3D11GpuProgramPtr mActiveVertexShader;
+		SPtr<D3D11GpuProgramCore> mActiveVertexShader;
 
 		DrawOperationType mActiveDrawOp;
 	};

+ 69 - 163
BansheeD3D11RenderSystem/Source/BsD3D11GpuProgram.cpp

@@ -7,39 +7,38 @@
 #include "BsGpuProgramManager.h"
 #include "BsHardwareBufferManager.h"
 #include "BsD3D11HLSLParamParser.h"
-#include "BsD3D11GpuProgramRTTI.h"
 #include "BsRenderStats.h"
 
 namespace BansheeEngine
 {
-	UINT32 D3D11GpuProgram::GlobalProgramId = 0;
+	UINT32 D3D11GpuProgramCore::GlobalProgramId = 0;
 
-	D3D11GpuProgram::D3D11GpuProgram(const String& source, const String& entryPoint, GpuProgramType gptype, 
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired)
-		: GpuProgram(source, entryPoint, gptype, profile, includes, isAdjacencyInfoRequired),
+	D3D11GpuProgramCore::D3D11GpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
+		GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+		: GpuProgramCore(source, entryPoint, gptype, profile, isAdjacencyInfoRequired),
 		mColumnMajorMatrices(false), mEnableBackwardsCompatibility(false), mProgramId(0)
 	{
 
 	}
 
-	D3D11GpuProgram::~D3D11GpuProgram()
+	D3D11GpuProgramCore::~D3D11GpuProgramCore()
 	{
 
 	}
 
-	void D3D11GpuProgram::initialize_internal()
+	void D3D11GpuProgramCore::initialize()
 	{
 		if (!isSupported())
 		{
 			mIsCompiled = false;
 			mCompileError = "Specified program is not supported by the current render system.";
 
-			GpuProgram::initialize_internal();
+			GpuProgramCore::initialize();
 			return;
 		}
 
 		D3D11RenderSystem* rs = static_cast<D3D11RenderSystem*>(RenderSystem::instancePtr());
-		String hlslProfile = rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(mProfile);
+		String hlslProfile = rs->getCapabilities()->gpuProgProfileToRSSpecificProfile(mProperties.getProfile());
 
 		ID3DBlob* microcode = compileMicrocode(hlslProfile);
 
@@ -58,20 +57,20 @@ namespace BansheeEngine
 
 		BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_GpuProgram);
 
-		GpuProgram::initialize_internal();
+		GpuProgramCore::initialize();
 	}
 
-	void D3D11GpuProgram::destroy_internal()
+	void D3D11GpuProgramCore::destroy()
 	{
 		mMicrocode.clear();
 		mInputDeclaration = nullptr;
 
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuProgram);
 
-		GpuProgram::destroy_internal();
+		GpuProgramCore::destroy();
 	}
 
-	ID3DBlob* D3D11GpuProgram::compileMicrocode(const String& profile)
+	ID3DBlob* D3D11GpuProgramCore::compileMicrocode(const String& profile)
 	{
 		// TODO - Preprocessor defines aren't supported
 
@@ -92,13 +91,16 @@ namespace BansheeEngine
 		ID3DBlob* microCode = nullptr;
 		ID3DBlob* errors = nullptr;
 
+		const String& source = mProperties.getSource();
+		const String& entryPoint = mProperties.getEntryPoint();
+
 		HRESULT hr = D3DCompile(
-			mSource.c_str(),	// [in] Pointer to the shader in memory. 
-			mSource.size(),		// [in] Size of the shader in memory.  
+			source.c_str(),		// [in] Pointer to the shader in memory. 
+			source.size(),		// [in] Size of the shader in memory.  
 			nullptr,			// [in] The name of the file that contains the shader code. 
 			nullptr,			// [in] Optional. Pointer to a NULL-terminated array of macro definitions. See D3D_SHADER_MACRO. If not used, set this to NULL. 
 			nullptr,			// [in] Optional. Pointer to an ID3DInclude Interface interface for handling include files. Setting this to NULL will cause a compile error if a shader contains a #include. 
-			mEntryPoint.c_str(),// [in] Name of the shader-entrypoint function where shader execution begins. 
+			entryPoint.c_str(),	// [in] Name of the shader-entrypoint function where shader execution begins. 
 			profile.c_str(),// [in] A string that specifies the shader model; can be any profile in shader model 4 or higher. 
 			compileFlags,		// [in] Effect compile flags - no D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY at the first try...
 			0,					// [in] Effect compile flags
@@ -126,12 +128,12 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuProgram::populateParametersAndConstants(ID3DBlob* microcode)
+	void D3D11GpuProgramCore::populateParametersAndConstants(ID3DBlob* microcode)
 	{
 		assert(microcode != nullptr);
 
 		D3D11HLSLParamParser parser;
-		if (mType == GPT_VERTEX_PROGRAM)
+		if (mProperties.getType() == GPT_VERTEX_PROGRAM)
 		{
 			VertexDeclaration::VertexElementList inputParams;
 			parser.parse(microcode, *mParametersDesc, &inputParams);
@@ -144,42 +146,22 @@ namespace BansheeEngine
 		}
 	}
 
-	GpuParamsPtr D3D11GpuProgram::createParameters()
+	GpuParamsPtr D3D11GpuProgramCore::createParameters()
 	{
 		GpuParamsPtr params = bs_shared_ptr<GpuParams, PoolAlloc>(mParametersDesc, mColumnMajorMatrices);
 		return params;
 	}
 
-	const String& D3D11GpuProgram::getLanguage() const
-	{
-		static String name = "hlsl";
-
-		return name;
-	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuProgram::getRTTIStatic()
-	{
-		return D3D11GpuProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D11GpuProgram::getRTTI() const
-	{
-		return D3D11GpuProgram::getRTTIStatic();
-	}
-
-	D3D11GpuVertexProgram::D3D11GpuVertexProgram(const String& source, const String& entryPoint,
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D11GpuProgram(source, entryPoint, GPT_VERTEX_PROGRAM, profile, includes, false)
+	D3D11GpuVertexProgramCore::D3D11GpuVertexProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D11GpuProgramCore(source, entryPoint, GPT_VERTEX_PROGRAM, profile, false)
 		, mVertexShader(nullptr)
 	{ }
 
-	D3D11GpuVertexProgram::~D3D11GpuVertexProgram()
+	D3D11GpuVertexProgramCore::~D3D11GpuVertexProgramCore()
 	{ }
 
-	void D3D11GpuVertexProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob*  microcode)
+	void D3D11GpuVertexProgramCore::loadFromMicrocode(D3D11Device& device, ID3D10Blob*  microcode)
 	{
 		HRESULT hr = device.getD3D11Device()->CreateVertexShader( 
 			static_cast<DWORD*>(microcode->GetBufferPointer()), microcode->GetBufferSize(),
@@ -194,41 +176,28 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuVertexProgram::destroy_internal()
+	void D3D11GpuVertexProgramCore::destroy()
 	{
 		SAFE_RELEASE(mVertexShader);
 
-		D3D11GpuProgram::destroy_internal();
+		D3D11GpuProgramCore::destroy();
 	}
 
-	ID3D11VertexShader * D3D11GpuVertexProgram::getVertexShader() const
+	ID3D11VertexShader * D3D11GpuVertexProgramCore::getVertexShader() const
 	{
 		return mVertexShader;
 	}
 
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuVertexProgram::getRTTIStatic()
-	{
-		return D3D11GpuVertexProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D11GpuVertexProgram::getRTTI() const
-	{
-		return D3D11GpuVertexProgram::getRTTIStatic();
-	}
-
-	D3D11GpuFragmentProgram::D3D11GpuFragmentProgram(const String& source, const String& entryPoint,
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D11GpuProgram(source, entryPoint, GPT_FRAGMENT_PROGRAM, profile, includes, false)
+	D3D11GpuFragmentProgramCore::D3D11GpuFragmentProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D11GpuProgramCore(source, entryPoint, GPT_FRAGMENT_PROGRAM, profile, false)
 		, mPixelShader(nullptr)
 	{ }
 
-	D3D11GpuFragmentProgram::~D3D11GpuFragmentProgram()
+	D3D11GpuFragmentProgramCore::~D3D11GpuFragmentProgramCore()
 	{ }
 
-	void D3D11GpuFragmentProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
+	void D3D11GpuFragmentProgramCore::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
 	{
 		HRESULT hr = device.getD3D11Device()->CreatePixelShader(
 			static_cast<DWORD*>(microcode->GetBufferPointer()), microcode->GetBufferSize(),
@@ -242,41 +211,29 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuFragmentProgram::destroy_internal()
+	void D3D11GpuFragmentProgramCore::destroy()
 	{
 		SAFE_RELEASE(mPixelShader);
 
-		D3D11GpuProgram::destroy_internal();
+		D3D11GpuProgramCore::destroy();
 	}
 
-	ID3D11PixelShader * D3D11GpuFragmentProgram::getPixelShader() const
+	ID3D11PixelShader * D3D11GpuFragmentProgramCore::getPixelShader() const
 	{
 		return mPixelShader;
 	}
 
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuFragmentProgram::getRTTIStatic()
-	{
-		return D3D11GpuFragmentProgramRTTI::instance();
-	}
 
-	RTTITypeBase* D3D11GpuFragmentProgram::getRTTI() const
-	{
-		return D3D11GpuFragmentProgram::getRTTIStatic();
-	}
-
-	D3D11GpuGeometryProgram::D3D11GpuGeometryProgram(const String& source, const String& entryPoint,
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired)
-		: D3D11GpuProgram(source, entryPoint, GPT_GEOMETRY_PROGRAM, profile, includes, isAdjacencyInfoRequired)
+	D3D11GpuGeometryProgramCore::D3D11GpuGeometryProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+		: D3D11GpuProgramCore(source, entryPoint, GPT_GEOMETRY_PROGRAM, profile, isAdjacencyInfoRequired)
 		, mGeometryShader(nullptr)
 	{ }
 
-	D3D11GpuGeometryProgram::~D3D11GpuGeometryProgram()
+	D3D11GpuGeometryProgramCore::~D3D11GpuGeometryProgramCore()
 	{ }
 
-	void D3D11GpuGeometryProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
+	void D3D11GpuGeometryProgramCore::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
 	{
 		HRESULT hr = device.getD3D11Device()->CreateGeometryShader(
 			static_cast<DWORD*>(microcode->GetBufferPointer()), microcode->GetBufferSize(),
@@ -290,41 +247,28 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuGeometryProgram::destroy_internal()
+	void D3D11GpuGeometryProgramCore::destroy()
 	{
 		SAFE_RELEASE(mGeometryShader);
 
-		D3D11GpuProgram::destroy_internal();
+		D3D11GpuProgramCore::destroy();
 	}
 
-	ID3D11GeometryShader * D3D11GpuGeometryProgram::getGeometryShader() const
+	ID3D11GeometryShader * D3D11GpuGeometryProgramCore::getGeometryShader() const
 	{
 		return mGeometryShader;
 	}
 
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuGeometryProgram::getRTTIStatic()
-	{
-		return D3D11GpuGeometryProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D11GpuGeometryProgram::getRTTI() const
-	{
-		return D3D11GpuGeometryProgram::getRTTIStatic();
-	}
-
-	D3D11GpuDomainProgram::D3D11GpuDomainProgram(const String& source, const String& entryPoint,
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D11GpuProgram(source, entryPoint, GPT_DOMAIN_PROGRAM, profile, includes, false)
+	D3D11GpuDomainProgramCore::D3D11GpuDomainProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D11GpuProgramCore(source, entryPoint, GPT_DOMAIN_PROGRAM, profile, false)
 		, mDomainShader(nullptr)
 	{ }
 
-	D3D11GpuDomainProgram::~D3D11GpuDomainProgram()
+	D3D11GpuDomainProgramCore::~D3D11GpuDomainProgramCore()
 	{ }
 
-	void D3D11GpuDomainProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
+	void D3D11GpuDomainProgramCore::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
 	{
 		HRESULT hr = device.getD3D11Device()->CreateDomainShader(
 			static_cast<DWORD*>(microcode->GetBufferPointer()), microcode->GetBufferSize(),
@@ -338,41 +282,28 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuDomainProgram::destroy_internal()
+	void D3D11GpuDomainProgramCore::destroy()
 	{
 		SAFE_RELEASE(mDomainShader);
 
-		D3D11GpuProgram::destroy_internal();
+		D3D11GpuProgramCore::destroy();
 	}
 
-	ID3D11DomainShader * D3D11GpuDomainProgram::getDomainShader() const
+	ID3D11DomainShader * D3D11GpuDomainProgramCore::getDomainShader() const
 	{
 		return mDomainShader;
 	}
 
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuDomainProgram::getRTTIStatic()
-	{
-		return D3D11GpuDomainProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D11GpuDomainProgram::getRTTI() const
-	{
-		return D3D11GpuDomainProgram::getRTTIStatic();
-	}
-
-	D3D11GpuHullProgram::D3D11GpuHullProgram(const String& source, const String& entryPoint,
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D11GpuProgram(source, entryPoint, GPT_HULL_PROGRAM, profile, includes, false)
+	D3D11GpuHullProgramCore::D3D11GpuHullProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D11GpuProgramCore(source, entryPoint, GPT_HULL_PROGRAM, profile, false)
 		, mHullShader(nullptr)
 	{ }
 
-	D3D11GpuHullProgram::~D3D11GpuHullProgram()
+	D3D11GpuHullProgramCore::~D3D11GpuHullProgramCore()
 	{ }
 
-	void D3D11GpuHullProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
+	void D3D11GpuHullProgramCore::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
 	{
 		// Create the shader
 		HRESULT hr = device.getD3D11Device()->CreateHullShader(
@@ -387,41 +318,29 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuHullProgram::destroy_internal()
+	void D3D11GpuHullProgramCore::destroy()
 	{
 		SAFE_RELEASE(mHullShader);
 
-		D3D11GpuProgram::destroy_internal();
+		D3D11GpuProgramCore::destroy();
 	}
 
-	ID3D11HullShader* D3D11GpuHullProgram::getHullShader() const
+	ID3D11HullShader* D3D11GpuHullProgramCore::getHullShader() const
 	{
 		return mHullShader;
 	}
 
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuHullProgram::getRTTIStatic()
-	{
-		return D3D11GpuHullProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D11GpuHullProgram::getRTTI() const
-	{
-		return D3D11GpuHullProgram::getRTTIStatic();
-	}
 
-	D3D11GpuComputeProgram::D3D11GpuComputeProgram(const String& source, const String& entryPoint,
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D11GpuProgram(source, entryPoint, GPT_COMPUTE_PROGRAM, profile, includes, false)
+	D3D11GpuComputeProgramCore::D3D11GpuComputeProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D11GpuProgramCore(source, entryPoint, GPT_COMPUTE_PROGRAM, profile, false)
 		, mComputeShader(nullptr)
 	{ }
 
-	D3D11GpuComputeProgram::~D3D11GpuComputeProgram()
+	D3D11GpuComputeProgramCore::~D3D11GpuComputeProgramCore()
 	{ }
 
-	void D3D11GpuComputeProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
+	void D3D11GpuComputeProgramCore::loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode)
 	{
 		HRESULT hr = device.getD3D11Device()->CreateComputeShader(
 			static_cast<DWORD*>(microcode->GetBufferPointer()), microcode->GetBufferSize(),
@@ -435,28 +354,15 @@ namespace BansheeEngine
 		}
 	}
 
-	void D3D11GpuComputeProgram::destroy_internal()
+	void D3D11GpuComputeProgramCore::destroy()
 	{
 		SAFE_RELEASE(mComputeShader);
 
-		D3D11GpuProgram::destroy_internal();
+		D3D11GpuProgramCore::destroy();
 	}
 
-	ID3D11ComputeShader* D3D11GpuComputeProgram::getComputeShader() const
+	ID3D11ComputeShader* D3D11GpuComputeProgramCore::getComputeShader() const
 	{
 		return mComputeShader;
 	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D11GpuComputeProgram::getRTTIStatic()
-	{
-		return D3D11GpuComputeProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D11GpuComputeProgram::getRTTI() const
-	{
-		return D3D11GpuComputeProgram::getRTTIStatic();
-	}
 }

+ 23 - 23
BansheeD3D11RenderSystem/Source/BsD3D11HLSLProgramFactory.cpp

@@ -18,50 +18,50 @@ namespace BansheeEngine
         return LANGUAGE_NAME;
     }
 
-	GpuProgramPtr D3D11HLSLProgramFactory::create(const String& source, const String& entryPoint, 
-		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requireAdjacencyInfo)
+	SPtr<GpuProgramCore> D3D11HLSLProgramFactory::create(const String& source, const String& entryPoint,
+		GpuProgramType gptype, GpuProgramProfile profile, bool requireAdjacencyInfo)
     {
 		switch (gptype)
 		{
 		case GPT_VERTEX_PROGRAM:
-			return bs_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (bs_alloc<D3D11GpuVertexProgram, PoolAlloc>()) 
-				D3D11GpuVertexProgram(source, entryPoint, profile, includes));
+			return bs_shared_ptr<D3D11GpuVertexProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuVertexProgramCore, GenAlloc>())
+				D3D11GpuVertexProgramCore(source, entryPoint, profile));
 		case GPT_FRAGMENT_PROGRAM:
-			return bs_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (bs_alloc<D3D11GpuFragmentProgram, PoolAlloc>()) 
-				D3D11GpuFragmentProgram(source, entryPoint, profile, includes));
+			return bs_shared_ptr<D3D11GpuFragmentProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuFragmentProgramCore, GenAlloc>())
+				D3D11GpuFragmentProgramCore(source, entryPoint, profile));
 		case GPT_HULL_PROGRAM:
-			return bs_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (bs_alloc<D3D11GpuHullProgram, PoolAlloc>()) 
-				D3D11GpuHullProgram(source, entryPoint, profile, includes));
+			return bs_shared_ptr<D3D11GpuHullProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuHullProgramCore, GenAlloc>())
+				D3D11GpuHullProgramCore(source, entryPoint, profile));
 		case GPT_DOMAIN_PROGRAM:
-			return bs_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (bs_alloc<D3D11GpuDomainProgram, PoolAlloc>()) 
-				D3D11GpuDomainProgram(source, entryPoint, profile, includes));
+			return bs_shared_ptr<D3D11GpuDomainProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuDomainProgramCore, GenAlloc>())
+				D3D11GpuDomainProgramCore(source, entryPoint, profile));
 		case GPT_GEOMETRY_PROGRAM:
-			return bs_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (bs_alloc<D3D11GpuGeometryProgram, PoolAlloc>()) 
-				D3D11GpuGeometryProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
+			return bs_shared_ptr<D3D11GpuGeometryProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuGeometryProgramCore, GenAlloc>())
+				D3D11GpuGeometryProgramCore(source, entryPoint, profile, requireAdjacencyInfo));
 		}
 
 		return nullptr;
     }
 
-	GpuProgramPtr D3D11HLSLProgramFactory::create(GpuProgramType type)
+	SPtr<GpuProgramCore> D3D11HLSLProgramFactory::create(GpuProgramType type)
 	{
 		switch (type)
 		{
 		case GPT_VERTEX_PROGRAM:
-			return bs_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (bs_alloc<D3D11GpuVertexProgram, PoolAlloc>())
-				D3D11GpuVertexProgram("", "", GPP_NONE, nullptr));
+			return bs_shared_ptr<D3D11GpuVertexProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuVertexProgramCore, GenAlloc>())
+				D3D11GpuVertexProgramCore("", "", GPP_NONE));
 		case GPT_FRAGMENT_PROGRAM:
-			return bs_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (bs_alloc<D3D11GpuFragmentProgram, PoolAlloc>())
-				D3D11GpuFragmentProgram("", "", GPP_NONE, nullptr));
+			return bs_shared_ptr<D3D11GpuFragmentProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuFragmentProgramCore, GenAlloc>())
+				D3D11GpuFragmentProgramCore("", "", GPP_NONE));
 		case GPT_HULL_PROGRAM:
-			return bs_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (bs_alloc<D3D11GpuHullProgram, PoolAlloc>())
-				D3D11GpuHullProgram("", "", GPP_NONE, nullptr));
+			return bs_shared_ptr<D3D11GpuHullProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuHullProgramCore, GenAlloc>())
+				D3D11GpuHullProgramCore("", "", GPP_NONE));
 		case GPT_DOMAIN_PROGRAM:
-			return bs_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (bs_alloc<D3D11GpuDomainProgram, PoolAlloc>())
-				D3D11GpuDomainProgram("", "", GPP_NONE, nullptr));
+			return bs_shared_ptr<D3D11GpuDomainProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuDomainProgramCore, GenAlloc>())
+				D3D11GpuDomainProgramCore("", "", GPP_NONE));
 		case GPT_GEOMETRY_PROGRAM:
-			return bs_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (bs_alloc<D3D11GpuGeometryProgram, PoolAlloc>())
-				D3D11GpuGeometryProgram("", "", GPP_NONE, nullptr, false));
+			return bs_shared_ptr<D3D11GpuGeometryProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuGeometryProgramCore, GenAlloc>())
+				D3D11GpuGeometryProgramCore("", "", GPP_NONE, false));
 		}
 
 		return nullptr;

+ 2 - 2
BansheeD3D11RenderSystem/Source/BsD3D11InputLayoutManager.cpp

@@ -53,7 +53,7 @@ namespace BansheeEngine
 		}
 	}
 
-	ID3D11InputLayout* D3D11InputLayoutManager::retrieveInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgram& vertexProgram)
+	ID3D11InputLayout* D3D11InputLayoutManager::retrieveInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgramCore& vertexProgram)
 	{
 		VertexDeclarationKey pair;
 		pair.vertxDeclId = vertexBufferDecl->getInternalID();
@@ -77,7 +77,7 @@ namespace BansheeEngine
 		return iterFind->second->inputLayout;
 	}
 
-	void D3D11InputLayoutManager::addNewInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgram& vertexProgram)
+	void D3D11InputLayoutManager::addNewInputLayout(VertexDeclarationPtr vertexShaderDecl, VertexDeclarationPtr vertexBufferDecl, D3D11GpuProgramCore& vertexProgram)
 	{
 		if(!areCompatible(vertexShaderDecl, vertexBufferDecl))
 			return; // Error was already reported, so just quit here

+ 11 - 14
BansheeD3D11RenderSystem/Source/BsD3D11RenderSystem.cpp

@@ -128,7 +128,7 @@ namespace BansheeEngine
 		mCurrentCapabilities = createRenderSystemCapabilities();
 
 		mCurrentCapabilities->addShaderProfile("hlsl");
-		GpuProgramManager::instance().addFactory(mHLSLFactory);
+		GpuProgramCoreManager::instance().addFactory(mHLSLFactory);
 
 		mIAManager = bs_new<D3D11InputLayoutManager>();
 		RenderSystem::initializePrepare();
@@ -469,54 +469,51 @@ namespace BansheeEngine
 		mDevice->getImmediateContext()->IASetPrimitiveTopology(D3D11Mappings::getPrimitiveType(op));
 	}
 
-	void D3D11RenderSystem::bindGpuProgram(HGpuProgram prg)
+	void D3D11RenderSystem::bindGpuProgram(const SPtr<GpuProgramCore>& prg)
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
-		if(!prg.isLoaded())
-			return;
-
-		switch(prg->getType())
+		switch(prg->getProperties().getType())
 		{
 		case GPT_VERTEX_PROGRAM:
 			{
-				D3D11GpuVertexProgram* d3d11GpuProgram = static_cast<D3D11GpuVertexProgram*>(prg.get());
+				D3D11GpuVertexProgramCore* d3d11GpuProgram = static_cast<D3D11GpuVertexProgramCore*>(prg.get());
 				mDevice->getImmediateContext()->VSSetShader(d3d11GpuProgram->getVertexShader(), nullptr, 0);
-				mActiveVertexShader = std::static_pointer_cast<D3D11GpuProgram>(prg.getInternalPtr());
+				mActiveVertexShader = std::static_pointer_cast<D3D11GpuProgramCore>(prg);
 				break;
 			}
 		case GPT_FRAGMENT_PROGRAM:
 			{
-				D3D11GpuFragmentProgram* d3d11GpuProgram = static_cast<D3D11GpuFragmentProgram*>(prg.get());
+				D3D11GpuFragmentProgramCore* d3d11GpuProgram = static_cast<D3D11GpuFragmentProgramCore*>(prg.get());
 				mDevice->getImmediateContext()->PSSetShader(d3d11GpuProgram->getPixelShader(), nullptr, 0);
 				break;
 			}
 		case GPT_GEOMETRY_PROGRAM:
 			{
-				D3D11GpuGeometryProgram* d3d11GpuProgram = static_cast<D3D11GpuGeometryProgram*>(prg.get());
+				D3D11GpuGeometryProgramCore* d3d11GpuProgram = static_cast<D3D11GpuGeometryProgramCore*>(prg.get());
 				mDevice->getImmediateContext()->GSSetShader(d3d11GpuProgram->getGeometryShader(), nullptr, 0);
 				break;
 			}
 		case GPT_DOMAIN_PROGRAM:
 			{
-				D3D11GpuDomainProgram* d3d11GpuProgram = static_cast<D3D11GpuDomainProgram*>(prg.get());
+				D3D11GpuDomainProgramCore* d3d11GpuProgram = static_cast<D3D11GpuDomainProgramCore*>(prg.get());
 				mDevice->getImmediateContext()->DSSetShader(d3d11GpuProgram->getDomainShader(), nullptr, 0);
 				break;
 			}
 		case GPT_HULL_PROGRAM:
 			{
-				D3D11GpuHullProgram* d3d11GpuProgram = static_cast<D3D11GpuHullProgram*>(prg.get());
+				D3D11GpuHullProgramCore* d3d11GpuProgram = static_cast<D3D11GpuHullProgramCore*>(prg.get());
 				mDevice->getImmediateContext()->HSSetShader(d3d11GpuProgram->getHullShader(), nullptr, 0);
 				break;
 			}
 		case GPT_COMPUTE_PROGRAM:
 			{
-				D3D11GpuComputeProgram* d3d11GpuProgram = static_cast<D3D11GpuComputeProgram*>(prg.get());
+				D3D11GpuComputeProgramCore* d3d11GpuProgram = static_cast<D3D11GpuComputeProgramCore*>(prg.get());
 				mDevice->getImmediateContext()->CSSetShader(d3d11GpuProgram->getComputeShader(), nullptr, 0);
 				break;
 			}
 		default:
-			BS_EXCEPT(InvalidParametersException, "Unsupported gpu program type: " + toString(prg->getType()));
+			BS_EXCEPT(InvalidParametersException, "Unsupported gpu program type: " + toString(prg->getProperties().getType()));
 		}
 
 		if (mDevice->hasError())

+ 6 - 1
BansheeD3D9RenderSystem/BansheeD3D9RenderSystem.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_RSD3D9_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +141,7 @@
       <AdditionalIncludeDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_RSD3D9_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -159,6 +161,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -180,6 +183,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -201,6 +205,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -222,6 +227,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -250,7 +256,6 @@
     <ClInclude Include="Include\BsD3D9TimerQuery.h" />
     <ClInclude Include="Include\BsD3D9VertexBuffer.h" />
     <ClInclude Include="Include\BsD3D9HLSLProgramFactory.h" />
-    <ClInclude Include="Include\BsD3D9GpuProgramRTTI.h" />
     <ClInclude Include="Include\BsD3D9Mappings.h" />
     <ClInclude Include="Include\BsD3D9MultiRenderTexture.h" />
     <ClInclude Include="Include\BsD3D9Prerequisites.h" />

+ 0 - 6
BansheeD3D9RenderSystem/BansheeD3D9RenderSystem.vcxproj.filters

@@ -13,9 +13,6 @@
       <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>
     </Filter>
-    <Filter Include="Header Files\RTTI">
-      <UniqueIdentifier>{975ebce1-e98b-4380-bb4c-080103baa245}</UniqueIdentifier>
-    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsD3D9VideoModeInfo.h">
@@ -108,9 +105,6 @@
     <ClInclude Include="Include\BsD3D9Device.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsD3D9GpuProgramRTTI.h">
-      <Filter>Header Files\RTTI</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsD3D9EmulatedParamBlocks.h">
       <Filter>Header Files</Filter>
     </ClInclude>

+ 21 - 65
BansheeD3D9RenderSystem/Include/BsD3D9GpuProgram.h

@@ -23,57 +23,41 @@ namespace BansheeEngine
 	/**
 	 * @brief	DirectX 9 implementation of a GPU program.
 	 */
-    class BS_D3D9_EXPORT D3D9GpuProgram : public GpuProgram, public D3D9Resource
+    class BS_D3D9_EXPORT D3D9GpuProgramCore : public GpuProgramCore, public D3D9Resource
     {   
     public:
-        virtual ~D3D9GpuProgram();
-
-		/**
-		 * @copydoc	GpuProgram::requiresMatrixTranspose
-		 */
-		virtual bool requiresMatrixTranspose() const { return mColumnMajorMatrices; }
+		virtual ~D3D9GpuProgramCore();
 
 		/**
 		 * @brief	Sets the preprocessor defines use to compile the program.
 		 */
 		void setPreprocessorDefines(const String& defines) { mPreprocessorDefines = defines; }
 
-		/**
-		 * @brief	Sets whether matrix packing in column-major order.
-		 */
-        void setColumnMajorMatrices(bool columnMajor) { mColumnMajorMatrices = columnMajor; }
-
 		/**
 		 * @brief	Sets optimization level to use when compiling the shader.
 		 */
 		void setOptimizationLevel(OptimizationLevel opt) { mOptimisationLevel = opt; }
 
 		/**
-		 * @copydoc	GpuProgram::createParameters
+		 * @copydoc	GpuProgramCore::createParameters
 		 */
 		GpuParamsPtr createParameters();
 
-		/**
-		 * @copydoc	GpuProgram::getLanguage
-		 */
-		const String& getLanguage() const;
-
     protected:
 		friend class D3D9HLSLProgramFactory;
 
-		D3D9GpuProgram(const String& source, const String& entryPoint, 
-			GpuProgramType gptype, GpuProgramProfile profile, 
-			const Vector<HGpuProgInclude>* includes);
+		D3D9GpuProgramCore(const String& source, const String& entryPoint,
+			GpuProgramType gptype, GpuProgramProfile profile);
 
 		/**
-		 * @copydoc GpuProgram::initialize_internal
+		 * @copydoc GpuProgramCore::initialize
 		 */
-		void initialize_internal();
+		void initialize();
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
       
 		/**
 		 * @brief	Loads the GPU program from compiled microcode.
@@ -86,23 +70,15 @@ namespace BansheeEngine
 		Vector<D3D9EmulatedParamBlock> mBlocks;
 		bool mColumnMajorMatrices;
 		ID3DXBuffer* mMicrocode;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D9GpuProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
     };
 
 	/**
 	 * @brief	DirectX 9 implementation of a vertex GPU program.
 	 */
-    class BS_D3D9_EXPORT D3D9GpuVertexProgram : public D3D9GpuProgram
+    class BS_D3D9_EXPORT D3D9GpuVertexProgramCore : public D3D9GpuProgramCore
     {  
     public:
-		~D3D9GpuVertexProgram();
+		~D3D9GpuVertexProgramCore();
         
 		/**
 		 * @brief	Returns internal DX9 vertex shader object.
@@ -122,36 +98,27 @@ namespace BansheeEngine
     protected:
 		friend class D3D9HLSLProgramFactory;
 
-		D3D9GpuVertexProgram(const String& source, const String& entryPoint, GpuProgramProfile profile,
-			const Vector<HGpuProgInclude>* includes);
+		D3D9GpuVertexProgramCore(const String& source, const String& entryPoint, GpuProgramProfile profile);
 
 		/**
-		 * @copydoc D3D9GpuProgram::destroy_internal.
+		 * @copydoc D3D9GpuProgramCore::destroy.
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D9GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D9GpuProgramCore::loadFromMicrocode
 		 */
         void loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode);
 
 	protected:
 		Map<IDirect3DDevice9*, IDirect3DVertexShader9*>	mMapDeviceToVertexShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D9GpuVertexProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
     };
 
     /** Direct3D implementation of low-level fragment programs. */
-    class BS_D3D9_EXPORT D3D9GpuFragmentProgram : public D3D9GpuProgram
+    class BS_D3D9_EXPORT D3D9GpuFragmentProgramCore : public D3D9GpuProgramCore
     {  
     public:
-		~D3D9GpuFragmentProgram();
+		~D3D9GpuFragmentProgramCore();
 
 		/**
 		 * @brief	Returns internal DX9 pixel shader object.
@@ -171,30 +138,19 @@ namespace BansheeEngine
     protected:
 		friend class D3D9HLSLProgramFactory;
 
-		D3D9GpuFragmentProgram(const String& source, const String& entryPoint, GpuProgramProfile profile,
-			const Vector<HGpuProgInclude>* includes);
+		D3D9GpuFragmentProgramCore(const String& source, const String& entryPoint, GpuProgramProfile profile);
 
 		/**
-		 * @copydoc D3D9GpuProgram::destroy_internal.
+		 * @copydoc D3D9GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 		/**
-		 * @copydoc	D3D9GpuProgram::loadFromMicrocode
+		 * @copydoc	D3D9GpuProgramCore::loadFromMicrocode
 		 */
         void loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode);
 
 	protected:
 		Map<IDirect3DDevice9*, IDirect3DPixelShader9*> mMapDeviceToPixelShader;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class D3D9GpuFragmentProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
     };
-
-	typedef std::shared_ptr<D3D9GpuProgram> D3D9GpuProgramPtr;
 }

+ 0 - 78
BansheeD3D9RenderSystem/Include/BsD3D9GpuProgramRTTI.h

@@ -1,78 +0,0 @@
-#pragma once
-
-#include "BsD3D9Prerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGpuProgramManager.h"
-#include "BsD3D9GpuProgram.h"
-
-namespace BansheeEngine
-{
-	class BS_D3D9_EXPORT D3D9GpuProgramRTTI : public RTTIType<D3D9GpuProgram, GpuProgram, D3D9GpuProgramRTTI>
-	{
-	public:
-		D3D9GpuProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D9GpuProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D9_GpuProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			BS_EXCEPT(InvalidStateException, "Cannot create an instance of an abstract class.");
-		}
-	};
-
-	class BS_D3D9_EXPORT D3D9GpuVertexProgramRTTI : public RTTIType<D3D9GpuVertexProgram, D3D9GpuProgram, D3D9GpuVertexProgramRTTI>
-	{
-	public:
-		D3D9GpuVertexProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D9GpuVertexProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D9_GpuVertexProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_VERTEX_PROGRAM);
-		}
-	};
-
-	class BS_D3D9_EXPORT D3D9GpuFragmentProgramRTTI : public RTTIType<D3D9GpuFragmentProgram, D3D9GpuProgram, D3D9GpuFragmentProgramRTTI>
-	{
-	public:
-		D3D9GpuFragmentProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "D3D9GpuFragmentProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_D3D9_GpuFragmentProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("hlsl", GPT_FRAGMENT_PROGRAM);
-		}
-	};
-}

+ 4 - 4
BansheeD3D9RenderSystem/Include/BsD3D9HLSLProgramFactory.h

@@ -21,15 +21,15 @@ namespace BansheeEngine
 
 		/**
 		 * @copydoc	GpuProgramFactory::getLanguage(const String&, const String&, GpuProgramType,
-		 *			GpuProgramProfile, const Vector<HGpuProgInclude>*, bool)
+		 *			GpuProgramProfile, bool)
 		 */
-        GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency);
+        SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool requiresAdjacency);
 
 		/**
 		 * @copydoc	GpuProgramFactory::create(GpuProgramType)
 		 */
-		GpuProgramPtr create(GpuProgramType type);
+		SPtr<GpuProgramCore> create(GpuProgramType type);
 
 	protected:
 		static String LANGUAGE_NAME;

+ 1 - 11
BansheeD3D9RenderSystem/Include/BsD3D9Prerequisites.h

@@ -43,22 +43,12 @@ namespace BansheeEngine
     class D3D9HardwareBufferManager;
     class D3D9IndexBuffer;
     class D3D9HLSLProgramFactory;
-    class D3D9HLSLProgram;
+    class D3D9HLSLProgramCore;
     class D3D9VertexDeclaration;
 	class D3D9Resource;
 
 	typedef std::shared_ptr<D3D9RenderWindow> D3D9RenderWindowPtr;
 
-	/**
-	 * @brief	Type IDs used for RTTI.
-	 */
-	enum TypeID_D3D9
-	{
-		TID_D3D9_GpuProgram = 10000,
-		TID_D3D9_GpuVertexProgram = 10001,
-		TID_D3D9_GpuFragmentProgram = 10002
-	};
-
 	/**
 	 * @brief	DirectX 9 specific types to track resource statistics for.
 	 */

+ 1 - 1
BansheeD3D9RenderSystem/Include/BsD3D9RenderSystem.h

@@ -38,7 +38,7 @@ namespace BansheeEngine
 		/**
 		 * @copydoc RenderSystem::bindGpuProgram()
 		 */
-		void bindGpuProgram(HGpuProgram prg);
+		void bindGpuProgram(const SPtr<GpuProgramCore>& prg);
 
 		/**
 		 * @copydoc RenderSystem::unbindGpuProgram()

+ 33 - 80
BansheeD3D9RenderSystem/Source/BsD3D9GpuProgram.cpp

@@ -8,28 +8,27 @@
 #include "BsAsyncOp.h"
 #include "BsGpuProgramManager.h"
 #include "BsD3D9HLSLParamParser.h"
-#include "BsD3D9GpuProgramRTTI.h"
 #include "BsRenderStats.h"
 
 namespace BansheeEngine 
 {
-    D3D9GpuProgram::D3D9GpuProgram(const String& source, const String& entryPoint, 
-		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: GpuProgram(source, entryPoint, gptype, profile, includes, false),
+    D3D9GpuProgramCore::D3D9GpuProgramCore(const String& source, const String& entryPoint, 
+		GpuProgramType gptype, GpuProgramProfile profile)
+		: GpuProgramCore(source, entryPoint, gptype, profile, false),
 		mMicrocode(nullptr), mColumnMajorMatrices(false), mOptimisationLevel(OPT_DEFAULT)
     { }
 
-	D3D9GpuProgram::~D3D9GpuProgram()
+	D3D9GpuProgramCore::~D3D9GpuProgramCore()
 	{ }
 
-	void D3D9GpuProgram::initialize_internal()
+	void D3D9GpuProgramCore::initialize()
 	{
 		if (!isSupported())
 		{
 			mIsCompiled = false;
 			mCompileError = "Specified program is not supported by the current render system.";
 
-			GpuProgram::initialize_internal();
+			GpuProgramCore::initialize();
 			return;
 		}
 
@@ -146,9 +145,9 @@ namespace BansheeEngine
 		// include handler
 		LPD3DXCONSTANTTABLE constTable;
 
-		String hlslProfile = D3D9RenderSystem::instance().getCapabilities()->gpuProgProfileToRSSpecificProfile(mProfile);
+		String hlslProfile = D3D9RenderSystem::instance().getCapabilities()->gpuProgProfileToRSSpecificProfile(getProperties().getProfile());
 
-		String parsedSource = D3D9EmulatedParamBlockParser::parse(mSource, mBlocks);
+		String parsedSource = D3D9EmulatedParamBlockParser::parse(getProperties().getSource(), mBlocks);
 
 		// Compile & assemble into microcode
 		HRESULT hr = D3DXCompileShader(
@@ -156,7 +155,7 @@ namespace BansheeEngine
 			static_cast<UINT>(parsedSource.length()),
 			pDefines,
 			nullptr,
-			mEntryPoint.c_str(),
+			getProperties().getEntryPoint().c_str(),
 			hlslProfile.c_str(),
 			compileFlags,
 			&mMicrocode,
@@ -197,56 +196,36 @@ namespace BansheeEngine
 		}
 
 		BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_GpuProgram);
-		GpuProgram::initialize_internal();
+		GpuProgramCore::initialize();
 	}
 
-	void D3D9GpuProgram::destroy_internal()
+	void D3D9GpuProgramCore::destroy()
 	{
 		SAFE_RELEASE(mMicrocode);
 
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuProgram);
-		GpuProgram::destroy_internal();
+		GpuProgramCore::destroy();
 	}
 
-	GpuParamsPtr D3D9GpuProgram::createParameters()
+	GpuParamsPtr D3D9GpuProgramCore::createParameters()
 	{
 		GpuParamsPtr params = bs_shared_ptr<GpuParams, PoolAlloc>(std::ref(mParametersDesc), mColumnMajorMatrices);
 
 		return params;
 	}
 
-	const String& D3D9GpuProgram::getLanguage() const
-	{
-		static const String language = "hlsl";
-
-		return language;
-	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D9GpuProgram::getRTTIStatic()
-	{
-		return D3D9GpuProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D9GpuProgram::getRTTI() const
-	{
-		return D3D9GpuProgram::getRTTIStatic();
-	}
-
-	D3D9GpuVertexProgram::D3D9GpuVertexProgram(const String& source, const String& entryPoint, 
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D9GpuProgram(source, entryPoint, GPT_VERTEX_PROGRAM, profile, includes)
+	D3D9GpuVertexProgramCore::D3D9GpuVertexProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D9GpuProgramCore(source, entryPoint, GPT_VERTEX_PROGRAM, profile)
     {
 
     }
 
-	D3D9GpuVertexProgram::~D3D9GpuVertexProgram()
+	D3D9GpuVertexProgramCore::~D3D9GpuVertexProgramCore()
 	{	
 	}
 
-	void D3D9GpuVertexProgram::destroy_internal(void)
+	void D3D9GpuVertexProgramCore::destroy()
 	{
 		auto it = mMapDeviceToVertexShader.begin();
 
@@ -257,10 +236,10 @@ namespace BansheeEngine
 		}
 		mMapDeviceToVertexShader.clear();	
 
-		D3D9GpuProgram::destroy_internal();
+		D3D9GpuProgramCore::destroy();
 	}
 
-    void D3D9GpuVertexProgram::loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode)
+    void D3D9GpuVertexProgramCore::loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode)
     {		 
 		auto it = mMapDeviceToVertexShader.find(d3d9Device);
 
@@ -283,12 +262,12 @@ namespace BansheeEngine
 		mMapDeviceToVertexShader[d3d9Device] = pVertexShader;
     }
 
-	void D3D9GpuVertexProgram::notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device)
+	void D3D9GpuVertexProgramCore::notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device)
 	{
 		
 	}
 
-	void D3D9GpuVertexProgram::notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device)
+	void D3D9GpuVertexProgramCore::notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device)
 	{
 		auto it = mMapDeviceToVertexShader.find(d3d9Device);
 
@@ -300,7 +279,7 @@ namespace BansheeEngine
 		}
 	}
 
-	IDirect3DVertexShader9* D3D9GpuVertexProgram::getVertexShader()
+	IDirect3DVertexShader9* D3D9GpuVertexProgramCore::getVertexShader()
 	{
 		if (!isCompiled())
 			return nullptr;
@@ -318,31 +297,18 @@ namespace BansheeEngine
 		return it->second;
 	}
 
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D9GpuVertexProgram::getRTTIStatic()
-	{
-		return D3D9GpuVertexProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D9GpuVertexProgram::getRTTI() const
-	{
-		return D3D9GpuVertexProgram::getRTTIStatic();
-	}
-
-    D3D9GpuFragmentProgram::D3D9GpuFragmentProgram(const String& source, const String& entryPoint, 
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes)
-		: D3D9GpuProgram(source, entryPoint, GPT_FRAGMENT_PROGRAM, profile, includes)
+	D3D9GpuFragmentProgramCore::D3D9GpuFragmentProgramCore(const String& source, const String& entryPoint,
+		GpuProgramProfile profile)
+		: D3D9GpuProgramCore(source, entryPoint, GPT_FRAGMENT_PROGRAM, profile)
     {
 
     }
 
-	D3D9GpuFragmentProgram::~D3D9GpuFragmentProgram()
+	D3D9GpuFragmentProgramCore::~D3D9GpuFragmentProgramCore()
 	{
 	}
 
-	void D3D9GpuFragmentProgram::destroy_internal()
+	void D3D9GpuFragmentProgramCore::destroy()
 	{
 		auto it = mMapDeviceToPixelShader.begin();
 
@@ -353,10 +319,10 @@ namespace BansheeEngine
 		}
 		mMapDeviceToPixelShader.clear();	
 
-		D3D9GpuProgram::destroy_internal();
+		D3D9GpuProgramCore::destroy();
 	}
 
-    void D3D9GpuFragmentProgram::loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode)
+	void D3D9GpuFragmentProgramCore::loadFromMicrocode(IDirect3DDevice9* d3d9Device, ID3DXBuffer* microcode)
     {
 		auto it = mMapDeviceToPixelShader.find(d3d9Device);
 
@@ -375,12 +341,12 @@ namespace BansheeEngine
 		mMapDeviceToPixelShader[d3d9Device] = pPixelShader;
     }
 
-	void D3D9GpuFragmentProgram::notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device)
+	void D3D9GpuFragmentProgramCore::notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device)
 	{
 		
 	}
 
-	void D3D9GpuFragmentProgram::notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device)
+	void D3D9GpuFragmentProgramCore::notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device)
 	{
 		auto it = mMapDeviceToPixelShader.find(d3d9Device);
 
@@ -392,7 +358,7 @@ namespace BansheeEngine
 		}
 	}
 
-	IDirect3DPixelShader9* D3D9GpuFragmentProgram::getPixelShader()
+	IDirect3DPixelShader9* D3D9GpuFragmentProgramCore::getPixelShader()
 	{
 		if (!isCompiled())
 			return nullptr;
@@ -409,18 +375,5 @@ namespace BansheeEngine
 
 		return it->second;
 	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* D3D9GpuFragmentProgram::getRTTIStatic()
-	{
-		return D3D9GpuFragmentProgramRTTI::instance();
-	}
-
-	RTTITypeBase* D3D9GpuFragmentProgram::getRTTI() const
-	{
-		return D3D9GpuFragmentProgram::getRTTIStatic();
-	}
 }
 

+ 15 - 15
BansheeD3D9RenderSystem/Source/BsD3D9HLSLProgramFactory.cpp

@@ -18,42 +18,42 @@ namespace BansheeEngine
         return LANGUAGE_NAME;
     }
 
-	GpuProgramPtr D3D9HLSLProgramFactory::create(const String& source, const String& entryPoint, 
-		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency)
+	SPtr<GpuProgramCore> D3D9HLSLProgramFactory::create(const String& source, const String& entryPoint,
+		GpuProgramType gptype, GpuProgramProfile profile, bool requiresAdjacency)
     {
 		if (gptype == GPT_VERTEX_PROGRAM)
 		{
-			D3D9GpuVertexProgram* prog = new (bs_alloc<D3D9GpuVertexProgram, PoolAlloc>()) 
-				D3D9GpuVertexProgram(source, entryPoint, profile, includes);
+			D3D9GpuVertexProgramCore* prog = new (bs_alloc<D3D9GpuVertexProgramCore, GenAlloc>())
+				D3D9GpuVertexProgramCore(source, entryPoint, profile);
 
-			return bs_core_ptr<D3D9GpuVertexProgram, PoolAlloc>(prog);
+			return bs_shared_ptr<D3D9GpuVertexProgramCore, GenAlloc>(prog);
 		}
 		else if (gptype == GPT_FRAGMENT_PROGRAM)
 		{
-			D3D9GpuFragmentProgram* prog = new (bs_alloc<D3D9GpuFragmentProgram, PoolAlloc>())
-				D3D9GpuFragmentProgram(source, entryPoint, profile, includes);
+			D3D9GpuFragmentProgramCore* prog = new (bs_alloc<D3D9GpuFragmentProgramCore, GenAlloc>())
+				D3D9GpuFragmentProgramCore(source, entryPoint, profile);
 
-			return bs_core_ptr<D3D9GpuFragmentProgram, PoolAlloc>(prog);
+			return bs_shared_ptr<D3D9GpuFragmentProgramCore, GenAlloc>(prog);
 		}
 
 		return nullptr;
     }
 
-	GpuProgramPtr D3D9HLSLProgramFactory::create(GpuProgramType type)
+	SPtr<GpuProgramCore> D3D9HLSLProgramFactory::create(GpuProgramType type)
 	{
 		if (type == GPT_VERTEX_PROGRAM)
 		{
-			D3D9GpuVertexProgram* prog = new (bs_alloc<D3D9GpuVertexProgram, PoolAlloc>())
-				D3D9GpuVertexProgram("", "", GPP_NONE, nullptr);
+			D3D9GpuVertexProgramCore* prog = new (bs_alloc<D3D9GpuVertexProgramCore, GenAlloc>())
+				D3D9GpuVertexProgramCore("", "", GPP_NONE);
 
-			return bs_core_ptr<D3D9GpuVertexProgram, PoolAlloc>(prog);
+			return bs_shared_ptr<D3D9GpuVertexProgramCore, GenAlloc>(prog);
 		}
 		else if (type == GPT_FRAGMENT_PROGRAM)
 		{
-			D3D9GpuFragmentProgram* prog = new (bs_alloc<D3D9GpuFragmentProgram, PoolAlloc>())
-				D3D9GpuFragmentProgram("", "", GPP_NONE, nullptr);
+			D3D9GpuFragmentProgramCore* prog = new (bs_alloc<D3D9GpuFragmentProgramCore, GenAlloc>())
+				D3D9GpuFragmentProgramCore("", "", GPP_NONE);
 
-			return bs_core_ptr<D3D9GpuFragmentProgram, PoolAlloc>(prog);
+			return bs_shared_ptr<D3D9GpuFragmentProgramCore, GenAlloc>(prog);
 		}
 
 		return nullptr;

+ 6 - 11
BansheeD3D9RenderSystem/Source/BsD3D9RenderSystem.cpp

@@ -162,7 +162,7 @@ namespace BansheeEngine
 		// Deleting the HLSL program factory
 		if (mHLSLProgramFactory)
 		{
-			GpuProgramManager::instance().removeFactory(mHLSLProgramFactory);
+			GpuProgramCoreManager::instance().removeFactory(mHLSLProgramFactory);
 			bs_delete(mHLSLProgramFactory);
 			mHLSLProgramFactory = 0;
 		}
@@ -204,21 +204,16 @@ namespace BansheeEngine
 		mResourceManager->unlockDeviceAccess();
 	}	
 
-	void D3D9RenderSystem::bindGpuProgram(HGpuProgram prg)
+	void D3D9RenderSystem::bindGpuProgram(const SPtr<GpuProgramCore>& prg)
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
-		if(!prg.isLoaded())
-			return;
-
-		GpuProgramPtr bindingPrg = std::static_pointer_cast<GpuProgram>(prg->getThisPtr());
-
 		HRESULT hr;
-		switch (bindingPrg->getType())
+		switch (prg->getProperties().getType())
 		{
 		case GPT_VERTEX_PROGRAM:
 			hr = getActiveD3D9Device()->SetVertexShader(
-				static_cast<D3D9GpuVertexProgram*>(bindingPrg.get())->getVertexShader());
+				static_cast<D3D9GpuVertexProgramCore*>(prg.get())->getVertexShader());
 			if (FAILED(hr))
 			{
 				BS_EXCEPT(RenderingAPIException, "Error calling SetVertexShader");
@@ -226,7 +221,7 @@ namespace BansheeEngine
 			break;
 		case GPT_FRAGMENT_PROGRAM:
 			hr = getActiveD3D9Device()->SetPixelShader(
-				static_cast<D3D9GpuFragmentProgram*>(bindingPrg.get())->getPixelShader());
+				static_cast<D3D9GpuFragmentProgramCore*>(prg.get())->getPixelShader());
 			if (FAILED(hr))
 			{
 				BS_EXCEPT(RenderingAPIException, "Error calling SetPixelShader");
@@ -1797,7 +1792,7 @@ namespace BansheeEngine
 			mCurrentCapabilities->addShaderProfile("cg");
 
 			if (mCurrentCapabilities->isShaderProfileSupported("hlsl"))
-				GpuProgramManager::instance().addFactory(mHLSLProgramFactory);
+				GpuProgramCoreManager::instance().addFactory(mHLSLProgramFactory);
 
 			mNumTexStages = mCurrentCapabilities->getNumCombinedTextureUnits();
 			mTexStageDesc = bs_newN<sD3DTextureStageDesc>(mNumTexStages);

+ 6 - 0
BansheeEditor/BansheeEditor.vcxproj

@@ -134,6 +134,7 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;BS_ED_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -152,6 +153,7 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;BS_ED_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -175,6 +177,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>NotSet</SubSystem>
@@ -199,6 +202,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -223,6 +227,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -247,6 +252,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

+ 6 - 0
BansheeEditorExec/BansheeEditorExec.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeEditor\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>
       </PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -141,6 +142,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeEditor\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>
       </PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -160,6 +162,7 @@
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>
       </PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -181,6 +184,7 @@
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>
       </PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -202,6 +206,7 @@
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <PreprocessorDefinitions>
       </PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -223,6 +228,7 @@
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <PreprocessorDefinitions>
       </PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

@@ -11,7 +11,7 @@ int CALLBACK WinMain(
 	_In_  int nCmdShow
 	)
 {
-	EditorApplication::startUp(RenderSystemPlugin::DX9);
+	EditorApplication::startUp(RenderSystemPlugin::OpenGL);
 	EditorApplication::instance().runMainLoop();
 	EditorApplication::shutDown();
 

+ 6 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -123,6 +123,7 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -137,6 +138,7 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -155,6 +157,7 @@
       <PreprocessorDefinitions>BS_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -175,6 +178,7 @@
       <PreprocessorDefinitions>BS_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -195,6 +199,7 @@
       <PreprocessorDefinitions>BS_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -215,6 +220,7 @@
       <PreprocessorDefinitions>BS_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
BansheeFBXImporter/BansheeFBXImporter.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;../Dependencies/Include;./Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_FBX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +141,7 @@
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;../Dependencies/Include;./Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_FBX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -159,6 +161,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -180,6 +183,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -201,6 +205,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -222,6 +227,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
BansheeFontImporter/BansheeFontImporter.vcxproj

@@ -124,6 +124,7 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;../Dependencies/Include;./Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_FONT_EXPORTS;_WINDLL;USE_FREETYPE2_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -138,6 +139,7 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;../Dependencies/Include;./Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_FONT_EXPORTS;_WINDLL;USE_FREETYPE2_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -157,6 +159,7 @@
       <PreprocessorDefinitions>BS_FONT_EXPORTS;_WINDLL;USE_FREETYPE2_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -177,6 +180,7 @@
       <PreprocessorDefinitions>BS_FONT_EXPORTS;_WINDLL;USE_FREETYPE2_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -197,6 +201,7 @@
       <PreprocessorDefinitions>BS_FONT_EXPORTS;_WINDLL;USE_FREETYPE2_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -217,6 +222,7 @@
       <PreprocessorDefinitions>BS_FONT_EXPORTS;_WINDLL;USE_FREETYPE2_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
BansheeFreeImgImporter/BansheeFreeImgImporter.vcxproj

@@ -133,6 +133,7 @@
       <PreprocessorDefinitions>BS_FREEIMG_EXPORTS;_MBCS;FREEIMAGE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;./Dependencies/Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -148,6 +149,7 @@
       <PreprocessorDefinitions>BS_FREEIMG_EXPORTS;_MBCS;FREEIMAGE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;./Dependencies/Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -167,6 +169,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -188,6 +191,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -209,6 +213,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -230,6 +235,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 1
BansheeGLRenderSystem/BansheeGLRenderSystem.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>./Source/win32;./Source/GLSL/include;./Source/atifs/include;../BansheeUtility/Include;../BansheeCore/Include;./Include;../Dependencies/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_WINDLL;GLEW_STATIC;BS_RSGL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +141,7 @@
       <AdditionalIncludeDirectories>./Source/win32;./Source/GLSL/include;./Source/atifs/include;../BansheeUtility/Include;../BansheeCore/Include;./Include;../Dependencies/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_WINDLL;GLEW_STATIC;BS_RSGL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -160,6 +162,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -181,6 +184,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -202,6 +206,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -223,6 +228,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -254,7 +260,6 @@
     <ClInclude Include="Include\BsGLRenderSystemFactory.h" />
     <ClInclude Include="Include\BsGLRenderTexture.h" />
     <ClInclude Include="Include\BsGLRenderWindowManager.h" />
-    <ClInclude Include="Include\BsGLSLGpuProgramRTTI.h" />
     <ClInclude Include="Include\BsGLSupport.h" />
     <ClInclude Include="Include\BsGLTexture.h" />
     <ClInclude Include="Include\BsGLTextureManager.h" />

+ 0 - 6
BansheeGLRenderSystem/BansheeGLRenderSystem.vcxproj.filters

@@ -13,9 +13,6 @@
       <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>
     </Filter>
-    <Filter Include="Header Files\RTTI">
-      <UniqueIdentifier>{f65cdae4-61c9-4f4f-a4af-9fc39a49704d}</UniqueIdentifier>
-    </Filter>
     <Filter Include="Header Files\GLSL">
       <UniqueIdentifier>{4a04e68e-bddd-41da-a32c-b50d628cd689}</UniqueIdentifier>
     </Filter>
@@ -114,9 +111,6 @@
     <ClInclude Include="Include\BsWin32Context.h">
       <Filter>Header Files\Win32</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsGLSLGpuProgramRTTI.h">
-      <Filter>Header Files\RTTI</Filter>
-    </ClInclude>
     <ClInclude Include="Source\GLSL\include\BsGLSLProgramPipelineManager.h">
       <Filter>Header Files\GLSL</Filter>
     </ClInclude>

+ 1 - 11
BansheeGLRenderSystem/Include/BsGLPrerequisites.h

@@ -12,27 +12,17 @@ namespace BansheeEngine
 	class GLVertexBuffer;
 	class GLVertexBufferCore;
     class GLTextureManager;
-    class GLSLGpuProgram;
     class GLContext;
     class GLRTTManager;
     class GLPixelBuffer;
 	class GLGpuParamBlock;
-	class GLSLGpuProgram;
+	class GLSLGpuProgramCore;
 	class GLVertexArrayObject;
 	struct GLSLProgramPipeline;
 	class GLSLProgramPipelineManager;
 
 	typedef std::shared_ptr<GLPixelBuffer> GLPixelBufferPtr;
 	typedef std::shared_ptr<GLGpuParamBlock> GLGpuParamBlockPtr;
-	typedef std::shared_ptr<GLSLGpuProgram> GLSLGpuProgramPtr;
-
-	/**
-	 * @brief	Type IDs used for RTTI.
-	 */
-	enum TypeID_D3D9
-	{
-		TID_GL_GLSLGpuProgram = 11000
-	};
 
 	/**
 	 * @brief	OpenGL specific types to track resource statistics for.

+ 8 - 8
BansheeGLRenderSystem/Include/BsGLRenderSystem.h

@@ -97,7 +97,7 @@ namespace BansheeEngine
 		/**
 		 * @copydoc RenderSystem::bindGpuProgram()
 		 */
-		void bindGpuProgram(HGpuProgram prg);
+		void bindGpuProgram(const SPtr<GpuProgramCore>& prg);
 
 		/**
 		 * @copydoc RenderSystem::unbindGpuProgram()
@@ -248,12 +248,12 @@ namespace BansheeEngine
 		/**
 		 * @brief	Changes the active GPU program.
 		 */
-		void setActiveProgram(GpuProgramType gptype, GLSLGpuProgramPtr program);
+		void setActiveProgram(GpuProgramType gptype, const SPtr<GLSLGpuProgramCore>& program);
 
 		/**
 		 * @brief	Retrieves the active GPU program of the specified type.
 		 */
-		GLSLGpuProgramPtr getActiveProgram(GpuProgramType gptype) const;
+		SPtr<GLSLGpuProgramCore> getActiveProgram(GpuProgramType gptype) const;
 
 		/**
 		 * @brief	Converts Banshee blend mode to OpenGL blend mode.
@@ -561,11 +561,11 @@ namespace BansheeEngine
 		GLSLProgramFactory* mGLSLProgramFactory;
 		GLSLProgramPipelineManager* mProgramPipelineManager;
 
-		GLSLGpuProgramPtr mCurrentVertexProgram;
-		GLSLGpuProgramPtr mCurrentFragmentProgram;
-		GLSLGpuProgramPtr mCurrentGeometryProgram;
-		GLSLGpuProgramPtr mCurrentHullProgram;
-		GLSLGpuProgramPtr mCurrentDomainProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentVertexProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentFragmentProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentGeometryProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentHullProgram;
+		SPtr<GLSLGpuProgramCore> mCurrentDomainProgram;
 
 		const GLSLProgramPipeline* mActivePipeline;
 

+ 0 - 32
BansheeGLRenderSystem/Include/BsGLSLGpuProgramRTTI.h

@@ -1,32 +0,0 @@
-#pragma once
-
-#include "BsGLPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGpuProgramManager.h"
-#include "BsGLSLGpuProgram.h"
-
-namespace BansheeEngine
-{
-	class BS_RSGL_EXPORT GLSLGpuProgramRTTI : public RTTIType<GLSLGpuProgram, GpuProgram, GLSLGpuProgramRTTI>
-	{
-	public:
-		GLSLGpuProgramRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "GLSLGpuProgram";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_GL_GLSLGpuProgram;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return GpuProgramManager::instance().createEmpty("glsl", GPT_VERTEX_PROGRAM);
-		}
-	};
-}

+ 1 - 1
BansheeGLRenderSystem/Include/BsGLVertexArrayObjectManager.h

@@ -66,7 +66,7 @@ namespace BansheeEngine
 		 *
 		 *			Lifetime of returned VAO is managed by the vertex buffers that it binds.
 		 */
-		const GLVertexArrayObject& getVAO(const GLSLGpuProgramPtr& vertexProgram, 
+		const GLVertexArrayObject& getVAO(const SPtr<GLSLGpuProgramCore>& vertexProgram,
 			const VertexDeclarationPtr& vertexDecl, const Vector<SPtr<VertexBufferCore>>& boundBuffers);
 
 		/**

+ 8 - 9
BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp

@@ -166,7 +166,7 @@ namespace BansheeEngine
 		if (mGLSLProgramFactory)
 		{
 			// Remove from manager safely
-			GpuProgramManager::instance().removeFactory(mGLSLProgramFactory);
+			GpuProgramCoreManager::instance().removeFactory(mGLSLProgramFactory);
 			bs_delete(mGLSLProgramFactory);
 			mGLSLProgramFactory = nullptr;
 		}
@@ -209,18 +209,17 @@ namespace BansheeEngine
 			bs_deleteN(mTextureTypes, mNumTextureTypes);
 	}
 
-	void GLRenderSystem::bindGpuProgram(HGpuProgram prg)
+	void GLRenderSystem::bindGpuProgram(const SPtr<GpuProgramCore>& prg)
 	{
 		THROW_IF_NOT_CORE_THREAD;
 
-		GLSLGpuProgramPtr glprg = std::static_pointer_cast<GLSLGpuProgram>(prg->getThisPtr());
+		SPtr<GLSLGpuProgramCore> glprg = std::static_pointer_cast<GLSLGpuProgramCore>(prg);
 
-		switch (glprg->getType())
+		switch (glprg->getProperties().getType())
 		{
 		case GPT_VERTEX_PROGRAM:
 			mCurrentVertexProgram = glprg;
 			break;
-
 		case GPT_FRAGMENT_PROGRAM:
 			mCurrentFragmentProgram = glprg;
 			break;
@@ -253,7 +252,7 @@ namespace BansheeEngine
 
 		bindableParams->updateHardwareBuffers();
 		const GpuParamDesc& paramDesc = bindableParams->getParamDesc();
-		GLSLGpuProgramPtr activeProgram = getActiveProgram(gptype);
+		SPtr<GLSLGpuProgramCore> activeProgram = getActiveProgram(gptype);
 		GLuint glProgram = activeProgram->getGLHandle();
 
 		for(auto iter = paramDesc.textures.begin(); iter != paramDesc.textures.end(); ++iter)
@@ -1640,7 +1639,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void GLRenderSystem::setActiveProgram(GpuProgramType gptype, GLSLGpuProgramPtr program)
+	void GLRenderSystem::setActiveProgram(GpuProgramType gptype, const SPtr<GLSLGpuProgramCore>& program)
 	{
 		switch (gptype)
 		{
@@ -1662,7 +1661,7 @@ namespace BansheeEngine
 		}
 	}
 
-	GLSLGpuProgramPtr GLRenderSystem::getActiveProgram(GpuProgramType gptype) const
+	SPtr<GLSLGpuProgramCore> GLRenderSystem::getActiveProgram(GpuProgramType gptype) const
 	{
 		switch (gptype)
 		{
@@ -1709,7 +1708,7 @@ namespace BansheeEngine
 		if(caps->isShaderProfileSupported("glsl"))
 		{
 			mGLSLProgramFactory = bs_new<GLSLProgramFactory>();
-			GpuProgramManager::instance().addFactory(mGLSLProgramFactory);
+			GpuProgramCoreManager::instance().addFactory(mGLSLProgramFactory);
 		}
 
 		// Check for framebuffer object extension

+ 2 - 2
BansheeGLRenderSystem/Source/BsGLVertexArrayObjectManager.cpp

@@ -74,7 +74,7 @@ namespace BansheeEngine
 		assert(mVAObjects.size() == 0 && "VertexArrayObjectManager getting shut down but not all VA objects were released.");
 	}
 
-	const GLVertexArrayObject& GLVertexArrayObjectManager::getVAO(const GLSLGpuProgramPtr& vertexProgram,
+	const GLVertexArrayObject& GLVertexArrayObjectManager::getVAO(const SPtr<GLSLGpuProgramCore>& vertexProgram,
 		const VertexDeclarationPtr& vertexDecl, const Vector<SPtr<VertexBufferCore>>& boundBuffers)
 	{
 		UINT16 maxStreamIdx = 0;
@@ -112,7 +112,7 @@ namespace BansheeEngine
 			numUsedBuffers++;
 		}
 		
-		GLVertexArrayObject wantedVAO(0, vertexProgram->getInternalID(), usedBuffers, numUsedBuffers);
+		GLVertexArrayObject wantedVAO(0, vertexProgram->getGLHandle(), usedBuffers, numUsedBuffers);
 
 		auto findIter = mVAObjects.find(wantedVAO);
 		if (findIter != mVAObjects.end())

+ 10 - 23
BansheeGLRenderSystem/Source/GLSL/include/BsGLSLGpuProgram.h

@@ -8,21 +8,16 @@ namespace BansheeEngine
 	/**
 	 * @brief	GPU program compiled from GLSL and usable by OpenGL.
 	 */
-    class BS_RSGL_EXPORT GLSLGpuProgram : public GpuProgram
+    class BS_RSGL_EXPORT GLSLGpuProgramCore : public GpuProgramCore
     {
 	public:
-		~GLSLGpuProgram();
+		~GLSLGpuProgramCore();
 
 		/**
-		 * @copydoc	GpuProgram::isSupported
+		 * @copydoc	GpuProgramCore::isSupported
 		 */
 		bool isSupported() const;
 
-		/**
-		 * @copydoc	GpuProgram::getLanguage
-		 */
-		const String& getLanguage() const;
-
 		/**
 		 * @brief	Gets vertex declaration that determines which input attributes does the GPU
 		 *			program expect (and which attributes will it retrieve from the bound vertex buffer). 
@@ -42,25 +37,25 @@ namespace BansheeEngine
 		const UINT32 getProgramID() const { return mProgramID; }
 
 		/**
-		 * @copydoc	GpuProgram::createParameters
+		 * @copydoc	GpuProgramCore::createParameters
 		 */
 		GpuParamsPtr createParameters();
 
 	private:
 		friend class GLSLProgramFactory;
 
-		GLSLGpuProgram(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired);
+		GLSLGpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool isAdjacencyInfoRequired);
 
 		/**
-		 * @copydoc GpuProgram::initialize_internal()
+		 * @copydoc GpuProgramCore::initialize
 		 */
-		void initialize_internal();
+		void initialize();
 
 		/**
-		 * @copydoc GpuProgram::destroy_internal()
+		 * @copydoc GpuProgramCore::destroy
 		 */
-		void destroy_internal();
+		void destroy();
 
 	private:
 		UINT32 mProgramID;
@@ -73,13 +68,5 @@ namespace BansheeEngine
 		static UINT32 mGeometryShaderCount;
 		static UINT32 mHullShaderCount;
 		static UINT32 mDomainShaderCount;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class GLSLGpuProgramRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
     };
 }

+ 4 - 4
BansheeGLRenderSystem/Source/GLSL/include/BsGLSLProgramFactory.h

@@ -18,15 +18,15 @@ namespace BansheeEngine
 
 		/**
 		 * @copydoc	GpuProgramFactory::getLanguage(const String&, const String&, GpuProgramType,
-		 *			GpuProgramProfile, const Vector<HGpuProgInclude>*, bool)
+		 *			GpuProgramProfile, bool)
 		 */
-        GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, 
-			GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requireAdjacency);
+        SPtr<GpuProgramCore> create(const String& source, const String& entryPoint, GpuProgramType gptype, 
+			GpuProgramProfile profile, bool requireAdjacency);
 
 		/**
 		 * @copydoc	GpuProgramFactory::create(GpuProgramType)
 		 */
-		GpuProgramPtr create(GpuProgramType type);
+		SPtr<GpuProgramCore> create(GpuProgramType type);
 
 	protected:
 		static const String LANGUAGE_NAME;

+ 2 - 2
BansheeGLRenderSystem/Source/GLSL/include/BsGLSLProgramPipelineManager.h

@@ -29,8 +29,8 @@ namespace BansheeEngine
 		 * @brief	Creates or returns an existing pipeline that uses the provided combination of GPU programs. Provide
 		 *			null for unused programs.
 		 */
-		const GLSLProgramPipeline* getPipeline(GLSLGpuProgram* vertexProgram, GLSLGpuProgram* fragmentProgram, 
-			GLSLGpuProgram* geometryProgram, GLSLGpuProgram* hullProgram, GLSLGpuProgram* domainProgram);
+		const GLSLProgramPipeline* getPipeline(GLSLGpuProgramCore* vertexProgram, GLSLGpuProgramCore* fragmentProgram,
+			GLSLGpuProgramCore* geometryProgram, GLSLGpuProgramCore* hullProgram, GLSLGpuProgramCore* domainProgram);
 
 	private:
 		/**

+ 28 - 48
BansheeGLRenderSystem/Source/GLSL/src/BsGLSLGpuProgram.cpp

@@ -5,17 +5,16 @@
 #include "BsException.h"
 #include "BsGLSLParamParser.h"
 #include "BsHardwareBufferManager.h"
-#include "BsGLSLGpuProgramRTTI.h"
 #include "BsRenderStats.h"
 #include "BsGpuParams.h"
 
 namespace BansheeEngine 
 {
-	UINT32 GLSLGpuProgram::mVertexShaderCount = 0;
-	UINT32 GLSLGpuProgram::mFragmentShaderCount = 0;
-	UINT32 GLSLGpuProgram::mGeometryShaderCount = 0;
-	UINT32 GLSLGpuProgram::mDomainShaderCount = 0;
-	UINT32 GLSLGpuProgram::mHullShaderCount = 0;
+	UINT32 GLSLGpuProgramCore::mVertexShaderCount = 0;
+	UINT32 GLSLGpuProgramCore::mFragmentShaderCount = 0;
+	UINT32 GLSLGpuProgramCore::mGeometryShaderCount = 0;
+	UINT32 GLSLGpuProgramCore::mDomainShaderCount = 0;
+	UINT32 GLSLGpuProgramCore::mHullShaderCount = 0;
 
 	bool checkForGLSLError(const GLuint programObj, String& outErrorMsg)
 	{
@@ -69,28 +68,28 @@ namespace BansheeEngine
 		return errorsFound || !linkCompileSuccess;
 	}
 	
-	GLSLGpuProgram::GLSLGpuProgram(const String& source, const String& entryPoint, GpuProgramType gptype, 
-		GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired)
-		:GpuProgram(source, entryPoint, gptype, profile, includes, isAdjacencyInfoRequired),
+	GLSLGpuProgramCore::GLSLGpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
+		GpuProgramProfile profile, bool isAdjacencyInfoRequired)
+		:GpuProgramCore(source, entryPoint, gptype, profile, isAdjacencyInfoRequired),
 		mProgramID(0), mGLHandle(0)
     { }
 
-    GLSLGpuProgram::~GLSLGpuProgram()
+	GLSLGpuProgramCore::~GLSLGpuProgramCore()
     { }
 
-	void GLSLGpuProgram::initialize_internal()
+	void GLSLGpuProgramCore::initialize()
 	{
 		if (!isSupported())
 		{
 			mIsCompiled = false;
 			mCompileError = "Specified program is not supported by the current render system.";
 
-			GpuProgram::initialize_internal();
+			GpuProgramCore::initialize();
 			return;
 		}
 
 		GLenum shaderType = 0x0000;
-		switch (mType)
+		switch (mProperties.getType())
 		{
 		case GPT_VERTEX_PROGRAM:
 			shaderType = GL_VERTEX_SHADER;
@@ -115,23 +114,24 @@ namespace BansheeEngine
 		}
 
 		// Add preprocessor extras and main source
-		if (!mSource.empty())
+		const String& source = mProperties.getSource();
+		if (!source.empty())
 		{
 			Vector<GLchar*> lines;
 
 			UINT32 lineLength = 0;
-			for (UINT32 i = 0; i < mSource.size(); i++)
+			for (UINT32 i = 0; i < source.size(); i++)
 			{
-				if (mSource[i] == '\n' || mSource[i] == '\r')
+				if (source[i] == '\n' || source[i] == '\r')
 				{
 					if (lineLength > 0)
 					{
-						assert(sizeof(mSource[i]) == sizeof(GLchar));
+						assert(sizeof(source[i]) == sizeof(GLchar));
 
-						bool isDefine = mSource[i - lineLength] == '#';
+						bool isDefine = source[i - lineLength] == '#';
 
 						GLchar* lineData = (GLchar*)stackAlloc(sizeof(GLchar) * (lineLength + 1 + (isDefine ? 1 : 0)));
-						memcpy(lineData, &mSource[i - lineLength], sizeof(GLchar) * lineLength);
+						memcpy(lineData, &source[i - lineLength], sizeof(GLchar) * lineLength);
 
 						if (isDefine) // Defines require a newline as well as a null terminator, otherwise it doesn't compile properly
 						{
@@ -153,11 +153,11 @@ namespace BansheeEngine
 
 			if (lineLength > 0)
 			{
-				UINT32 end = (UINT32)mSource.size() - 1;
-				assert(sizeof(mSource[end]) == sizeof(GLchar));
+				UINT32 end = (UINT32)source.size() - 1;
+				assert(sizeof(source[end]) == sizeof(GLchar));
 
 				GLchar* lineData = (GLchar*)stackAlloc(sizeof(GLchar) * (lineLength + 1));
-				memcpy(lineData, &mSource[mSource.size() - lineLength], sizeof(GLchar) * lineLength);
+				memcpy(lineData, &source[source.size() - lineLength], sizeof(GLchar) * lineLength);
 				lineData[lineLength] = '\0';
 
 				lines.push_back(lineData);
@@ -180,7 +180,7 @@ namespace BansheeEngine
 			GLSLParamParser paramParser;
 			paramParser.buildUniformDescriptions(mGLHandle, *mParametersDesc);
 
-			if (mType == GPT_VERTEX_PROGRAM)
+			if (mProperties.getType() == GPT_VERTEX_PROGRAM)
 			{
 				VertexDeclaration::VertexElementList elementList = paramParser.buildVertexDeclaration(mGLHandle);
 				mVertexDeclaration = HardwareBufferManager::instance().createVertexDeclaration(elementList);
@@ -192,10 +192,10 @@ namespace BansheeEngine
 		}
 
 		BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_GpuProgram);
-		GpuProgram::initialize_internal();
+		GpuProgramCore::initialize();
 	}
 
-	void GLSLGpuProgram::destroy_internal()
+	void GLSLGpuProgramCore::destroy()
 	{
 		if (mIsCompiled && mGLHandle != 0)
 		{
@@ -204,10 +204,10 @@ namespace BansheeEngine
 		}
 
 		BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuProgram);
-		GpuProgram::destroy_internal();
+		GpuProgramCore::destroy();
 	}
 
-	bool GLSLGpuProgram::isSupported() const
+	bool GLSLGpuProgramCore::isSupported() const
 	{
 		if (!isRequiredCapabilitiesSupported())
 			return false;
@@ -216,31 +216,11 @@ namespace BansheeEngine
 		return rs->getCapabilities()->isShaderProfileSupported("glsl");
 	}
 
-	const String& GLSLGpuProgram::getLanguage() const
-	{
-		static const String language = "glsl";
-
-		return language;
-	}
-
-	GpuParamsPtr GLSLGpuProgram::createParameters()
+	GpuParamsPtr GLSLGpuProgramCore::createParameters()
 	{
 		GpuParamsPtr params = bs_shared_ptr<GpuParams, PoolAlloc>(std::ref(mParametersDesc), true);
 
 		return params;
 	}
-
-	/************************************************************************/
-	/* 								SERIALIZATION                      		*/
-	/************************************************************************/
-	RTTITypeBase* GLSLGpuProgram::getRTTIStatic()
-	{
-		return GLSLGpuProgramRTTI::instance();
-	}
-
-	RTTITypeBase* GLSLGpuProgram::getRTTI() const
-	{
-		return GLSLGpuProgram::getRTTIStatic();
-	}
 }
 

+ 7 - 7
BansheeGLRenderSystem/Source/GLSL/src/BsGLSLProgramFactory.cpp

@@ -10,18 +10,18 @@ namespace BansheeEngine
         return LANGUAGE_NAME;
     }
 
-    GpuProgramPtr GLSLProgramFactory::create(const String& source, const String& entryPoint, 
-		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requireAdjacency)
+	SPtr<GpuProgramCore> GLSLProgramFactory::create(const String& source, const String& entryPoint,
+		GpuProgramType gptype, GpuProgramProfile profile, bool requireAdjacency)
     {
-		GLSLGpuProgram* prog = new (bs_alloc<GLSLGpuProgram, PoolAlloc>()) GLSLGpuProgram(source, entryPoint, gptype, profile, includes, requireAdjacency);
+		GLSLGpuProgramCore* prog = new (bs_alloc<GLSLGpuProgramCore, GenAlloc>()) GLSLGpuProgramCore(source, entryPoint, gptype, profile, requireAdjacency);
 
-		return bs_core_ptr<GLSLGpuProgram, PoolAlloc>(prog);
+		return bs_shared_ptr<GLSLGpuProgramCore, GenAlloc>(prog);
     }
 
-	GpuProgramPtr GLSLProgramFactory::create(GpuProgramType type)
+	SPtr<GpuProgramCore> GLSLProgramFactory::create(GpuProgramType type)
 	{
-		GLSLGpuProgram* prog = new (bs_alloc<GLSLGpuProgram, PoolAlloc>()) GLSLGpuProgram("", "", type, GPP_NONE, nullptr, false);
+		GLSLGpuProgramCore* prog = new (bs_alloc<GLSLGpuProgramCore, GenAlloc>()) GLSLGpuProgramCore("", "", type, GPP_NONE, false);
 
-		return bs_core_ptr<GLSLGpuProgram, PoolAlloc>(prog);
+		return bs_shared_ptr<GLSLGpuProgramCore, GenAlloc>(prog);
 	}
 }

+ 2 - 2
BansheeGLRenderSystem/Source/GLSL/src/BsGLSLProgramPipelineManager.cpp

@@ -40,8 +40,8 @@ namespace BansheeEngine
 		}
 	}
 
-	const GLSLProgramPipeline* GLSLProgramPipelineManager::getPipeline(GLSLGpuProgram* vertexProgram, GLSLGpuProgram* fragmentProgram, 
-		GLSLGpuProgram* geometryProgram, GLSLGpuProgram* hullProgram, GLSLGpuProgram* domainProgram)
+	const GLSLProgramPipeline* GLSLProgramPipelineManager::getPipeline(GLSLGpuProgramCore* vertexProgram, GLSLGpuProgramCore* fragmentProgram,
+		GLSLGpuProgramCore* geometryProgram, GLSLGpuProgramCore* hullProgram, GLSLGpuProgramCore* domainProgram)
 	{
 		ProgramPipelineKey key;
 		key.vertexProgKey = vertexProgram != nullptr ? vertexProgram->getProgramID() : 0;

+ 6 - 0
BansheeMono/BansheeMono.vcxproj

@@ -124,6 +124,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_MONO_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -139,6 +140,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_MONO_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -157,6 +159,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>BS_MONO_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -177,6 +180,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_MONO_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -198,6 +202,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>BS_MONO_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -217,6 +222,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_MONO_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
BansheeOISInput/BansheeOISInput.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;../Dependencies/Include;./Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_OIS_EXPORTS;OIS_DYNAMIC_LIB;OIS_NONCLIENT_BUILD;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +141,7 @@
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;./Include;../Dependencies/Include;./Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_OIS_EXPORTS;OIS_DYNAMIC_LIB;OIS_NONCLIENT_BUILD;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -159,6 +161,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -180,6 +183,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -201,6 +205,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -222,6 +227,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
BansheeRenderer/BansheeRenderer.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;../BansheeEngine/Include;./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_BSRND_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +141,7 @@
       <AdditionalIncludeDirectories>../BansheeCore/Include;../BansheeUtility/Include;../BansheeEngine/Include;./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_BSRND_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -159,6 +161,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -180,6 +183,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -201,6 +205,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -222,6 +227,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 2 - 3
BansheeRenderer/Source/BsBansheeLitTexRenderableController.cpp

@@ -19,7 +19,6 @@ namespace BansheeEngine
 		TechniquePtr defaultTechnique = defaultShader->getBestTechnique();
 		PassPtr defaultPass = defaultTechnique->getPass(0);
 
-		bool matrixTranspose = defaultPass->getVertexProgram()->requiresMatrixTranspose(); // Only need this from first vertex program as this is a static setting across all GPU programs
 		GpuParamDescPtr vertParamDesc = defaultPass->getVertexProgram()->getParamDesc();
 		GpuParamDescPtr fragParamDesc = defaultPass->getFragmentProgram()->getParamDesc();
 
@@ -108,8 +107,8 @@ namespace BansheeEngine
 			BS_EXCEPT(InternalErrorException, "Invalid default shader.");
 
 		// Create global GPU param buffers and get parameter handles
-		staticParams = bs_shared_ptr<GpuParams>(staticParamsDesc, matrixTranspose);
-		perFrameParams = bs_shared_ptr<GpuParams>(perFrameParamsDesc, matrixTranspose);
+		staticParams = bs_shared_ptr<GpuParams>(staticParamsDesc, false);
+		perFrameParams = bs_shared_ptr<GpuParams>(perFrameParamsDesc, false);
 
 		staticParamBuffer = HardwareBufferManager::instance().createGpuParamBlockBuffer(staticParamBlockDesc.blockSize * sizeof(UINT32));
 		perFrameParamBuffer = HardwareBufferManager::instance().createGpuParamBlockBuffer(perFrameParamBlockDesc.blockSize * sizeof(UINT32));

+ 6 - 0
BansheeSceneManager/BansheeSceneManager.vcxproj

@@ -124,6 +124,7 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../BansheeUtility/Include;../BansheeCore/Include;../BansheeEngine/Include;./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_WINDLL;BS_SM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -138,6 +139,7 @@
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../BansheeUtility/Include;../BansheeCore/Include;../BansheeEngine/Include;./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_WINDLL;BS_SM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -157,6 +159,7 @@
       <PreprocessorDefinitions>_WINDLL;BS_SM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -177,6 +180,7 @@
       <PreprocessorDefinitions>_WINDLL;BS_SM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -197,6 +201,7 @@
       <PreprocessorDefinitions>_WINDLL;BS_SM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -217,6 +222,7 @@
       <PreprocessorDefinitions>_WINDLL;BS_SM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
BansheeUtility/BansheeUtility.vcxproj

@@ -125,6 +125,7 @@
       <AdditionalIncludeDirectories>./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_UTILITY_EXPORTS</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -144,6 +145,7 @@
       <AdditionalIncludeDirectories>./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_UTILITY_EXPORTS</PreprocessorDefinitions>
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -167,6 +169,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -189,6 +192,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -211,6 +215,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -233,6 +238,7 @@
       <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
ExampleProject/ExampleProject.vcxproj

@@ -125,6 +125,7 @@
       <Optimization>Disabled</Optimization>
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -138,6 +139,7 @@
       <Optimization>Disabled</Optimization>
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -154,6 +156,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -173,6 +176,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>OldStyle</DebugInformationFormat>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -191,6 +195,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -210,6 +215,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <MinimalRebuild>true</MinimalRebuild>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
SBansheeEditor/SBansheeEditor.vcxproj

@@ -124,6 +124,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\BansheeEditor\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;..\SBansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BED_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -139,6 +140,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\BansheeEditor\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;..\SBansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BED_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -157,6 +159,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\BansheeEditor\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;..\SBansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>BS_SCR_BED_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -176,6 +179,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\BansheeEditor\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;..\SBansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BED_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -196,6 +200,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\BansheeEditor\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;..\SBansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>BS_SCR_BED_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -215,6 +220,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\BansheeEditor\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;..\SBansheeEngine\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BED_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 6 - 0
SBansheeEngine/SBansheeEngine.vcxproj

@@ -124,6 +124,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BE_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -139,6 +140,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BE_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -157,6 +159,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>BS_SCR_BE_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -177,6 +180,7 @@
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>None</DebugInformationFormat>
       <PreprocessorDefinitions>BS_SCR_BE_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -196,6 +200,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BE_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -215,6 +220,7 @@
       <SDLCheck>true</SDLCheck>
       <AdditionalIncludeDirectories>.\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;..\BansheeEngine\Include;..\BansheeMono\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>BS_SCR_BE_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <InlineFunctionExpansion>Default</InlineFunctionExpansion>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>

+ 0 - 5
TODO.txt

@@ -2,10 +2,6 @@
 
 TODO - CoreObject refactor:
 Resource
- - RasterizerState
- - DepthStencilState
- - BlendState
- - SamplerState
  - GpuProgram
  - Material -> Remove MaterialProxy
  - Shader -> Remove ShaderProxy
@@ -26,7 +22,6 @@ Disallow CoreObject creation from core thread
 
  New issues:
   - Since Mesh refactor when I select/deselect a gizmo the entire render texture flashes white for one frame (might be related to RT refactor instead)
-  - There seems to be a threading issue with frame alloc freeing due to CoreObject syncing. Sometimes I get crashes in frame alloc relating to unfreed memory
 
 -----------------