Browse Source

Added threading checks to the RenderSystems and refactored a bit

Marko Pintera 13 years ago
parent
commit
bde83d1e5a

+ 7 - 0
CamelotClient/CamelotClient.cpp

@@ -157,6 +157,8 @@ int _tmain(int argc, _TCHAR* argv[])
 	TextureRef testTex = static_resource_cast<Texture>(Importer::instance().import("C:\\ArenaTowerDFS.psd"));
 	MeshRef dbgMesh = static_resource_cast<Mesh>(Importer::instance().import("C:\\X_Arena_Tower.FBX"));
 
+	//int tmpFlag = _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF);
+
 	gResources().create(testTex, "C:\\ExportTest.tex", true);
 	gResources().create(dbgMesh, "C:\\ExportMesh.mesh", true);
 
@@ -168,9 +170,14 @@ int _tmain(int argc, _TCHAR* argv[])
 
 	testMaterial = gResources().load("C:\\ExportMaterial.mat");
 
+	//_ASSERT(_CrtCheckMemory());
+
 	testRenderable->setMesh(dbgMesh);
 	testRenderable->setMaterial(testMaterial);
 
+	//// Set the new state for the flag
+	//_CrtSetDbgFlag( tmpFlag );
+
 	gApplication().runMainLoop();
 
 	gApplication().shutDown();

+ 44 - 39
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -171,28 +171,61 @@ namespace CamelotEngine
 		ZBufferHash mZBufferHash;		
 
 	protected:
+		// I know that's a lot of friends, but I'd rather have friend classes than exposing the needed methods
+		// as public interface. 
+		friend class D3D9Texture;
+		friend class D3D9RenderWindow;
+		friend class D3D9Device;
+		friend class D3D9TextureManager;
+
 		void setClipPlanesImpl(const PlaneList& clipPlanes);	
 
 		/// @copydoc RenderSystem::createMultiRenderTarget
-		virtual MultiRenderTarget * createMultiRenderTarget_internal(const String & name);
+		virtual MultiRenderTarget * createMultiRenderTarget(const String & name);
+
+		String getErrorDescription( long errorNumber ) const;
+
+		void initConfigOptions();
+		void setClipPlane (UINT16 index, float A, float B, float C, float D);
+		void enableClipPlane (UINT16 index, bool enable);
 
 		/**
-         * Set current render target to target, enabling its GL context if needed
-         */
-		void setRenderTarget_internal(RenderTarget *target);
+			Get the matching Z-Buffer identifier for a certain render target
+		*/
+		ZBufferIdentifier getZBufferIdentifier(RenderTarget* rt);
+
+		/** Check which depthStencil formats can be used with a certain pixel format,
+			and return the best suited.
+		*/
+		D3DFORMAT getDepthStencilFormatFor(D3DFORMAT fmt);
 
-		String getErrorDescription_internal( long errorNumber ) const;
+		/** Get a depth stencil surface that is compatible with an internal pixel format and
+			multisample type.
+			@returns A directx surface, or 0 if there is no compatible depthstencil possible.
+		*/
+		IDirect3DSurface9* getDepthStencilFor(D3DFORMAT fmt, D3DMULTISAMPLE_TYPE multisample, DWORD multisample_quality, size_t width, size_t height);
+
+		/** Clear all cached depth stencil surfaces
+		*/
+		void cleanupDepthStencils(IDirect3DDevice9* d3d9Device);
+
+        /** Check whether or not filtering is supported for the precise texture format requested
+        with the given usage options.
+        */
+        bool checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage);
+
+		/// Take in some requested FSAA settings and output supported D3D settings
+		void determineFSAASettings(IDirect3DDevice9* d3d9Device, size_t fsaa, const String& fsaaHint, D3DFORMAT d3dPixelFormat, 
+			bool fullScreen, D3DMULTISAMPLE_TYPE *outMultisampleType, DWORD *outMultisampleQuality);
 	public:
 		// constructor
 		D3D9RenderSystem( HINSTANCE hInstance );
 		// destructor
 		~D3D9RenderSystem();
 
-		virtual void initConfigOptions();
-		
 		const String& getName() const;
 		void shutdown();
-		VertexElementType getColorVertexElementType() const;
+
 		void setStencilCheckEnabled_internal(bool enabled);
         void setStencilBufferParams_internal(CompareFunction func = CMPF_ALWAYS_PASS, 
             UINT32 refValue = 0, UINT32 mask = 0xFFFFFFFF, 
@@ -205,6 +238,7 @@ namespace CamelotEngine
 		void createRenderWindow_internal(const String &name, unsigned int width, unsigned int height, 
 			bool fullScreen, const NameValuePairList& miscParams, AsyncOp& asyncOp);
 		void destroyRenderTarget_internal(const String& name);
+		void setRenderTarget_internal(RenderTarget *target);
 
 		void bindGpuProgram_internal(GpuProgramRef prg);
 		void unbindGpuProgram_internal(GpuProgramType gptype);
@@ -245,12 +279,12 @@ namespace CamelotEngine
         void clearFrameBuffer_internal(unsigned int buffers, 
             const Color& colour = Color::Black, 
             float depth = 1.0f, unsigned short stencil = 0);
-		void setClipPlane (UINT16 index, float A, float B, float C, float D);
-		void enableClipPlane (UINT16 index, bool enable);
+
         float getHorizontalTexelOffset();
         float getVerticalTexelOffset();
         float getMinimumDepthInputValue();
         float getMaximumDepthInputValue();
+		VertexElementType getColorVertexElementType() const;
 
 		static D3D9ResourceManager* getResourceManager();
 		static D3D9DeviceManager* getDeviceManager();
@@ -258,35 +292,6 @@ namespace CamelotEngine
 		static UINT	getResourceCreationDeviceCount();
 		static IDirect3DDevice9* getResourceCreationDevice(UINT index);
 		static IDirect3DDevice9* getActiveD3D9Device();
-		
-		/**
-			Get the matching Z-Buffer identifier for a certain render target
-		*/
-		ZBufferIdentifier getZBufferIdentifier(RenderTarget* rt);
-
-		/** Check which depthStencil formats can be used with a certain pixel format,
-			and return the best suited.
-		*/
-		D3DFORMAT _getDepthStencilFormatFor(D3DFORMAT fmt);
-
-		/** Get a depth stencil surface that is compatible with an internal pixel format and
-			multisample type.
-			@returns A directx surface, or 0 if there is no compatible depthstencil possible.
-		*/
-		IDirect3DSurface9* _getDepthStencilFor(D3DFORMAT fmt, D3DMULTISAMPLE_TYPE multisample, DWORD multisample_quality, size_t width, size_t height);
-
-		/** Clear all cached depth stencil surfaces
-		*/
-		void _cleanupDepthStencils(IDirect3DDevice9* d3d9Device);
-
-        /** Check whether or not filtering is supported for the precise texture format requested
-        with the given usage options.
-        */
-        bool _checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage);
-
-		/// Take in some requested FSAA settings and output supported D3D settings
-		void determineFSAASettings(IDirect3DDevice9* d3d9Device, size_t fsaa, const String& fsaaHint, D3DFORMAT d3dPixelFormat, 
-			bool fullScreen, D3DMULTISAMPLE_TYPE *outMultisampleType, DWORD *outMultisampleQuality);
 
 	protected:	
 		/// Notify when a device has been lost.

+ 1 - 1
CamelotD3D9Renderer/Source/CmD3D9Device.cpp

@@ -375,7 +375,7 @@ namespace CamelotEngine
 		renderSystem->notifyOnDeviceLost(this);
 
 		// Cleanup depth stencils surfaces.
-		renderSystem->_cleanupDepthStencils(mpDevice);
+		renderSystem->cleanupDepthStencils(mpDevice);
 
 		updatePresentationParameters();
 

File diff suppressed because it is too large
+ 1966 - 1803
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp


+ 1 - 1
CamelotD3D9Renderer/Source/CmD3D9TextureManager.cpp

@@ -97,6 +97,6 @@ namespace CamelotEngine
         D3D9RenderSystem* rs = static_cast<D3D9RenderSystem*>(
             CamelotEngine::RenderSystemManager::getActive());
 
-        return rs->_checkTextureFilteringSupported(ttype, format, usage);
+        return rs->checkTextureFilteringSupported(ttype, format, usage);
     }
 }

+ 46 - 48
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -132,12 +132,42 @@ namespace CamelotEngine {
 		bool activateGLTextureUnit(size_t unit);
 
 		/// @copydoc RenderSystem::createMultiRenderTarget
-		virtual MultiRenderTarget * createMultiRenderTarget_internal(const String & name); 
+		virtual MultiRenderTarget * createMultiRenderTarget(const String & name); 
 		
         /** See
           RenderSystem
          */
-        String getErrorDescription_internal(long errorNumber) const;
+        String getErrorDescription(long errorNumber) const;
+
+		/** See
+          RenderSystem
+         */
+        void setClipPlane (UINT16 index, float A, float B, float C, float D);
+        /** See
+          RenderSystem
+         */
+        void enableClipPlane (UINT16 index, bool enable);
+
+		// ----------------------------------
+        // GLRenderSystem specific members
+        // ----------------------------------
+        /** One time initialization for the RenderState of a context. Things that
+            only need to be set once, like the LightingModel can be defined here.
+         */
+        void oneTimeContextInitialization();
+        /** Switch GL context, dealing with involved internal cached states too
+        */
+        void switchContext(GLContext *context);
+        /** Unregister a render target->context mapping. If the context of target 
+            is the current context, change the context to the main context so it
+            can be destroyed safely. 
+            
+            @note This is automatically called by the destructor of 
+            GLContext.
+         */
+
+		/** Returns the main context */
+		GLContext* _getMainContext() {return mMainContext;} 
 
     public:
         // Default constructor / destructor
@@ -151,15 +181,6 @@ namespace CamelotEngine {
           RenderSystem
          */
         const String& getName(void) const;
-        /** See
-          RenderSystem
-         */
-        void shutdown(void);
-
-        /** See
-          RenderSystem
-         */
-        VertexElementType getColorVertexElementType(void) const;
 
         // -----------------------------
         // Low-level overridden members
@@ -168,11 +189,19 @@ namespace CamelotEngine {
           RenderSystem
          */
 		void startUp_internal();
+        /** See
+          RenderSystem
+         */
+        void shutdown(void);
 		/** See
           RenderSystem
          */
 		void createRenderWindow_internal(const String &name, unsigned int width, unsigned int height, 
 			bool fullScreen, const NameValuePairList& miscParams, AsyncOp& asyncOp);
+        /**
+         * Set current render target to target, enabling its GL context if needed
+         */
+        void setRenderTarget_internal(RenderTarget *target);
         /** See
           RenderSystem
          */
@@ -275,14 +304,6 @@ namespace CamelotEngine {
          */
         void convertProjectionMatrix(const Matrix4& matrix,
             Matrix4& dest, bool forGpuProgram = false);
-        /** See
-          RenderSystem
-         */
-        void setClipPlane (UINT16 index, float A, float B, float C, float D);
-        /** See
-          RenderSystem
-         */
-        void enableClipPlane (UINT16 index, bool enable);
         /** See
           RenderSystem
          */
@@ -320,11 +341,7 @@ namespace CamelotEngine {
           RenderSystem
          */
         void render_internal(const RenderOperation& op);
-        /** See
-          RenderSystem
-         */
-		void bindGpuProgramParameters(GpuProgramType gptype, 
-			GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
+
         /** See
           RenderSystem
          */
@@ -332,36 +349,17 @@ namespace CamelotEngine {
         void clearFrameBuffer_internal(unsigned int buffers, 
             const Color& colour = Color::Black, 
             float depth = 1.0f, unsigned short stencil = 0);
+
+		/** See
+          RenderSystem
+         */
+        VertexElementType getColorVertexElementType(void) const;
         float getHorizontalTexelOffset(void);
         float getVerticalTexelOffset(void);
         float getMinimumDepthInputValue(void);
         float getMaximumDepthInputValue(void);
-		CM_MUTEX(mThreadInitMutex)
 
-        // ----------------------------------
-        // GLRenderSystem specific members
-        // ----------------------------------
-        /** One time initialization for the RenderState of a context. Things that
-            only need to be set once, like the LightingModel can be defined here.
-         */
-        void _oneTimeContextInitialization();
-        /** Switch GL context, dealing with involved internal cached states too
-        */
-        void _switchContext(GLContext *context);
-        /**
-         * Set current render target to target, enabling its GL context if needed
-         */
-        void setRenderTarget_internal(RenderTarget *target);
-        /** Unregister a render target->context mapping. If the context of target 
-            is the current context, change the context to the main context so it
-            can be destroyed safely. 
-            
-            @note This is automatically called by the destructor of 
-            GLContext.
-         */
         void _unregisterContext(GLContext *context);
-		/** Returns the main context */
-		GLContext* _getMainContext() {return mMainContext;} 
     };
 }
 #endif

File diff suppressed because it is too large
+ 752 - 1371
CamelotGLRenderer/Source/CmGLRenderSystem.cpp


+ 13 - 9
CamelotRenderer/Include/CmRenderSystem.h

@@ -745,12 +745,11 @@ namespace CamelotEngine
 		virtual void render_internal(const RenderOperation& op);
 
 		/** Gets the capabilities of the render system. */
-		const RenderSystemCapabilities* getCapabilities_internal(void) const { return mCurrentCapabilities; }
-
+		const RenderSystemCapabilities* getCapabilities_internal(void) const;
 
 		/** Returns the driver version.
 		*/
-		virtual const DriverVersion& getDriverVersion_internal(void) const { return mDriverVersion; }
+		virtual const DriverVersion& getDriverVersion_internal(void) const;
 
 		/** Binds a given GpuProgram (but not the parameters). 
 		@remarks Only one GpuProgram of each type can be bound at once, binding another
@@ -777,7 +776,7 @@ namespace CamelotEngine
 		virtual void unbindGpuProgram_internal(GpuProgramType gptype);
 
 		/** Returns whether or not a Gpu program of the given type is currently bound. */
-		virtual bool isGpuProgramBound(GpuProgramType gptype);
+		virtual bool isGpuProgramBound_internal(GpuProgramType gptype);
 
 		/** Sets the user clipping region.
 		*/
@@ -960,22 +959,22 @@ namespace CamelotEngine
 		at once. Surfaces can be bound and unbound at will.
 		This fails if mCapabilities->getNumMultiRenderTargets() is smaller than 2.
 		*/
-		virtual MultiRenderTarget * createMultiRenderTarget_internal(const String & name) = 0; 
+		virtual MultiRenderTarget * createMultiRenderTarget(const String & name) = 0; 
 
 		/** Returns a pointer to the render target with the passed name, or NULL if that
 		render target cannot be found.
 		*/
-		virtual RenderTarget * getRenderTarget_internal( const String &name );
+		virtual RenderTarget * getRenderTarget( const String &name );
 		/** Detaches the render target with the passed name from the render system and
 		returns a pointer to it.
 		@note
 		If the render target cannot be found, NULL is returned.
 		*/
-		virtual RenderTarget * detachRenderTarget_internal( const String &name );
+		virtual RenderTarget * detachRenderTarget( const String &name );
 
 		/** Returns a description of an error code.
 		*/
-		virtual String getErrorDescription_internal(long errorNumber) const = 0;
+		virtual String getErrorDescription(long errorNumber) const = 0;
 
 		DriverVersion mDriverVersion;
 
@@ -1043,7 +1042,12 @@ namespace CamelotEngine
 		/**
 		 * @brief	Throws an exception if current thread isn't the render thread;
 		 */
-		void throwIfInvalidThread();
+		void throwIfNotRenderThread() const;
+
+		/**
+		 * @brief	Throws an exception if current thread isn't the thread the active context is initialized on
+		 */
+		void throwIfInvalidContextThread() const;
 
 		/**
 		 * @brief	Submits the specified context to the GPU. Normally this happens automatically

+ 3 - 0
CamelotRenderer/Include/CmRenderSystemContext.h

@@ -15,6 +15,9 @@ namespace CamelotEngine
 	 */
 	class RenderSystemContext
 	{
+	public:
+		CM_THREAD_ID_TYPE getThreadId() const { return mMyThreadId; }
+
 	private:
 		struct RenderSystemCommand
 		{

+ 2 - 2
CamelotRenderer/Include/CmRenderTarget.h

@@ -35,8 +35,8 @@ THE SOFTWARE.
 #include "CmViewport.h"
 
 /* Define the number of priority groups for the render system's render targets. */
-#ifndef OGRE_NUM_RENDERTARGET_GROUPS
-	#define OGRE_NUM_RENDERTARGET_GROUPS 10
+#ifndef CM_NUM_RENDERTARGET_GROUPS
+	#define CM_NUM_RENDERTARGET_GROUPS 10
 	#define OGRE_DEFAULT_RT_GROUP 4
 	#define OGRE_REND_TO_TEX_RT_GROUP 2
 #endif

+ 141 - 6
CamelotRenderer/Source/CmRenderSystem.cpp

@@ -42,6 +42,14 @@ THE SOFTWARE.
 #include "CmRenderSystemContext.h"
 #include "boost/bind.hpp"
 
+#if CM_DEBUG_MODE
+#define THROW_IF_INVALID_CONTEXT throwIfInvalidContextThread();
+#define THROW_IF_NOT_RENDER_THREAD throwIfNotRenderThread();
+#else
+#define THROW_IF_INVALID_CONTEXT 
+#define THROW_IF_NOT_RENDER_THREAD 
+#endif
+
 namespace CamelotEngine {
 
     static const TexturePtr sNullTexPtr;
@@ -92,6 +100,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::startUp_internal()
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		mVertexProgramBound = false;
 		mGeometryProgramBound = false;
 		mFragmentProgramBound = false;
@@ -99,6 +109,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::shutdown(void)
 	{
+		// TODO - I should probably sync this up to make sure no other threads are doing anything while shutdown is in progress
+
 		// Remove all the render targets.
 		// (destroy primary target last since others may depend on it)
 		RenderTarget* primary = 0;
@@ -119,6 +131,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::swapAllRenderTargetBuffers(bool waitForVSync)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::swapAllRenderTargetBuffers_internal, this, waitForVSync));
@@ -126,6 +139,8 @@ namespace CamelotEngine {
     //-----------------------------------------------------------------------
     void RenderSystem::swapAllRenderTargetBuffers_internal(bool waitForVSync)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         // Update all in order of priority
         // This ensures render-to-texture targets get updated before render windows
 		RenderTargetPriorityMap::iterator itarg, itargend;
@@ -140,6 +155,8 @@ namespace CamelotEngine {
 	RenderWindow* RenderSystem::createRenderWindow(const String &name, unsigned int width, unsigned int height, 
 		bool fullScreen, const NameValuePairList *miscParams)
 	{
+		THROW_IF_INVALID_CONTEXT;
+
 		AsyncOp op;
 		{
 			CM_LOCK_MUTEX(mResourceContextMutex)
@@ -156,23 +173,31 @@ namespace CamelotEngine {
     //---------------------------------------------------------------------------------------------
     void RenderSystem::destroyRenderWindow_internal(const String& name)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         destroyRenderTarget_internal(name);
     }
     //---------------------------------------------------------------------------------------------
     void RenderSystem::destroyRenderTexture_internal(const String& name)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         destroyRenderTarget_internal(name);
     }
     //---------------------------------------------------------------------------------------------
     void RenderSystem::destroyRenderTarget_internal(const String& name)
     {
-        RenderTarget* rt = detachRenderTarget_internal(name);
+		THROW_IF_NOT_RENDER_THREAD;
+
+        RenderTarget* rt = detachRenderTarget(name);
         delete rt;
     }
     //---------------------------------------------------------------------------------------------
     void RenderSystem::attachRenderTarget_internal( RenderTarget &target )
     {
-		assert( target.getPriority() < OGRE_NUM_RENDERTARGET_GROUPS );
+		THROW_IF_NOT_RENDER_THREAD;
+
+		assert( target.getPriority() < CM_NUM_RENDERTARGET_GROUPS );
 
         mRenderTargets.insert( RenderTargetMap::value_type( target.getName(), &target ) );
         mPrioritisedRenderTargets.insert(
@@ -180,8 +205,10 @@ namespace CamelotEngine {
     }
 
     //---------------------------------------------------------------------------------------------
-    RenderTarget * RenderSystem::getRenderTarget_internal( const String &name )
+    RenderTarget * RenderSystem::getRenderTarget( const String &name )
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         RenderTargetMap::iterator it = mRenderTargets.find( name );
         RenderTarget *ret = NULL;
 
@@ -192,10 +219,25 @@ namespace CamelotEngine {
 
         return ret;
     }
+	//---------------------------------------------------------------------------------------------
+	const RenderSystemCapabilities* RenderSystem::getCapabilities_internal(void) const 
+	{ 
+		THROW_IF_NOT_RENDER_THREAD;
+
+		return mCurrentCapabilities; 
+	}
+	//---------------------------------------------------------------------------------------------
+	const DriverVersion& RenderSystem::getDriverVersion_internal(void) const 
+	{ 
+		THROW_IF_NOT_RENDER_THREAD;
 
+		return mDriverVersion; 
+	}
     //---------------------------------------------------------------------------------------------
-    RenderTarget * RenderSystem::detachRenderTarget_internal( const String &name )
+    RenderTarget * RenderSystem::detachRenderTarget( const String &name )
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         RenderTargetMap::iterator it = mRenderTargets.find( name );
         RenderTarget *ret = NULL;
 
@@ -225,6 +267,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setViewport(const Viewport& vp)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setViewport_internal, this, vp));
@@ -232,11 +275,14 @@ namespace CamelotEngine {
     //-----------------------------------------------------------------------
     Viewport RenderSystem::getViewport_internal(void)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         return mActiveViewport;
     }
     //-----------------------------------------------------------------------
     void RenderSystem::setTextureUnitSettings(size_t texUnit, const TexturePtr& tex, const SamplerState& samplerState)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTextureUnitSettings_internal, this, texUnit, tex, samplerState));
@@ -244,6 +290,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
     void RenderSystem::setTextureUnitSettings_internal(size_t texUnit, const TexturePtr& tex, const SamplerState& tl)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         // This method is only ever called to set a texture unit to valid details
         // The method _disableTextureUnit is called to turn a unit off
 
@@ -292,6 +340,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setTexture(size_t unit, bool enabled, const TexturePtr &texPtr)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTexture_internal, this, unit, enabled, texPtr));
@@ -299,6 +348,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setVertexTexture(size_t unit, const TexturePtr& tex)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setVertexTexture_internal, this, unit, tex));
@@ -306,6 +356,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setVertexTexture_internal(size_t unit, const TexturePtr& tex)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		CM_EXCEPT(NotImplementedException, 
 			"This rendersystem does not support separate vertex texture samplers, "
 			"you should use the regular texture samplers which are shared between "
@@ -314,6 +366,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::disableTextureUnit(size_t texUnit)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::disableTextureUnit_internal, this, texUnit));
@@ -321,11 +374,14 @@ namespace CamelotEngine {
     //-----------------------------------------------------------------------
     void RenderSystem::disableTextureUnit_internal(size_t texUnit)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         setTexture_internal(texUnit, false, sNullTexPtr);
     }
 	//---------------------------------------------------------------------
 	void RenderSystem::disableTextureUnitsFrom(size_t texUnit)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::disableTextureUnitsFrom_internal, this, texUnit));
@@ -333,6 +389,8 @@ namespace CamelotEngine {
     //---------------------------------------------------------------------
     void RenderSystem::disableTextureUnitsFrom_internal(size_t texUnit)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         size_t disableTo = CM_MAX_TEXTURE_LAYERS;
         if (disableTo > mDisabledTexUnitsFrom)
             disableTo = mDisabledTexUnitsFrom;
@@ -346,6 +404,7 @@ namespace CamelotEngine {
 	void RenderSystem::setTextureFiltering(size_t unit, FilterOptions minFilter,
 		FilterOptions magFilter, FilterOptions mipFilter)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTextureFiltering_internal, this, unit, minFilter, magFilter, mipFilter));
@@ -354,6 +413,8 @@ namespace CamelotEngine {
     void RenderSystem::setTextureFiltering_internal(size_t unit, FilterOptions minFilter,
             FilterOptions magFilter, FilterOptions mipFilter)
     {
+		THROW_IF_NOT_RENDER_THREAD;
+
         setTextureFiltering_internal(unit, FT_MIN, minFilter);
         setTextureFiltering_internal(unit, FT_MAG, magFilter);
         setTextureFiltering_internal(unit, FT_MIP, mipFilter);
@@ -361,6 +422,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setTextureAnisotropy(size_t unit, unsigned int maxAnisotropy)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTextureAnisotropy_internal, this, unit, maxAnisotropy));
@@ -368,6 +430,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setTextureAddressingMode(size_t unit, const SamplerState::UVWAddressingMode& uvw)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTextureAddressingMode_internal, this, unit, uvw));
@@ -375,6 +438,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setTextureBorderColor(size_t unit, const Color& color)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTextureBorderColor_internal, this, unit, color));
@@ -382,6 +446,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setTextureMipmapBias(size_t unit, float bias)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setTextureMipmapBias_internal, this, unit, bias));
@@ -390,6 +455,7 @@ namespace CamelotEngine {
 	void RenderSystem::setPointParameters(float size, bool attenuationEnabled, 
 		float constant, float linear, float quadratic, float minSize, float maxSize)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setPointParameters_internal, this, size, attenuationEnabled, constant, linear, quadratic, minSize, maxSize));
@@ -397,6 +463,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setSceneBlending_internal, this, sourceFactor, destFactor, op));
@@ -405,6 +472,7 @@ namespace CamelotEngine {
 	void RenderSystem::setSeparateSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
 		SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setSeparateSceneBlending_internal, this, sourceFactor, destFactor, sourceFactorAlpha, destFactorAlpha, op, alphaOp));
@@ -412,6 +480,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setAlphaRejectSettings_internal, this, func, value, alphaToCoverage));
@@ -419,6 +488,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setScissorTest(bool enabled, size_t left, size_t top, size_t right, size_t bottom)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setScissorTest_internal, this, enabled, left, top, right, bottom));
@@ -426,6 +496,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	bool RenderSystem::getWaitForVerticalBlank(void) const
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		return mActiveContext->waitForVerticalBlank;
@@ -433,11 +504,14 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	bool RenderSystem::getWaitForVerticalBlank_internal(void) const
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		return mVsync;
 	}
 	//-----------------------------------------------------------------------
 	void RenderSystem::setWaitForVerticalBlank(bool enabled)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->waitForVerticalBlank = enabled;
@@ -446,11 +520,14 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setWaitForVerticalBlank_internal(bool enabled)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		mVsync = enabled;
 	}
 	//-----------------------------------------------------------------------
 	void RenderSystem::setInvertVertexWinding(bool invert)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->invertVertexWinding = invert;
@@ -459,11 +536,14 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setInvertVertexWinding_internal(bool invert)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		mInvertVertexWinding = invert;
 	}
 	//-----------------------------------------------------------------------
 	bool RenderSystem::getInvertVertexWinding(void) const
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		return mActiveContext->invertVertexWinding;
@@ -471,11 +551,14 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	bool RenderSystem::getInvertVertexWinding_internal(void) const
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		return mInvertVertexWinding;
 	}
 	//-----------------------------------------------------------------------
 	void RenderSystem::setDepthBufferParams(bool depthTest, bool depthWrite, CompareFunction depthFunction)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setDepthBufferParams_internal, this, depthTest, depthWrite, depthFunction));
@@ -483,6 +566,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setDepthBufferCheckEnabled(bool enabled)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setDepthBufferCheckEnabled_internal, this, enabled));
@@ -490,6 +574,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setDepthBufferWriteEnabled(bool enabled)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setDepthBufferWriteEnabled_internal, this, enabled));
@@ -497,6 +582,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setDepthBufferFunction(CompareFunction func)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setDepthBufferFunction_internal, this, func));
@@ -504,6 +590,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setColorBufferWriteEnabled(bool red, bool green, bool blue, bool alpha)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setColorBufferWriteEnabled_internal, this, red, green, blue, alpha));
@@ -511,6 +598,7 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::setDepthBias(float constantBias, float slopeScaleBias)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setDepthBias_internal, this, constantBias, slopeScaleBias));
@@ -518,6 +606,7 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::setPolygonMode(PolygonMode level)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setPolygonMode_internal, this, level));
@@ -525,6 +614,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setStencilCheckEnabled(bool enabled)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setStencilCheckEnabled_internal, this, enabled));
@@ -533,6 +623,7 @@ namespace CamelotEngine {
 	void RenderSystem::setStencilBufferParams(CompareFunction func, UINT32 refValue, UINT32 mask, StencilOperation stencilFailOp, 
 		StencilOperation depthFailOp, StencilOperation passOp, bool twoSidedOperation)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setStencilBufferParams_internal, this, func, refValue, mask, stencilFailOp, depthFailOp, passOp, twoSidedOperation));
@@ -540,6 +631,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	CullingMode RenderSystem::getCullingMode(void) const
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		return mActiveContext->cullingMode;
@@ -547,11 +639,13 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	CullingMode RenderSystem::getCullingMode_internal(void) const
 	{
+		THROW_IF_NOT_RENDER_THREAD;
 		return mCullingMode;
 	}
 	//-----------------------------------------------------------------------
 	void RenderSystem::setCullingMode(CullingMode mode)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->cullingMode = mode;
@@ -561,6 +655,7 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::addClipPlane(const Plane &p)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::addClipPlane_internal, this, p));
@@ -568,12 +663,15 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::addClipPlane_internal (const Plane &p)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		mClipPlanes.push_back(p);
 		mClipPlanesDirty = true;
 	}
 	//---------------------------------------------------------------------
 	void RenderSystem::addClipPlane(float A, float B, float C, float D)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::addClipPlane_internal, this, A, B, C, D));
@@ -581,11 +679,14 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::addClipPlane_internal (float A, float B, float C, float D)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		addClipPlane_internal(Plane(A, B, C, D));
 	}
 	//---------------------------------------------------------------------
 	void RenderSystem::setClipPlanes(const PlaneList& clipPlanes)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setClipPlanes_internal, this, clipPlanes));
@@ -593,6 +694,8 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::setClipPlanes_internal(const PlaneList& clipPlanes)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		if (clipPlanes != mClipPlanes)
 		{
 			mClipPlanes = clipPlanes;
@@ -602,6 +705,7 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::resetClipPlanes()
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::resetClipPlanes_internal, this));
@@ -609,6 +713,8 @@ namespace CamelotEngine {
 	//---------------------------------------------------------------------
 	void RenderSystem::resetClipPlanes_internal()
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		if (!mClipPlanes.empty())
 		{
 			mClipPlanes.clear();
@@ -618,6 +724,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::bindGpuProgram(GpuProgramRef prg)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::bindGpuProgram_internal, this, prg));
@@ -625,6 +732,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::bindGpuProgram_internal(GpuProgramRef prg)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		switch(prg->_getBindingDelegate()->getType())
 		{
 		case GPT_VERTEX_PROGRAM:
@@ -645,6 +754,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::unbindGpuProgram(GpuProgramType gptype)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 	    mActiveContext->queueCommand(boost::bind(&RenderSystem::unbindGpuProgram_internal, this, gptype));
@@ -652,6 +762,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::unbindGpuProgram_internal(GpuProgramType gptype)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		switch(gptype)
 		{
 		case GPT_VERTEX_PROGRAM:
@@ -672,6 +784,8 @@ namespace CamelotEngine {
 	void RenderSystem::bindGpuProgramParameters(GpuProgramType gptype, 
 		GpuProgramParametersSharedPtr params, UINT16 variabilityMask)
 	{
+		THROW_IF_INVALID_CONTEXT;
+
 		GpuProgramParametersSharedPtr paramCopy = GpuProgramParametersSharedPtr(new GpuProgramParameters(*params));
 
 		CM_LOCK_MUTEX(mActiveContextMutex);
@@ -679,8 +793,10 @@ namespace CamelotEngine {
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::bindGpuProgramParameters_internal, this, gptype, paramCopy, variabilityMask));
 	}
 	//-----------------------------------------------------------------------
-	bool RenderSystem::isGpuProgramBound(GpuProgramType gptype)
+	bool RenderSystem::isGpuProgramBound_internal(GpuProgramType gptype)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 	    switch(gptype)
 	    {
         case GPT_VERTEX_PROGRAM:
@@ -696,6 +812,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::setRenderTarget(RenderTarget *target)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::setRenderTarget_internal, this, target));
@@ -703,6 +820,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::clearFrameBuffer(unsigned int buffers, const Color& color, float depth, unsigned short stencil)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::clearFrameBuffer_internal, this, buffers, color, depth, stencil));
@@ -710,6 +828,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::beginFrame()
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::beginFrame_internal, this));
@@ -717,6 +836,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::endFrame()
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::endFrame_internal, this));
@@ -724,6 +844,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::render(const RenderOperation& op)
 	{
+		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
 
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::render_internal, this, op));
@@ -731,6 +852,8 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void RenderSystem::render_internal(const RenderOperation& op)
 	{
+		THROW_IF_NOT_RENDER_THREAD;
+
 		// sort out clip planes
 		// have to do it here in case of matrix issues
 		if (mClipPlanesDirty)
@@ -740,6 +863,10 @@ namespace CamelotEngine {
 		}
 	}
 
+	/************************************************************************/
+	/* 								PRIVATE		                     		*/
+	/************************************************************************/
+
 	void RenderSystem::initRenderThread()
 	{
 		mRenderThreadFunc = new RenderWorkerFunc(this);
@@ -907,12 +1034,18 @@ namespace CamelotEngine {
 		CM_THREAD_NOTIFY_ALL(mRSContextReadyCondition)
 	}
 
-	void RenderSystem::throwIfInvalidThread()
+	void RenderSystem::throwIfNotRenderThread() const
 	{
 		if(CM_THREAD_CURRENT_ID != getRenderThreadId())
 			CM_EXCEPT(InternalErrorException, "Calling the render system from a non-render thread!");
 	}
 
+	void RenderSystem::throwIfInvalidContextThread() const
+	{
+		if(CM_THREAD_CURRENT_ID != mActiveContext->getThreadId())
+			CM_EXCEPT(InternalErrorException, "Active context is called from a thread it was not initialized on!");
+	}
+
 	/************************************************************************/
 	/* 								THREAD WORKER                      		*/
 	/************************************************************************/
@@ -929,3 +1062,5 @@ namespace CamelotEngine {
 	}
 }
 
+#undef THROW_IF_INVALID_CONTEXT
+#undef THROW_IF_NOT_RENDER_THREAD

Some files were not shown because too many files changed in this diff