Ver código fonte

Removed shared ptr

Marko Pintera 13 anos atrás
pai
commit
4dd7e37308
48 arquivos alterados com 201 adições e 758 exclusões
  1. 0 1
      CamelotRenderer/CamelotRenderer.cpp
  2. 0 1
      CamelotRenderer/CamelotRenderer.vcxproj
  3. 0 3
      CamelotRenderer/CamelotRenderer.vcxproj.filters
  4. 1 1
      CamelotRenderer/CmApplication.cpp
  5. 1 13
      CamelotRenderer/OgreD3D9GpuProgram.h
  6. 4 4
      CamelotRenderer/OgreD3D9HardwareBufferManager.cpp
  7. 2 2
      CamelotRenderer/OgreD3D9HardwareBufferManager.h
  8. 3 3
      CamelotRenderer/OgreD3D9HardwarePixelBuffer.cpp
  9. 2 2
      CamelotRenderer/OgreD3D9HardwarePixelBuffer.h
  10. 6 6
      CamelotRenderer/OgreD3D9RenderSystem.cpp
  11. 5 5
      CamelotRenderer/OgreD3D9Texture.cpp
  12. 3 47
      CamelotRenderer/OgreD3D9Texture.h
  13. 4 4
      CamelotRenderer/OgreDefaultHardwareBufferManager.cpp
  14. 2 2
      CamelotRenderer/OgreDefaultHardwareBufferManager.h
  15. 1 1
      CamelotRenderer/OgreFrustum.cpp
  16. 7 36
      CamelotRenderer/OgreGpuProgram.cpp
  17. 1 23
      CamelotRenderer/OgreGpuProgram.h
  18. 17 17
      CamelotRenderer/OgreGpuProgramParams.cpp
  19. 6 7
      CamelotRenderer/OgreGpuProgramParams.h
  20. 28 28
      CamelotRenderer/OgreHardwareBufferManager.cpp
  21. 27 31
      CamelotRenderer/OgreHardwareBufferManager.h
  22. 0 7
      CamelotRenderer/OgreHardwareIndexBuffer.cpp
  23. 1 10
      CamelotRenderer/OgreHardwareIndexBuffer.h
  24. 3 10
      CamelotRenderer/OgreHardwarePixelBuffer.cpp
  25. 2 14
      CamelotRenderer/OgreHardwarePixelBuffer.h
  26. 2 12
      CamelotRenderer/OgreHardwareVertexBuffer.cpp
  27. 4 13
      CamelotRenderer/OgreHardwareVertexBuffer.h
  28. 5 35
      CamelotRenderer/OgreHighLevelGpuProgram.cpp
  29. 1 23
      CamelotRenderer/OgreHighLevelGpuProgram.h
  30. 9 4
      CamelotRenderer/OgrePrerequisites.h
  31. 3 3
      CamelotRenderer/OgreRenderSystem.cpp
  32. 0 278
      CamelotRenderer/OgreSharedPtr.h
  33. 2 0
      CamelotRenderer/OgreStdHeaders.h
  34. 1 19
      CamelotRenderer/OgreTexture.h
  35. 9 9
      CamelotRenderer/OgreTextureUnitState.cpp
  36. 7 7
      CamelotRenderer/OgreVertexIndexData.cpp
  37. 3 3
      CamelotRenderer/OgreVertexIndexData.h
  38. 2 2
      CamelotRenderer/RenderSystemGL/Include/OgreGLDefaultHardwareBufferManager.h
  39. 2 2
      CamelotRenderer/RenderSystemGL/Include/OgreGLHardwareBufferManager.h
  40. 1 1
      CamelotRenderer/RenderSystemGL/Include/OgreGLHardwarePixelBuffer.h
  41. 3 47
      CamelotRenderer/RenderSystemGL/Include/OgreGLTexture.h
  42. 1 1
      CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLProgram.cpp
  43. 0 1
      CamelotRenderer/RenderSystemGL/Source/OgreGLContext.cpp
  44. 4 4
      CamelotRenderer/RenderSystemGL/Source/OgreGLDefaultHardwareBufferManager.cpp
  45. 4 4
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareBufferManager.cpp
  46. 2 2
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwarePixelBuffer.cpp
  47. 7 7
      CamelotRenderer/RenderSystemGL/Source/OgreGLRenderSystem.cpp
  48. 3 3
      CamelotRenderer/RenderSystemGL/Source/OgreGLTexture.cpp

+ 0 - 1
CamelotRenderer/CamelotRenderer.cpp

@@ -15,7 +15,6 @@
 #include "OgrePlatform.h"
 #include "OgrePrerequisites.h"
 #include "OgreQuaternion.h"
-#include "OgreSharedPtr.h"
 #include "OgreString.h"
 #include "OgreStringConverter.h"
 #include "OgreThreadDefines.h"

+ 0 - 1
CamelotRenderer/CamelotRenderer.vcxproj

@@ -162,7 +162,6 @@
     <ClInclude Include="OgreRenderTarget.h" />
     <ClInclude Include="OgreRenderTexture.h" />
     <ClInclude Include="OgreRenderWindow.h" />
-    <ClInclude Include="OgreSharedPtr.h" />
     <ClInclude Include="OgreSingleton.h" />
     <ClInclude Include="OgreSphere.h" />
     <ClInclude Include="OgreStdHeaders.h" />

+ 0 - 3
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -169,9 +169,6 @@
     <ClInclude Include="OgrePrerequisites.h">
       <Filter>Header Files\ForRemoval</Filter>
     </ClInclude>
-    <ClInclude Include="OgreSharedPtr.h">
-      <Filter>Header Files\ForRemoval</Filter>
-    </ClInclude>
     <ClInclude Include="OgreSingleton.h">
       <Filter>Header Files\ForRemoval</Filter>
     </ClInclude>

+ 1 - 1
CamelotRenderer/CmApplication.cpp

@@ -149,7 +149,7 @@ namespace CamelotEngine
 		//decl->addElement(0, offset, Ogre::VET_COLOUR, Ogre::VES_DIFFUSE);
 		//offset += Ogre::VertexElement::getTypeSize(Ogre::VET_COLOUR);
 
-		Ogre::HardwareVertexBufferSharedPtr vertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(
+		Ogre::HardwareVertexBufferPtr vertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(
 			vertexData->vertexDeclaration->getVertexSize(0),
 			vertexData->vertexCount,
 			Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);

+ 1 - 13
CamelotRenderer/OgreD3D9GpuProgram.h

@@ -159,20 +159,8 @@ namespace Ogre {
 
 		DeviceToPixelShaderMap		mMapDeviceToPixelShader;			
     };
-    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to D3D9GpuProgramPtr 
-    @note Has to be a subclass since we need operator=.
-    We could templatise this instead of repeating per Resource subclass, 
-    except to do so requires a form VC6 does not support i.e.
-    ResourceSubclassPtr<T> : public SharedPtr<T>
-    */
-    class _OgreExport D3D9GpuProgramPtr : public SharedPtr<D3D9GpuProgram> 
-    {
-    public:
-        D3D9GpuProgramPtr() : SharedPtr<D3D9GpuProgram>() {}
-        explicit D3D9GpuProgramPtr(D3D9GpuProgram* rep) : SharedPtr<D3D9GpuProgram>(rep) {}
-        D3D9GpuProgramPtr(const D3D9GpuProgramPtr& r) : SharedPtr<D3D9GpuProgram>(r) {} 
-    };
 
+	typedef std::shared_ptr<D3D9GpuProgram> D3D9GpuProgramPtr;
 }
 
 

+ 4 - 4
CamelotRenderer/OgreD3D9HardwareBufferManager.cpp

@@ -44,7 +44,7 @@ namespace Ogre {
         destroyAllBindings();
     }
     //-----------------------------------------------------------------------
-    HardwareVertexBufferSharedPtr 
+    HardwareVertexBufferPtr 
     D3D9HardwareBufferManagerBase::
     createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage,
 		bool useShadowBuffer)
@@ -75,10 +75,10 @@ namespace Ogre {
 			OGRE_LOCK_MUTEX(mVertexBuffersMutex)
 			mVertexBuffers.insert(vbuf);
 		}
-        return HardwareVertexBufferSharedPtr(vbuf);
+        return HardwareVertexBufferPtr(vbuf);
     }
     //-----------------------------------------------------------------------
-	HardwareIndexBufferSharedPtr 
+	HardwareIndexBufferPtr 
     D3D9HardwareBufferManagerBase::
     createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
         HardwareBuffer::Usage usage, bool useShadowBuffer)
@@ -107,7 +107,7 @@ namespace Ogre {
 			OGRE_LOCK_MUTEX(mIndexBuffersMutex)
 			mIndexBuffers.insert(idx);
 		}
-		return HardwareIndexBufferSharedPtr(idx);
+		return HardwareIndexBufferPtr(idx);
             
     }
     //-----------------------------------------------------------------------

+ 2 - 2
CamelotRenderer/OgreD3D9HardwareBufferManager.h

@@ -46,10 +46,10 @@ namespace Ogre {
         D3D9HardwareBufferManagerBase();
         ~D3D9HardwareBufferManagerBase();
         /// Creates a vertex buffer
-		HardwareVertexBufferSharedPtr 
+		HardwareVertexBufferPtr 
             createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer = false);
 		/// Create a hardware vertex buffer
-		HardwareIndexBufferSharedPtr 
+		HardwareIndexBufferPtr 
             createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer = false);
     };
 

+ 3 - 3
CamelotRenderer/OgreD3D9HardwarePixelBuffer.cpp

@@ -468,13 +468,13 @@ void D3D9HardwarePixelBuffer::unlockBuffer(BufferResources* bufferResources)
 }
 
 //-----------------------------------------------------------------------------  
-void D3D9HardwarePixelBuffer::blit(const HardwarePixelBufferSharedPtr &rsrc, 
+void D3D9HardwarePixelBuffer::blit(const HardwarePixelBufferPtr &rsrc, 
 								   const Box &srcBox, 
 								   const Box &dstBox)
 {
 	D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 
-	D3D9HardwarePixelBuffer *src = static_cast<D3D9HardwarePixelBuffer*>(rsrc.getPointer());
+	D3D9HardwarePixelBuffer *src = static_cast<D3D9HardwarePixelBuffer*>(rsrc.get());
 	DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
 
 	// Update all the buffer copies.
@@ -496,7 +496,7 @@ void D3D9HardwarePixelBuffer::blit(const HardwarePixelBufferSharedPtr &rsrc,
 
 //-----------------------------------------------------------------------------  
 void D3D9HardwarePixelBuffer::blit(IDirect3DDevice9* d3d9Device, 
-								   const HardwarePixelBufferSharedPtr &rsrc, 
+								   const HardwarePixelBufferPtr &rsrc, 
 								   const Box &srcBox, 
 								   const Box &dstBox,
 								   BufferResources* srcBufferResources, 

+ 2 - 2
CamelotRenderer/OgreD3D9HardwarePixelBuffer.h

@@ -93,7 +93,7 @@ namespace Ogre {
 		/// destroy render texture.
 		void destroyRenderTexture();
 
-		void blit(IDirect3DDevice9* d3d9Device, const HardwarePixelBufferSharedPtr &src,
+		void blit(IDirect3DDevice9* d3d9Device, const HardwarePixelBufferPtr &src,
 				const Box &srcBox, const Box &dstBox, 
 				BufferResources* srcBufferResources, 
 				BufferResources* dstBufferResources);
@@ -112,7 +112,7 @@ namespace Ogre {
 		void bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *mVolume, IDirect3DBaseTexture9 *mipTex);
 		
 		/// @copydoc HardwarePixelBuffer::blit
-        void blit(const HardwarePixelBufferSharedPtr &src, const Box &srcBox, const Box &dstBox);
+        void blit(const HardwarePixelBufferPtr &src, const Box &srcBox, const Box &dstBox);
 		
 		/// @copydoc HardwarePixelBuffer::blitFromMemory
 		void blitFromMemory(const PixelBox &src, const Box &dstBox);

+ 6 - 6
CamelotRenderer/OgreD3D9RenderSystem.cpp

@@ -1691,8 +1691,8 @@ namespace Ogre
 	void D3D9RenderSystem::_setTexture( size_t stage, bool enabled, const TexturePtr& tex )
 	{
 		HRESULT hr;
-		D3D9TexturePtr dt = tex;
-		if (enabled && !dt.isNull())
+		D3D9TexturePtr dt = std::static_pointer_cast<D3D9Texture>(tex);
+		if (enabled && (dt != nullptr))
 		{
 			IDirect3DBaseTexture9 *pTex = dt->getTexture();
 			if (mTexStageDesc[stage].pTex != pTex)
@@ -1748,7 +1748,7 @@ namespace Ogre
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::_setVertexTexture(size_t stage, const TexturePtr& tex)
 	{
-		if (tex.isNull())
+		if (tex == nullptr)
 		{
 
 			if (mTexStageDesc[stage].pVertexTex != 0)
@@ -1767,7 +1767,7 @@ namespace Ogre
 		}
 		else
 		{
-			D3D9TexturePtr dt = tex;
+			D3D9TexturePtr dt = std::static_pointer_cast<D3D9Texture>(tex);
 
 			IDirect3DBaseTexture9 *pTex = dt->getTexture();
 			if (mTexStageDesc[stage].pVertexTex != pTex)
@@ -3086,7 +3086,7 @@ namespace Ogre
 		switch(gptype)
 		{
 		case GPT_VERTEX_PROGRAM:
-			mActiveVertexGpuProgramParameters.setNull();
+			mActiveVertexGpuProgramParameters = nullptr;
 			hr = getActiveD3D9Device()->SetVertexShader(NULL);
 			if (FAILED(hr))
 			{
@@ -3095,7 +3095,7 @@ namespace Ogre
 			}
 			break;
 		case GPT_FRAGMENT_PROGRAM:
-			mActiveFragmentGpuProgramParameters.setNull();
+			mActiveFragmentGpuProgramParameters = nullptr;
 			hr = getActiveD3D9Device()->SetPixelShader(NULL);
 			if (FAILED(hr))
 			{

+ 5 - 5
CamelotRenderer/OgreD3D9Texture.cpp

@@ -1636,7 +1636,7 @@ namespace Ogre
 				for(size_t mip=0; mip<=mNumMipmaps; ++mip)
 				{
 					buffer = new D3D9HardwarePixelBuffer((HardwareBuffer::Usage)bufusage, this);
-					mSurfaceList.push_back(HardwarePixelBufferSharedPtr(buffer));
+					mSurfaceList.push_back(HardwarePixelBufferPtr(buffer));
 				}
 			}
 		}
@@ -1647,7 +1647,7 @@ namespace Ogre
 		case TEX_TYPE_2D:
 		case TEX_TYPE_1D:
 			assert(textureResources->pNormTex);
-			// For all mipmaps, store surfaces as HardwarePixelBufferSharedPtr
+			// For all mipmaps, store surfaces as HardwarePixelBufferPtr
 			for(mip=0; mip<=mNumMipmaps; ++mip)
 			{
 				if(textureResources->pNormTex->GetSurfaceLevel(static_cast<UINT>(mip), &surface) != D3D_OK)
@@ -1670,7 +1670,7 @@ namespace Ogre
 			break;
 		case TEX_TYPE_CUBE_MAP:
 			assert(textureResources->pCubeTex);
-			// For all faces and mipmaps, store surfaces as HardwarePixelBufferSharedPtr
+			// For all faces and mipmaps, store surfaces as HardwarePixelBufferPtr
 			for(face=0; face<6; ++face)
 			{
 				for(mip=0; mip<=mNumMipmaps; ++mip)
@@ -1696,7 +1696,7 @@ namespace Ogre
 			break;
 		case TEX_TYPE_3D:
 			assert(textureResources->pVolumeTex);
-			// For all mipmaps, store surfaces as HardwarePixelBufferSharedPtr
+			// For all mipmaps, store surfaces as HardwarePixelBufferPtr
 			for(mip=0; mip<=mNumMipmaps; ++mip)
 			{
 				if(textureResources->pVolumeTex->GetVolumeLevel(static_cast<UINT>(mip), &volume) != D3D_OK)
@@ -1719,7 +1719,7 @@ namespace Ogre
 	}
 	#undef GETLEVEL
 	/****************************************************************************************/
-	HardwarePixelBufferSharedPtr D3D9Texture::getBuffer(size_t face, size_t mipmap) 
+	HardwarePixelBufferPtr D3D9Texture::getBuffer(size_t face, size_t mipmap) 
 	{
 		if(face >= getNumFaces())
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "A three dimensional cube has six faces",

+ 3 - 47
CamelotRenderer/OgreD3D9Texture.h

@@ -34,7 +34,6 @@ THE SOFTWARE.
 #include "OgreException.h"
 #include "OgreD3D9HardwarePixelBuffer.h"
 #include "OgreD3D9Resource.h"
-#include "OgreSharedPtr.h"
 
 namespace Ogre {
 	class _OgreD3D9Export D3D9Texture : public Texture, public D3D9Resource
@@ -63,7 +62,7 @@ namespace Ogre {
 
 
 		/// Vector of pointers to subsurfaces
-		typedef vector<HardwarePixelBufferSharedPtr>::type SurfaceList;
+		typedef vector<HardwarePixelBufferPtr>::type SurfaceList;
 		SurfaceList	mSurfaceList;
 		/// cube texture individual face names
 		String							mCubeFaceNames[6];	
@@ -185,7 +184,7 @@ namespace Ogre {
 
 
 		/// @copydoc Texture::getBuffer
-		HardwarePixelBufferSharedPtr getBuffer(size_t face, size_t mipmap);
+		HardwarePixelBufferPtr getBuffer(size_t face, size_t mipmap);
 		
 		/// retrieves a pointer to the actual texture
 		IDirect3DBaseTexture9 *getTexture();		
@@ -219,50 +218,7 @@ namespace Ogre {
 		virtual void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device);	
     };
 
-    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to D3D9TexturePtr 
-    @note Has to be a subclass since we need operator=.
-    We could templatise this instead of repeating per Resource subclass, 
-    except to do so requires a form VC6 does not support i.e.
-    ResourceSubclassPtr<T> : public SharedPtr<T>
-    */
-    class _OgreD3D9Export D3D9TexturePtr : public SharedPtr<D3D9Texture> 
-    {
-    public:
-        D3D9TexturePtr() : SharedPtr<D3D9Texture>() {}
-        explicit D3D9TexturePtr(D3D9Texture* rep) : SharedPtr<D3D9Texture>(rep) {}
-        D3D9TexturePtr(const D3D9TexturePtr& r) : SharedPtr<D3D9Texture>(r) {} 
-		D3D9TexturePtr(const TexturePtr& r) : SharedPtr<D3D9Texture>()
-		{
-			*this = r;
-		}
-
-        /// Operator used to convert a TexturePtr to a D3D9TexturePtr
-        D3D9TexturePtr& operator=(const TexturePtr& r)
-        {
-            if (pRep == static_cast<D3D9Texture*>(r.getPointer()))
-                return *this;
-            release();
-			// lock & copy other mutex pointer
-            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
-            {
-			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
-			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
-                pRep = static_cast<D3D9Texture*>(r.getPointer());
-                pUseCount = r.useCountPointer();
-                if (pUseCount)
-                {
-                    ++(*pUseCount);
-                }
-            }
-			else
-			{
-				// RHS must be a null pointer
-				assert(r.isNull() && "RHS must be null if it has no mutex!");
-				setNull();
-			}
-            return *this;
-        }
-    };
+	typedef std::shared_ptr<D3D9Texture> D3D9TexturePtr;
 
     /// RenderTexture implementation for D3D9
     class _OgreD3D9Export D3D9RenderTexture : public RenderTexture

+ 4 - 4
CamelotRenderer/OgreDefaultHardwareBufferManager.cpp

@@ -151,19 +151,19 @@ namespace Ogre {
         destroyAllBindings(); 
 	}
     //-----------------------------------------------------------------------
-	HardwareVertexBufferSharedPtr 
+	HardwareVertexBufferPtr 
         DefaultHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize, 
 		size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
 	{
         DefaultHardwareVertexBuffer* vb = OGRE_NEW DefaultHardwareVertexBuffer(this, vertexSize, numVerts, usage);
-        return HardwareVertexBufferSharedPtr(vb);
+        return HardwareVertexBufferPtr(vb);
 	}
     //-----------------------------------------------------------------------
-	HardwareIndexBufferSharedPtr 
+	HardwareIndexBufferPtr 
         DefaultHardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype, 
 		size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer)
 	{
         DefaultHardwareIndexBuffer* ib = OGRE_NEW DefaultHardwareIndexBuffer(itype, numIndexes, usage);
-		return HardwareIndexBufferSharedPtr(ib);
+		return HardwareIndexBufferPtr(ib);
 	}
 }

+ 2 - 2
CamelotRenderer/OgreDefaultHardwareBufferManager.h

@@ -106,11 +106,11 @@ namespace Ogre {
         DefaultHardwareBufferManagerBase();
         ~DefaultHardwareBufferManagerBase();
         /// Creates a vertex buffer
-		HardwareVertexBufferSharedPtr 
+		HardwareVertexBufferPtr 
             createVertexBuffer(size_t vertexSize, size_t numVerts, 
 				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
 		/// Create a hardware vertex buffer
-		HardwareIndexBufferSharedPtr 
+		HardwareIndexBufferPtr 
             createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
 				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
     };

+ 1 - 1
CamelotRenderer/OgreFrustum.cpp

@@ -618,7 +618,7 @@ namespace Ogre {
             // 0 is the origin
             // 1, 2, 3, 4 are the points on the near plane, top left first, clockwise
             // 5, 6, 7, 8 are the points on the far plane, top left first, clockwise
-            HardwareVertexBufferSharedPtr vbuf = mVertexData.vertexBufferBinding->getBuffer(0);
+            HardwareVertexBufferPtr vbuf = mVertexData.vertexBufferBinding->getBuffer(0);
             float* pFloat = static_cast<float*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
 
             // near plane (remember frustum is going in -Z direction)

+ 7 - 36
CamelotRenderer/OgreGpuProgram.cpp

@@ -93,7 +93,7 @@ namespace Ogre
 		{
 			loadFromSource();
 
-			assert(mDefaultParams.isNull());
+			assert(mDefaultParams == nullptr);
 
 			mDefaultParams = createParameters();
 		}
@@ -151,15 +151,15 @@ namespace Ogre
 	//---------------------------------------------------------------------
 	void GpuProgram::createLogicalParameterMappingStructures(bool recreateIfExists) const
 	{
-		if (recreateIfExists || mFloatLogicalToPhysical.isNull())
+		if (recreateIfExists || (mFloatLogicalToPhysical == nullptr))
 			mFloatLogicalToPhysical = GpuLogicalBufferStructPtr(OGRE_NEW GpuLogicalBufferStruct());
-		if (recreateIfExists || mIntLogicalToPhysical.isNull())
+		if (recreateIfExists || (mIntLogicalToPhysical == nullptr))
 			mIntLogicalToPhysical = GpuLogicalBufferStructPtr(OGRE_NEW GpuLogicalBufferStruct());
 	}
 	//---------------------------------------------------------------------
 	void GpuProgram::createNamedParameterMappingStructures(bool recreateIfExists) const
 	{
-		if (recreateIfExists || mConstantDefs.isNull())
+		if (recreateIfExists || (mConstantDefs == nullptr))
 			mConstantDefs = GpuNamedConstantsPtr(OGRE_NEW GpuNamedConstants());
 	}
 	//---------------------------------------------------------------------
@@ -209,7 +209,7 @@ namespace Ogre
         GpuProgramParametersSharedPtr ret = GpuProgramParametersSharedPtr(OGRE_NEW GpuProgramParameters());	
 		
 		// set up named parameters, if any
-		if (!mConstantDefs.isNull() && !mConstantDefs->map.empty())
+		if ((mConstantDefs != nullptr) && !mConstantDefs->map.empty())
 		{
 			ret->_setNamedConstants(mConstantDefs);
 		}
@@ -217,7 +217,7 @@ namespace Ogre
 		ret->_setLogicalIndexes(mFloatLogicalToPhysical, mIntLogicalToPhysical);
 
         // Copy in default parameters if present
-        if (!mDefaultParams.isNull())
+        if (mDefaultParams != nullptr)
             ret->copyConstantsFrom(*(mDefaultParams.get()));
         
         return ret;
@@ -225,7 +225,7 @@ namespace Ogre
     //-----------------------------------------------------------------------------
     GpuProgramParametersSharedPtr GpuProgram::getDefaultParameters(void)
     {
-        if (mDefaultParams.isNull())
+        if (mDefaultParams == nullptr)
         {
             mDefaultParams = createParameters();
         }
@@ -386,34 +386,5 @@ namespace Ogre
 		GpuProgram* t = static_cast<GpuProgram*>(target);
 		t->setAdjacencyInfoRequired(StringConverter::parseBool(val));
 	}
-
-    //-----------------------------------------------------------------------
-    GpuProgramPtr& GpuProgramPtr::operator=(const HighLevelGpuProgramPtr& r)
-    {
-        // Can assign direct
-        if (pRep == r.getPointer())
-            return *this;
-        release();
-		// lock & copy other mutex pointer
-        OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
-        {
-		    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
-		    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
-            pRep = r.getPointer();
-            pUseCount = r.useCountPointer();
-            if (pUseCount)
-            {
-                ++(*pUseCount);
-            }
-        }
-		else
-		{
-			// RHS must be a null pointer
-			assert(r.isNull() && "RHS must be null if it has no mutex!");
-			setNull();
-		}
-        return *this;
-    }
-
 }
 

+ 1 - 23
CamelotRenderer/OgreGpuProgram.h

@@ -30,7 +30,6 @@ THE SOFTWARE.
 
 // Precompiler options
 #include "OgrePrerequisites.h"
-#include "OgreSharedPtr.h"
 #include "OgreRenderOperation.h"
 #include "OgreStringInterface.h"
 #include "OgreGpuProgramParams.h"
@@ -68,9 +67,6 @@ namespace Ogre {
 		GPP_VS_3_0
 	};
 
-    // Forward declaration 
-    class GpuProgramPtr;
-
 	/** Defines a program which runs on the GPU such as a vertex or fragment program. 
 	@remarks
 		This class defines the low-level program in assembler code, the sort used to
@@ -360,7 +356,7 @@ namespace Ogre {
 
         /** Returns true if default parameters have been set up.  
         */
-        virtual bool hasDefaultParameters(void) const { return !mDefaultParams.isNull(); }
+        virtual bool hasDefaultParameters(void) const { return mDefaultParams != nullptr; }
 
 		/** Returns whether a vertex program wants light and material states to be passed
 		through fixed pipeline low level API rendering calls (default false, subclasses can override)
@@ -445,24 +441,6 @@ namespace Ogre {
 
 	};
 
-
-	/** Specialisation of SharedPtr to allow SharedPtr to be assigned to GpuProgramPtr 
-	@note Has to be a subclass since we need operator=.
-	We could templatise this instead of repeating per Resource subclass, 
-	except to do so requires a form VC6 does not support i.e.
-	ResourceSubclassPtr<T> : public SharedPtr<T>
-	*/
-	class _OgreExport GpuProgramPtr : public SharedPtr<GpuProgram> 
-	{
-	public:
-		GpuProgramPtr() : SharedPtr<GpuProgram>() {}
-		explicit GpuProgramPtr(GpuProgram* rep) : SharedPtr<GpuProgram>(rep) {}
-		GpuProgramPtr(const GpuProgramPtr& r) : SharedPtr<GpuProgram>(r) {} 
-
-        /// Operator used to convert a HighLevelGpuProgramPtr to a GpuProgramPtr
-        GpuProgramPtr& operator=(const HighLevelGpuProgramPtr& r);
-	};
-	/** @} */
 	/** @} */
 }
 

+ 17 - 17
CamelotRenderer/OgreGpuProgramParams.cpp

@@ -650,12 +650,12 @@ namespace Ogre
 		// set has set some parameters
 
 		// Size and reset buffer (fill with zero to make comparison later ok)
-		if (!floatIndexMap.isNull() && floatIndexMap->bufferSize > mFloatConstants.size())
+		if ((floatIndexMap != nullptr) && floatIndexMap->bufferSize > mFloatConstants.size())
 		{
 			mFloatConstants.insert(mFloatConstants.end(), 
 				floatIndexMap->bufferSize - mFloatConstants.size(), 0.0f);
 		}
-		if (!intIndexMap.isNull() &&  intIndexMap->bufferSize > mIntConstants.size())
+		if ((intIndexMap != nullptr) &&  intIndexMap->bufferSize > mIntConstants.size())
 		{
 			mIntConstants.insert(mIntConstants.end(), 
 				intIndexMap->bufferSize - mIntConstants.size(), 0);
@@ -722,7 +722,7 @@ namespace Ogre
 		// Raw buffer size is 4x count
 		size_t rawCount = count * 4;
 		// get physical index
-		assert(!mFloatLogicalToPhysical.isNull() && "GpuProgram hasn't set up the logical -> physical map!");
+		assert((mFloatLogicalToPhysical != nullptr) && "GpuProgram hasn't set up the logical -> physical map!");
 
 		size_t physicalIndex = _getFloatConstantPhysicalIndex(index, rawCount, GPV_GLOBAL);
 
@@ -736,7 +736,7 @@ namespace Ogre
 		// Raw buffer size is 4x count
 		size_t rawCount = count * 4;
 		// get physical index
-		assert(!mFloatLogicalToPhysical.isNull() && "GpuProgram hasn't set up the logical -> physical map!");
+		assert((mFloatLogicalToPhysical != nullptr) && "GpuProgram hasn't set up the logical -> physical map!");
 
 		size_t physicalIndex = _getFloatConstantPhysicalIndex(index, rawCount, GPV_GLOBAL);
 		assert(physicalIndex + rawCount <= mFloatConstants.size());
@@ -754,7 +754,7 @@ namespace Ogre
 		// Raw buffer size is 4x count
 		size_t rawCount = count * 4;
 		// get physical index
-		assert(!mIntLogicalToPhysical.isNull() && "GpuProgram hasn't set up the logical -> physical map!");
+		assert((mIntLogicalToPhysical != nullptr) && "GpuProgram hasn't set up the logical -> physical map!");
 
 		size_t physicalIndex = _getIntConstantPhysicalIndex(index, rawCount, GPV_GLOBAL);
 		// Copy 
@@ -1019,7 +1019,7 @@ namespace Ogre
 	GpuLogicalIndexUse* GpuProgramParameters::_getFloatConstantLogicalIndexUse(
 		size_t logicalIndex, size_t requestedSize, uint16 variability)
 	{
-		if (mFloatLogicalToPhysical.isNull())
+		if (mFloatLogicalToPhysical == nullptr)
 			return 0;
 
 		GpuLogicalIndexUse* indexUse = 0;
@@ -1100,7 +1100,7 @@ namespace Ogre
 						i->physicalIndex += insertCount;
 					}
 				}
-				if (!mNamedConstants.isNull())
+				if (mNamedConstants != nullptr)
 				{
 					for (GpuConstantDefinitionMap::iterator i = mNamedConstants->map.begin();
 						i != mNamedConstants->map.end(); ++i)
@@ -1124,7 +1124,7 @@ namespace Ogre
 	//---------------------------------------------------------------------()
 	GpuLogicalIndexUse* GpuProgramParameters::_getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
 	{
-		if (mIntLogicalToPhysical.isNull())
+		if (mIntLogicalToPhysical == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This is not a low-level parameter parameter object",
 			"GpuProgramParameters::_getIntConstantPhysicalIndex");
@@ -1206,7 +1206,7 @@ namespace Ogre
 						i->physicalIndex += insertCount;
 					}
 				}
-				if (!mNamedConstants.isNull())
+				if (mNamedConstants != nullptr)
 				{
 					for (GpuConstantDefinitionMap::iterator i = mNamedConstants->map.begin();
 						i != mNamedConstants->map.end(); ++i)
@@ -1270,7 +1270,7 @@ namespace Ogre
 	//-----------------------------------------------------------------------------
 	GpuConstantDefinitionIterator GpuProgramParameters::getConstantDefinitionIterator(void) const
 	{
-		if (mNamedConstants.isNull())
+		if (mNamedConstants == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This params object is not based on a program with named parameters.",
 			"GpuProgramParameters::getConstantDefinitionIterator");
@@ -1281,7 +1281,7 @@ namespace Ogre
 	//-----------------------------------------------------------------------------
 	const GpuNamedConstants& GpuProgramParameters::getConstantDefinitions() const
 	{
-		if (mNamedConstants.isNull())
+		if (mNamedConstants == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This params object is not based on a program with named parameters.",
 			"GpuProgramParameters::getConstantDefinitionIterator");
@@ -1291,7 +1291,7 @@ namespace Ogre
 	//-----------------------------------------------------------------------------
 	const GpuConstantDefinition& GpuProgramParameters::getConstantDefinition(const String& name) const
 	{
-		if (mNamedConstants.isNull())
+		if (mNamedConstants == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This params object is not based on a program with named parameters.",
 			"GpuProgramParameters::getConstantDefinitionIterator");
@@ -1308,7 +1308,7 @@ namespace Ogre
 		GpuProgramParameters::_findNamedConstantDefinition(const String& name, 
 		bool throwExceptionIfNotFound) const
 	{
-		if (mNamedConstants.isNull())
+		if (mNamedConstants == nullptr)
 		{
 			if (throwExceptionIfNotFound)
 				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
@@ -1667,7 +1667,7 @@ namespace Ogre
 	const GpuProgramParameters::AutoConstantEntry* 
 		GpuProgramParameters::findFloatAutoConstantEntry(size_t logicalIndex)
 	{
-		if (mFloatLogicalToPhysical.isNull())
+		if (mFloatLogicalToPhysical == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This is not a low-level parameter parameter object",
 			"GpuProgramParameters::findFloatAutoConstantEntry");
@@ -1680,7 +1680,7 @@ namespace Ogre
 	const GpuProgramParameters::AutoConstantEntry* 
 		GpuProgramParameters::findIntAutoConstantEntry(size_t logicalIndex)
 	{
-		if (mIntLogicalToPhysical.isNull())
+		if (mIntLogicalToPhysical == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This is not a low-level parameter parameter object",
 			"GpuProgramParameters::findIntAutoConstantEntry");
@@ -1694,7 +1694,7 @@ namespace Ogre
 	const GpuProgramParameters::AutoConstantEntry* 
 		GpuProgramParameters::findAutoConstantEntry(const String& paramName)
 	{
-		if (mNamedConstants.isNull())
+		if (mNamedConstants == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			"This params object is not based on a program with named parameters.",
 			"GpuProgramParameters::findAutoConstantEntry");
@@ -1747,7 +1747,7 @@ namespace Ogre
 	//---------------------------------------------------------------------
 	void GpuProgramParameters::copyMatchingNamedConstantsFrom(const GpuProgramParameters& source)
 	{
-		if (!mNamedConstants.isNull() && !source.mNamedConstants.isNull())
+		if ((mNamedConstants != nullptr) && (source.mNamedConstants != nullptr))
 		{
 			std::map<size_t, String> srcToDestNamedMap;
 			for (GpuConstantDefinitionMap::const_iterator i = source.mNamedConstants->map.begin(); 

+ 6 - 7
CamelotRenderer/OgreGpuProgramParams.h

@@ -30,7 +30,6 @@ THE SOFTWARE.
 
 // Precompiler options
 #include "OgrePrerequisites.h"
-#include "OgreSharedPtr.h"
 #include "OgreRenderOperation.h"
 
 namespace Ogre {
@@ -303,7 +302,7 @@ namespace Ogre {
 		*/
 		static bool msGenerateAllConstantDefinitionArrayEntries;
 	};
-	typedef SharedPtr<GpuNamedConstants> GpuNamedConstantsPtr;
+	typedef std::shared_ptr<GpuNamedConstants> GpuNamedConstantsPtr;
 
 	/** Structure recording the use of a physical buffer by a logical parameter
 	index. Only used for low-level programs.
@@ -333,7 +332,7 @@ namespace Ogre {
 		size_t bufferSize;
 		GpuLogicalBufferStruct() : bufferSize(0) {}
 	};
-	typedef SharedPtr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
+	typedef std::shared_ptr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
 
 	/** Definition of container that holds the current float constants.
 	@note Not necessarily in direct index order to constant indexes, logical
@@ -458,7 +457,7 @@ namespace Ogre {
 	};
 
 	/// Shared pointer used to hold references to GpuProgramParameters instances
-	typedef SharedPtr<GpuSharedParameters> GpuSharedParametersPtr;
+	typedef std::shared_ptr<GpuSharedParameters> GpuSharedParametersPtr;
 
 	class GpuProgramParameters;
 
@@ -1123,13 +1122,13 @@ namespace Ogre {
 
 
 		/// Does this parameter set include named parameters?
-		bool hasNamedParameters() const { return !mNamedConstants.isNull(); }
+		bool hasNamedParameters() const { return mNamedConstants != nullptr; }
 		/** Does this parameter set include logically indexed parameters?
 		@note Not mutually exclusive with hasNamedParameters since some high-level
 		programs still use logical indexes to set the parameters on the 
 		rendersystem.
 		*/
-		bool hasLogicalIndexedParameters() const { return !mFloatLogicalToPhysical.isNull(); }
+		bool hasLogicalIndexedParameters() const { return mFloatLogicalToPhysical != nullptr; }
 
 		/** Sets a 4-element floating-point parameter to the program.
 		@param index The logical constant index at which to place the parameter 
@@ -1761,7 +1760,7 @@ namespace Ogre {
 	};
 
 	/// Shared pointer used to hold references to GpuProgramParameters instances
-	typedef SharedPtr<GpuProgramParameters> GpuProgramParametersSharedPtr;
+	typedef std::shared_ptr<GpuProgramParameters> GpuProgramParametersSharedPtr;
 
 	/** @} */
 	/** @} */

+ 28 - 28
CamelotRenderer/OgreHardwareBufferManager.cpp

@@ -152,8 +152,8 @@ namespace Ogre {
     }
 	//-----------------------------------------------------------------------
     void HardwareBufferManagerBase::registerVertexBufferSourceAndCopy(
-			const HardwareVertexBufferSharedPtr& sourceBuffer,
-			const HardwareVertexBufferSharedPtr& copy)
+			const HardwareVertexBufferPtr& sourceBuffer,
+			const HardwareVertexBufferPtr& copy)
 	{
 		OGRE_LOCK_MUTEX(mTempBuffersMutex)
 		// Add copy to free temporary vertex buffers
@@ -161,9 +161,9 @@ namespace Ogre {
             FreeTemporaryVertexBufferMap::value_type(sourceBuffer.get(), copy));
 	}
 	//-----------------------------------------------------------------------
-    HardwareVertexBufferSharedPtr 
+    HardwareVertexBufferPtr 
     HardwareBufferManagerBase::allocateVertexBufferCopy(
-        const HardwareVertexBufferSharedPtr& sourceBuffer, 
+        const HardwareVertexBufferPtr& sourceBuffer, 
         BufferLicenseType licenseType, HardwareBufferLicensee* licensee,
         bool copyData)
     {
@@ -174,7 +174,7 @@ namespace Ogre {
 		OGRE_LOCK_MUTEX(mVertexBuffersMutex)
 		{
 			OGRE_LOCK_MUTEX(mTempBuffersMutex)
-			HardwareVertexBufferSharedPtr vbuf;
+			HardwareVertexBufferPtr vbuf;
 
 			// Locate existing buffer copy in temporary vertex buffers
 			FreeTemporaryVertexBufferMap::iterator i = 
@@ -211,7 +211,7 @@ namespace Ogre {
     }
     //-----------------------------------------------------------------------
     void HardwareBufferManagerBase::releaseVertexBufferCopy(
-        const HardwareVertexBufferSharedPtr& bufferCopy)
+        const HardwareVertexBufferPtr& bufferCopy)
     {
 		OGRE_LOCK_MUTEX(mTempBuffersMutex)
 
@@ -230,7 +230,7 @@ namespace Ogre {
     }
     //-----------------------------------------------------------------------
     void HardwareBufferManagerBase::touchVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& bufferCopy)
+            const HardwareVertexBufferPtr& bufferCopy)
     {
 		OGRE_LOCK_MUTEX(mTempBuffersMutex)
         TemporaryVertexBufferLicenseMap::iterator i =
@@ -258,7 +258,7 @@ namespace Ogre {
             // Free the temporary buffer that referenced by ourself only.
             // TODO: Some temporary buffers are bound to vertex buffer bindings
             // but not checked out, need to sort out method to unbind them.
-            if (icur->second.useCount() <= 1)
+            if (icur->second.use_count() <= 1)
             {
                 ++numFreed;
                 mFreeTempVertexBufferMap.erase(icur);
@@ -330,7 +330,7 @@ namespace Ogre {
     }
     //-----------------------------------------------------------------------
     void HardwareBufferManagerBase::_forceReleaseBufferCopies(
-        const HardwareVertexBufferSharedPtr& sourceBuffer)
+        const HardwareVertexBufferPtr& sourceBuffer)
     {
         _forceReleaseBufferCopies(sourceBuffer.get());
     }
@@ -374,10 +374,10 @@ namespace Ogre {
         std::pair<_Iter, _Iter> range = mFreeTempVertexBufferMap.equal_range(sourceBuffer);
         if (range.first != range.second)
         {
-            list<HardwareVertexBufferSharedPtr>::type holdForDelayDestroy;
+            list<HardwareVertexBufferPtr>::type holdForDelayDestroy;
             for (_Iter it = range.first; it != range.second; ++it)
             {
-                if (it->second.useCount() <= 1)
+                if (it->second.use_count() <= 1)
                 {
                     holdForDelayDestroy.push_back(it->second);
                 }
@@ -413,9 +413,9 @@ namespace Ogre {
 		}
 	}
     //-----------------------------------------------------------------------
-    HardwareVertexBufferSharedPtr 
+    HardwareVertexBufferPtr 
     HardwareBufferManagerBase::makeBufferCopy(
-        const HardwareVertexBufferSharedPtr& source,
+        const HardwareVertexBufferPtr& source,
         HardwareBuffer::Usage usage, bool useShadowBuffer)
     {
         return this->createVertexBuffer(
@@ -429,9 +429,9 @@ namespace Ogre {
     TempBlendedBufferInfo::~TempBlendedBufferInfo(void)
     {
         // check that temp buffers have been released
-        if (!destPositionBuffer.isNull())
+        if (destPositionBuffer != nullptr)
             destPositionBuffer->getManager()->releaseVertexBufferCopy(destPositionBuffer);
-        if (!destNormalBuffer.isNull())
+        if (destNormalBuffer != nullptr)
             destNormalBuffer->getManager()->releaseVertexBufferCopy(destNormalBuffer);
 
     }
@@ -439,15 +439,15 @@ namespace Ogre {
     void TempBlendedBufferInfo::extractFrom(const VertexData* sourceData)
     {
         // Release old buffer copies first
-        if (!destPositionBuffer.isNull())
+        if (destPositionBuffer != nullptr)
         {
             destPositionBuffer->getManager()->releaseVertexBufferCopy(destPositionBuffer);
-            assert(destPositionBuffer.isNull());
+            assert(destPositionBuffer == nullptr);
         }
-        if (!destNormalBuffer.isNull())
+        if (destNormalBuffer != nullptr)
         {
             destNormalBuffer->getManager()->releaseVertexBufferCopy(destNormalBuffer);
-            assert(destNormalBuffer.isNull());
+            assert(destNormalBuffer == nullptr);
         }
 
         VertexDeclaration* decl = sourceData->vertexDeclaration;
@@ -463,7 +463,7 @@ namespace Ogre {
         if (!normElem)
         {
             posNormalShareBuffer = false;
-            srcNormalBuffer.setNull();
+            srcNormalBuffer = nullptr;
         }
         else
         {
@@ -471,7 +471,7 @@ namespace Ogre {
             if (normBindIndex == posBindIndex)
             {
                 posNormalShareBuffer = true;
-                srcNormalBuffer.setNull();
+                srcNormalBuffer = nullptr;
             }
             else
             {
@@ -486,12 +486,12 @@ namespace Ogre {
         bindPositions = positions;
         bindNormals = normals;
 
-        if (positions && destPositionBuffer.isNull())
+        if (positions && destPositionBuffer == nullptr)
         {
             destPositionBuffer = srcPositionBuffer->getManager()->allocateVertexBufferCopy(srcPositionBuffer, 
                 HardwareBufferManagerBase::BLT_AUTOMATIC_RELEASE, this);
         }
-        if (normals && !posNormalShareBuffer && !srcNormalBuffer.isNull() && destNormalBuffer.isNull())
+        if (normals && !posNormalShareBuffer && (srcNormalBuffer != nullptr) && (destNormalBuffer == nullptr))
         {
             destNormalBuffer = srcNormalBuffer->getManager()->allocateVertexBufferCopy(srcNormalBuffer, 
                 HardwareBufferManagerBase::BLT_AUTOMATIC_RELEASE, this);
@@ -502,7 +502,7 @@ namespace Ogre {
 	{
         if (positions || (normals && posNormalShareBuffer))
         {
-            if (destPositionBuffer.isNull())
+            if (destPositionBuffer == nullptr)
                 return false;
 
             destPositionBuffer->getManager()->touchVertexBufferCopy(destPositionBuffer);
@@ -510,7 +510,7 @@ namespace Ogre {
 
         if (normals && !posNormalShareBuffer)
         {
-            if (destNormalBuffer.isNull())
+            if (destNormalBuffer == nullptr)
                 return false;
 
             destNormalBuffer->getManager()->touchVertexBufferCopy(destNormalBuffer);
@@ -524,7 +524,7 @@ namespace Ogre {
         this->destPositionBuffer->suppressHardwareUpdate(suppressHardwareUpload);
         targetData->vertexBufferBinding->setBinding(
             this->posBindIndex, this->destPositionBuffer);
-        if (bindNormals && !posNormalShareBuffer && !destNormalBuffer.isNull())
+        if (bindNormals && !posNormalShareBuffer && (destNormalBuffer != nullptr))
         {
             this->destNormalBuffer->suppressHardwareUpdate(suppressHardwareUpload);
             targetData->vertexBufferBinding->setBinding(
@@ -538,9 +538,9 @@ namespace Ogre {
             || buffer == destNormalBuffer.get());
 
         if (buffer == destPositionBuffer.get())
-            destPositionBuffer.setNull();
+            destPositionBuffer = nullptr;
         if (buffer == destNormalBuffer.get())
-            destNormalBuffer.setNull();
+            destNormalBuffer = nullptr;
 
     }
 

+ 27 - 31
CamelotRenderer/OgreHardwareBufferManager.h

@@ -67,11 +67,11 @@ namespace Ogre {
     {
     private:
         // Pre-blended 
-        HardwareVertexBufferSharedPtr srcPositionBuffer;
-        HardwareVertexBufferSharedPtr srcNormalBuffer;
+        HardwareVertexBufferPtr srcPositionBuffer;
+        HardwareVertexBufferPtr srcNormalBuffer;
         // Post-blended 
-        HardwareVertexBufferSharedPtr destPositionBuffer;
-        HardwareVertexBufferSharedPtr destNormalBuffer;
+        HardwareVertexBufferPtr destPositionBuffer;
+        HardwareVertexBufferPtr destNormalBuffer;
         /// Both positions and normals are contained in the same buffer
         bool posNormalShareBuffer;
         unsigned short posBindIndex;
@@ -107,8 +107,6 @@ namespace Ogre {
 	*/
 	class _OgreExport HardwareBufferManagerBase
 	{
-        friend class HardwareVertexBufferSharedPtr;
-        friend class HardwareIndexBufferSharedPtr;
     protected:
         /** WARNING: The following two members should place before all other members.
             Members destruct order is very important here, because destructing other
@@ -165,13 +163,13 @@ namespace Ogre {
             HardwareVertexBuffer* originalBufferPtr;
             BufferLicenseType licenseType;
             size_t expiredDelay;
-            HardwareVertexBufferSharedPtr buffer;
+            HardwareVertexBufferPtr buffer;
             HardwareBufferLicensee* licensee;
             VertexBufferLicense(
                 HardwareVertexBuffer* orig,
                 BufferLicenseType ltype, 
                 size_t delay,
-                HardwareVertexBufferSharedPtr buf, 
+                HardwareVertexBufferPtr buf, 
                 HardwareBufferLicensee* lic) 
                 : originalBufferPtr(orig)
                 , licenseType(ltype)
@@ -183,7 +181,7 @@ namespace Ogre {
         };
 
         /// Map from original buffer to temporary buffers
-        typedef multimap<HardwareVertexBuffer*, HardwareVertexBufferSharedPtr>::type FreeTemporaryVertexBufferMap;
+        typedef multimap<HardwareVertexBuffer*, HardwareVertexBufferPtr>::type FreeTemporaryVertexBufferMap;
         /// Map of current available temp buffers 
         FreeTemporaryVertexBufferMap mFreeTempVertexBufferMap;
         /// Map from temporary buffer to details of a license
@@ -201,8 +199,8 @@ namespace Ogre {
 
 
         /// Creates  a new buffer as a copy of the source, does not copy data
-        virtual HardwareVertexBufferSharedPtr makeBufferCopy(
-            const HardwareVertexBufferSharedPtr& source, 
+        virtual HardwareVertexBufferPtr makeBufferCopy(
+            const HardwareVertexBufferPtr& source, 
             HardwareBuffer::Usage usage, bool useShadowBuffer);
 
     public:
@@ -236,7 +234,7 @@ namespace Ogre {
             reads and writes will be done to the shadow buffer, and the shadow buffer will
             be synchronised with the real buffer at an appropriate time.
         */
-		virtual HardwareVertexBufferSharedPtr 
+		virtual HardwareVertexBufferPtr 
             createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, 
 			bool useShadowBuffer = false) = 0;
 		/** Create a hardware index buffer.
@@ -255,7 +253,7 @@ namespace Ogre {
             reads and writes will be done to the shadow buffer, and the shadow buffer will
             be synchronised with the real buffer at an appropriate time.
         */
-		virtual HardwareIndexBufferSharedPtr 
+		virtual HardwareIndexBufferPtr 
             createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
 			HardwareBuffer::Usage usage, bool useShadowBuffer = false) = 0;
 
@@ -275,8 +273,8 @@ namespace Ogre {
 			which can be allocated just like a copy.
 		*/
 		virtual void registerVertexBufferSourceAndCopy(
-			const HardwareVertexBufferSharedPtr& sourceBuffer,
-			const HardwareVertexBufferSharedPtr& copy);
+			const HardwareVertexBufferPtr& sourceBuffer,
+			const HardwareVertexBufferPtr& copy);
 
         /** Allocates a copy of a given vertex buffer.
         @remarks
@@ -294,8 +292,8 @@ namespace Ogre {
         @param copyData If true, the current data is copied as well as the 
             structure of the buffer
         */
-        virtual HardwareVertexBufferSharedPtr allocateVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& sourceBuffer, 
+        virtual HardwareVertexBufferPtr allocateVertexBufferCopy(
+            const HardwareVertexBufferPtr& sourceBuffer, 
             BufferLicenseType licenseType,
             HardwareBufferLicensee* licensee,
             bool copyData = false);
@@ -309,7 +307,7 @@ namespace Ogre {
             well begin to modify the contents of the buffer.
         */
         virtual void releaseVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& bufferCopy); 
+            const HardwareVertexBufferPtr& bufferCopy); 
 
         /** Tell engine that the vertex buffer copy intent to reuse.
         @remarks
@@ -322,7 +320,7 @@ namespace Ogre {
             buffer copy for use.
         */
         virtual void touchVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& bufferCopy);
+            const HardwareVertexBufferPtr& bufferCopy);
 
         /** Free all unused vertex buffer copies.
         @remarks
@@ -353,7 +351,7 @@ namespace Ogre {
             are deleted.
         */
         virtual void _forceReleaseBufferCopies(
-            const HardwareVertexBufferSharedPtr& sourceBuffer);
+            const HardwareVertexBufferPtr& sourceBuffer);
 
         /** Internal method that forces the release of copies of a given buffer.
         @remarks
@@ -376,8 +374,6 @@ namespace Ogre {
     /** Singleton wrapper for hardware buffer manager. */
     class _OgreExport HardwareBufferManager : public HardwareBufferManagerBase, public Singleton<HardwareBufferManager>
     {
-        friend class HardwareVertexBufferSharedPtr;
-        friend class HardwareIndexBufferSharedPtr;
     protected:
 		HardwareBufferManagerBase* mImpl;
 	public:
@@ -385,14 +381,14 @@ namespace Ogre {
 		~HardwareBufferManager();
 
 		/** @copydoc HardwareBufferManagerInterface::createVertexBuffer */
-		HardwareVertexBufferSharedPtr 
+		HardwareVertexBufferPtr 
             createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, 
 			bool useShadowBuffer = false)
 		{
 			return mImpl->createVertexBuffer(vertexSize, numVerts, usage, useShadowBuffer);
 		}
 		/** @copydoc HardwareBufferManagerInterface::createIndexBuffer */
-		HardwareIndexBufferSharedPtr 
+		HardwareIndexBufferPtr 
             createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
 			HardwareBuffer::Usage usage, bool useShadowBuffer = false)
 		{
@@ -422,14 +418,14 @@ namespace Ogre {
 		}
 		/** @copydoc HardwareBufferManagerInterface::registerVertexBufferSourceAndCopy */
 		virtual void registerVertexBufferSourceAndCopy(
-			const HardwareVertexBufferSharedPtr& sourceBuffer,
-			const HardwareVertexBufferSharedPtr& copy)
+			const HardwareVertexBufferPtr& sourceBuffer,
+			const HardwareVertexBufferPtr& copy)
 		{
 			mImpl->registerVertexBufferSourceAndCopy(sourceBuffer, copy);
 		}
 		/** @copydoc HardwareBufferManagerInterface::allocateVertexBufferCopy */
-        virtual HardwareVertexBufferSharedPtr allocateVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& sourceBuffer, 
+        virtual HardwareVertexBufferPtr allocateVertexBufferCopy(
+            const HardwareVertexBufferPtr& sourceBuffer, 
             BufferLicenseType licenseType,
             HardwareBufferLicensee* licensee,
             bool copyData = false)
@@ -438,14 +434,14 @@ namespace Ogre {
 		}
 		/** @copydoc HardwareBufferManagerInterface::releaseVertexBufferCopy */
         virtual void releaseVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& bufferCopy)
+            const HardwareVertexBufferPtr& bufferCopy)
 		{
 			mImpl->releaseVertexBufferCopy(bufferCopy);
 		}
 
 		/** @copydoc HardwareBufferManagerInterface::touchVertexBufferCopy */
         virtual void touchVertexBufferCopy(
-            const HardwareVertexBufferSharedPtr& bufferCopy)
+            const HardwareVertexBufferPtr& bufferCopy)
 		{
 			mImpl->touchVertexBufferCopy(bufferCopy);
 		}
@@ -462,7 +458,7 @@ namespace Ogre {
 		}
 		/** @copydoc HardwareBufferManagerInterface::_forceReleaseBufferCopies */
         virtual void _forceReleaseBufferCopies(
-            const HardwareVertexBufferSharedPtr& sourceBuffer)
+            const HardwareVertexBufferPtr& sourceBuffer)
 		{
 			mImpl->_forceReleaseBufferCopies(sourceBuffer);
 		}

+ 0 - 7
CamelotRenderer/OgreHardwareIndexBuffer.cpp

@@ -76,12 +76,5 @@ namespace Ogre {
             OGRE_DELETE mpShadowBuffer;
         }
     }
-    //-----------------------------------------------------------------------------
-    HardwareIndexBufferSharedPtr::HardwareIndexBufferSharedPtr(HardwareIndexBuffer* buf)
-        : SharedPtr<HardwareIndexBuffer>(buf)
-    {
-
-    }
-
 }
 

+ 1 - 10
CamelotRenderer/OgreHardwareIndexBuffer.h

@@ -31,7 +31,6 @@ THE SOFTWARE.
 // Precompiler options
 #include "OgrePrerequisites.h"
 #include "OgreHardwareBuffer.h"
-#include "OgreSharedPtr.h"
 
 namespace Ogre {
 	class HardwareBufferManagerBase;
@@ -74,15 +73,7 @@ namespace Ogre {
 		    // NB subclasses should override lock, unlock, readData, writeData
     };
 
-
-    /** Shared pointer implementation used to share index buffers. */
-    class _OgreExport HardwareIndexBufferSharedPtr : public SharedPtr<HardwareIndexBuffer>
-    {
-    public:
-        HardwareIndexBufferSharedPtr() : SharedPtr<HardwareIndexBuffer>() {}
-        explicit HardwareIndexBufferSharedPtr(HardwareIndexBuffer* buf);
-    };
-	/** @} */
+	typedef std::shared_ptr<HardwareIndexBuffer> HardwareIndexBufferPtr;
 	/** @} */
 }
 #endif

+ 3 - 10
CamelotRenderer/OgreHardwarePixelBuffer.cpp

@@ -103,7 +103,7 @@ namespace Ogre
 
     //-----------------------------------------------------------------------------    
 
-    void HardwarePixelBuffer::blit(const HardwarePixelBufferSharedPtr &src, const Box &srcBox, const Box &dstBox)
+    void HardwarePixelBuffer::blit(const HardwarePixelBufferPtr &src, const Box &srcBox, const Box &dstBox)
 	{
 		if(isLocked() || src->isLocked())
 		{
@@ -111,7 +111,7 @@ namespace Ogre
 				"Source and destination buffer may not be locked!",
 				"HardwarePixelBuffer::blit");
 		}
-		if(src.getPointer() == this)
+		if(src.get() == this)
 		{
 			OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
                 "Source must not be the same object",
@@ -144,7 +144,7 @@ namespace Ogre
 		src->unlock();
 	}
     //-----------------------------------------------------------------------------       
-    void HardwarePixelBuffer::blit(const HardwarePixelBufferSharedPtr &src)
+    void HardwarePixelBuffer::blit(const HardwarePixelBufferPtr &src)
     {
         blit(src, 
             Box(0,0,0,src->getWidth(),src->getHeight(),src->getDepth()), 
@@ -178,13 +178,6 @@ namespace Ogre
 				"HardwarePixelBuffer::getRenderTarget");
     }
 
-    //-----------------------------------------------------------------------------    
-    
-    HardwarePixelBufferSharedPtr::HardwarePixelBufferSharedPtr(HardwarePixelBuffer* buf)
-        : SharedPtr<HardwarePixelBuffer>(buf)
-    {
-
-    }   
 	//-----------------------------------------------------------------------------    
 
 	void HardwarePixelBuffer::_clearSliceRTT(size_t zoffset)

+ 2 - 14
CamelotRenderer/OgreHardwarePixelBuffer.h

@@ -31,7 +31,6 @@ THE SOFTWARE.
 // Precompiler options
 #include "OgrePrerequisites.h"
 #include "OgreHardwareBuffer.h"
-#include "OgreSharedPtr.h"
 #include "OgrePixelFormat.h"
 
 namespace Ogre {
@@ -122,14 +121,14 @@ namespace Ogre {
             but it is faster to pass the source image in the right dimensions.
 			@note Only call this function when both  buffers are unlocked. 
          */        
-        virtual void blit(const HardwarePixelBufferSharedPtr &src, const Box &srcBox, const Box &dstBox);
+        virtual void blit(const HardwarePixelBufferPtr &src, const Box &srcBox, const Box &dstBox);
 
 		/** Convenience function that blits the entire source pixel buffer to this buffer. 
 			If source and destination dimensions don't match, scaling is done.
 			@param src		PixelBox containing the source pixels and format in memory
 			@note Only call this function when the buffer is unlocked. 
 		*/
-		void blit(const HardwarePixelBufferSharedPtr &src); 
+		void blit(const HardwarePixelBufferPtr &src); 
 		
 		/** Copies a region from normal memory to a region of this pixelbuffer. The source
 			image can be in any pixel format supported by OGRE, and in any size. 
@@ -190,17 +189,6 @@ namespace Ogre {
         PixelFormat getFormat() const { return mFormat; }
     };
 
-    /** Shared pointer implementation used to share pixel buffers. */
-    class _OgreExport HardwarePixelBufferSharedPtr : public SharedPtr<HardwarePixelBuffer>
-    {
-    public:
-        HardwarePixelBufferSharedPtr() : SharedPtr<HardwarePixelBuffer>() {}
-        explicit HardwarePixelBufferSharedPtr(HardwarePixelBuffer* buf);
-
-
-    };
-
-	/** @} */
 	/** @} */
 }
 #endif

+ 2 - 12
CamelotRenderer/OgreHardwareVertexBuffer.cpp

@@ -594,7 +594,7 @@ namespace Ogre {
         unsetAllBindings();
 	}
     //-----------------------------------------------------------------------------
-	void VertexBufferBinding::setBinding(unsigned short index, const HardwareVertexBufferSharedPtr& buffer)
+	void VertexBufferBinding::setBinding(unsigned short index, const HardwareVertexBufferPtr& buffer)
 	{
         // NB will replace any existing buffer ptr at this index, and will thus cause
         // reference count to decrement on that buffer (possibly destroying it)
@@ -626,7 +626,7 @@ namespace Ogre {
 		return mBindingMap;
 	}
     //-----------------------------------------------------------------------------
-	const HardwareVertexBufferSharedPtr& VertexBufferBinding::getBuffer(unsigned short index) const
+	const HardwareVertexBufferPtr& VertexBufferBinding::getBuffer(unsigned short index) const
 	{
 		VertexBufferBindingMap::const_iterator i = mBindingMap.find(index);
 		if (i == mBindingMap.end())
@@ -673,14 +673,4 @@ namespace Ogre {
         mBindingMap.swap(newBindingMap);
         mHighIndex = targetIndex;
     }
-    //-----------------------------------------------------------------------------
-    HardwareVertexBufferSharedPtr::HardwareVertexBufferSharedPtr(HardwareVertexBuffer* buf)
-        : SharedPtr<HardwareVertexBuffer>(buf)
-    {
-
-    }
-
-
-
-
 }

+ 4 - 13
CamelotRenderer/OgreHardwareVertexBuffer.h

@@ -31,7 +31,6 @@ THE SOFTWARE.
 // Precompiler options
 #include "OgrePrerequisites.h"
 #include "OgreHardwareBuffer.h"
-#include "OgreSharedPtr.h"
 #include "OgreColourValue.h"
 
 namespace Ogre {
@@ -70,15 +69,7 @@ namespace Ogre {
 
     };
 
-    /** Shared pointer implementation used to share index buffers. */
-    class _OgreExport HardwareVertexBufferSharedPtr : public SharedPtr<HardwareVertexBuffer>
-    {
-    public:
-        HardwareVertexBufferSharedPtr() : SharedPtr<HardwareVertexBuffer>() {}
-        explicit HardwareVertexBufferSharedPtr(HardwareVertexBuffer* buf);
-
-
-    };
+	typedef std::shared_ptr<HardwareVertexBuffer> HardwareVertexBufferPtr;
 
     /// Vertex element semantics, used to identify the meaning of vertex buffer contents
 	enum VertexElementSemantic {
@@ -484,7 +475,7 @@ namespace Ogre {
 	{
 	public:
 		/// Defines the vertex buffer bindings used as source for vertex declarations
-		typedef map<unsigned short, HardwareVertexBufferSharedPtr>::type VertexBufferBindingMap;
+		typedef map<unsigned short, HardwareVertexBufferPtr>::type VertexBufferBindingMap;
 	protected:
 		VertexBufferBindingMap mBindingMap;
 		mutable unsigned short mHighIndex;
@@ -500,7 +491,7 @@ namespace Ogre {
 			You should assign bindings from 0 and not leave gaps, although you can
 			bind them in any order.
 		*/
-		virtual void setBinding(unsigned short index, const HardwareVertexBufferSharedPtr& buffer);
+		virtual void setBinding(unsigned short index, const HardwareVertexBufferPtr& buffer);
 		/** Removes an existing binding. */
 		virtual void unsetBinding(unsigned short index);
 
@@ -511,7 +502,7 @@ namespace Ogre {
 		virtual const VertexBufferBindingMap& getBindings(void) const;
 
 		/// Gets the buffer bound to the given source index
-		virtual const HardwareVertexBufferSharedPtr& getBuffer(unsigned short index) const;
+		virtual const HardwareVertexBufferPtr& getBuffer(unsigned short index) const;
 		/// Gets whether a buffer is bound to the given source index
 		virtual bool isBufferBound(unsigned short index) const;
 

+ 5 - 35
CamelotRenderer/OgreHighLevelGpuProgram.cpp

@@ -48,7 +48,7 @@ namespace Ogre
 			createLowLevelImpl();
 
 			// load constructed assembler program (if it exists)
-			if (!mAssemblerProgram.isNull() && mAssemblerProgram.getPointer() != this)
+			if (mAssemblerProgram != nullptr && mAssemblerProgram.get() != this)
 			{
 				mAssemblerProgram->load();
 			}
@@ -57,9 +57,9 @@ namespace Ogre
     //---------------------------------------------------------------------------
     void HighLevelGpuProgram::unload()
     {   
-        if (!mAssemblerProgram.isNull() && mAssemblerProgram.getPointer() != this)
+        if (mAssemblerProgram != nullptr && mAssemblerProgram.get() != this)
         {
-            mAssemblerProgram.setNull();
+            mAssemblerProgram = nullptr;
         }
 
         unloadHighLevel();
@@ -86,7 +86,7 @@ namespace Ogre
 		}
 
 		// Copy in default parameters if present
-		if (!mDefaultParams.isNull())
+		if (mDefaultParams != nullptr)
 			params->copyConstantsFrom(*(mDefaultParams.get()));
         return params;
     }
@@ -100,7 +100,7 @@ namespace Ogre
 				loadHighLevelImpl();
 				mHighLevelLoaded = true;
 
-				assert(mDefaultParams.isNull()); // TODO - These two lines and replicated both here and in GpuProgram. I should probably add another load method that holds it all in one place?
+				assert(mDefaultParams == nullptr); // TODO - These two lines and replicated both here and in GpuProgram. I should probably add another load method that holds it all in one place?
 				mDefaultParams = createParameters();
 
 			}
@@ -166,34 +166,4 @@ namespace Ogre
 		// also set logical / physical maps for programs which use this
 		params->_setLogicalIndexes(mFloatLogicalToPhysical, mIntLogicalToPhysical);
 	}
-	//-----------------------------------------------------------------------
-	//-----------------------------------------------------------------------
-	HighLevelGpuProgramPtr& HighLevelGpuProgramPtr::operator=(const GpuProgramPtr& r)
-	{
-		// Can assign direct
-		if (pRep == static_cast<HighLevelGpuProgram*>(r.getPointer()))
-			return *this;
-		release();
-		// lock & copy other mutex pointer
-        OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
-        {
-		    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
-		    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
-		    pRep = static_cast<HighLevelGpuProgram*>(r.getPointer());
-		    pUseCount = r.useCountPointer();
-		    if (pUseCount)
-		    {
-			    ++(*pUseCount);
-		    }
-        }
-		else
-		{
-			// RHS must be a null pointer
-			assert(r.isNull() && "RHS must be null if it has no mutex!");
-			setNull();
-		}
-		return *this;
-	}
-
-
 }

+ 1 - 23
CamelotRenderer/OgreHighLevelGpuProgram.h

@@ -110,7 +110,7 @@ namespace Ogre {
         */
         GpuProgramParametersSharedPtr createParameters(void);
         /** @copydoc GpuProgram::getBindingDelegate */
-        GpuProgram* _getBindingDelegate(void) { return mAssemblerProgram.getPointer(); }
+        GpuProgram* _getBindingDelegate(void) { return mAssemblerProgram.get(); }
 
 		/** Get the full list of GpuConstantDefinition instances.
 		@note
@@ -120,30 +120,8 @@ namespace Ogre {
 
 		/// Override GpuProgram::getNamedConstants to ensure built
 		const GpuNamedConstants& getNamedConstants() const { return getConstantDefinitions(); }
-
-
-
-
-
     };
 
-    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to HighLevelGpuProgramPtr 
-    @note Has to be a subclass since we need operator=.
-    We could templatise this instead of repeating per Resource subclass, 
-    except to do so requires a form VC6 does not support i.e.
-    ResourceSubclassPtr<T> : public SharedPtr<T>
-    */
-    class _OgreExport HighLevelGpuProgramPtr : public SharedPtr<HighLevelGpuProgram> 
-    {
-    public:
-        HighLevelGpuProgramPtr() : SharedPtr<HighLevelGpuProgram>() {}
-        explicit HighLevelGpuProgramPtr(HighLevelGpuProgram* rep) : SharedPtr<HighLevelGpuProgram>(rep) {}
-        HighLevelGpuProgramPtr(const HighLevelGpuProgramPtr& r) : SharedPtr<HighLevelGpuProgram>(r) {} 
-
-		/// Operator used to convert a GpuProgramPtr to a HighLevelGpuProgramPtr
-		HighLevelGpuProgramPtr& operator=(const GpuProgramPtr& r);
-    };
-	/** @} */
 	/** @} */
 
 }

+ 9 - 4
CamelotRenderer/OgrePrerequisites.h

@@ -159,16 +159,13 @@ namespace Ogre {
     class FrameListener;
     class Frustum;
     class GpuProgram;
-    class GpuProgramPtr;
     class GpuProgramManager;
 	class GpuProgramUsage;
     class HardwareIndexBuffer;
     class HardwareOcclusionQuery;
     class HardwareVertexBuffer;
 	class HardwarePixelBuffer;
-    class HardwarePixelBufferSharedPtr;
 	class HighLevelGpuProgram;
-    class HighLevelGpuProgramPtr;
 	class HighLevelGpuProgramManager;
 	class HighLevelGpuProgramFactory;
     class IndexData;
@@ -286,7 +283,6 @@ namespace Ogre {
 	class ExternalTextureSource;
     class TextureUnitState;
     class Texture;
-    class TexturePtr;
     class TextureManager;
     class TransformKeyFrame;
 	class Timer;
@@ -318,6 +314,15 @@ settings have been made.
 */
 #include "OgreStdHeaders.h"
 
+/* Shared pointer typedefs*/
+namespace Ogre
+{
+	typedef std::shared_ptr<GpuProgram> GpuProgramPtr;
+	typedef std::shared_ptr<HighLevelGpuProgram> HighLevelGpuProgramPtr;
+	typedef std::shared_ptr<HardwarePixelBuffer> HardwarePixelBufferPtr;
+	typedef std::shared_ptr<Texture> TexturePtr;
+}
+
 namespace Ogre
 {
 	#if OGRE_WCHAR_T_STRINGS

+ 3 - 3
CamelotRenderer/OgreRenderSystem.cpp

@@ -613,17 +613,17 @@ namespace Ogre {
 
         --mCurrentPassIterationCount;
 		++mCurrentPassIterationNum;
-        if (!mActiveVertexGpuProgramParameters.isNull())
+        if (mActiveVertexGpuProgramParameters != nullptr)
         {
             mActiveVertexGpuProgramParameters->incPassIterationNumber();
             bindGpuProgramPassIterationParameters(GPT_VERTEX_PROGRAM);
         }
-        if (!mActiveGeometryGpuProgramParameters.isNull())
+        if (mActiveGeometryGpuProgramParameters != nullptr)
         {
             mActiveGeometryGpuProgramParameters->incPassIterationNumber();
             bindGpuProgramPassIterationParameters(GPT_GEOMETRY_PROGRAM);
         }
-        if (!mActiveFragmentGpuProgramParameters.isNull())
+        if (mActiveFragmentGpuProgramParameters != nullptr)
         {
             mActiveFragmentGpuProgramParameters->incPassIterationNumber();
             bindGpuProgramPassIterationParameters(GPT_FRAGMENT_PROGRAM);

+ 0 - 278
CamelotRenderer/OgreSharedPtr.h

@@ -1,278 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __SharedPtr_H__
-#define __SharedPtr_H__
-
-#include "OgrePrerequisites.h"
-
-namespace Ogre {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup General
-	*  @{
-	*/
-
-	/// The method to use to free memory on destruction
-	enum SharedPtrFreeMethod
-	{
-		/// Use OGRE_DELETE to free the memory
-		SPFM_DELETE,
-		/// Use OGRE_DELETE_T to free (only MEMCATEGORY_GENERAL supported)
-		SPFM_DELETE_T,
-		/// Use OGRE_FREE to free (only MEMCATEGORY_GENERAL supported)
-		SPFM_FREE
-	};
-
-	/** Reference-counted shared pointer, used for objects where implicit destruction is 
-        required. 
-    @remarks
-        This is a standard shared pointer implementation which uses a reference 
-        count to work out when to delete the object. 
-	@par
-		If OGRE_THREAD_SUPPORT is defined to be 1, use of this class is thread-safe.
-    */
-	template<class T> class SharedPtr
-	{
-	protected:
-		T* pRep;
-		unsigned int* pUseCount;
-		SharedPtrFreeMethod useFreeMethod; // if we should use OGRE_FREE instead of OGRE_DELETE
-	public:
-		OGRE_AUTO_SHARED_MUTEX // public to allow external locking
-		/** Constructor, does not initialise the SharedPtr.
-			@remarks
-				<b>Dangerous!</b> You have to call bind() before using the SharedPtr.
-		*/
-		SharedPtr() : pRep(0), pUseCount(0), useFreeMethod(SPFM_DELETE)
-        {
-            OGRE_SET_AUTO_SHARED_MUTEX_NULL
-        }
-
-		/** Constructor.
-		@param rep The pointer to take ownership of
-		@param freeMode The mechanism to use to free the pointer
-		*/
-        template< class Y>
-		explicit SharedPtr(Y* rep, SharedPtrFreeMethod inFreeMethod = SPFM_DELETE) 
-			: pRep(rep)
-			, pUseCount(rep ? OGRE_NEW_T(unsigned int, MEMCATEGORY_GENERAL)(1) : 0)
-			, useFreeMethod(inFreeMethod)
-		{
-            OGRE_SET_AUTO_SHARED_MUTEX_NULL
-			if (rep)
-			{
-				OGRE_NEW_AUTO_SHARED_MUTEX
-			}
-		}
-		SharedPtr(const SharedPtr& r)
-            : pRep(0), pUseCount(0), useFreeMethod(SPFM_DELETE)
-		{
-			// lock & copy other mutex pointer
-            
-            OGRE_SET_AUTO_SHARED_MUTEX_NULL
-            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
-            {
-			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
-			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
-			    pRep = r.pRep;
-			    pUseCount = r.pUseCount; 
-				useFreeMethod = r.useFreeMethod;
-			    // Handle zero pointer gracefully to manage STL containers
-			    if(pUseCount)
-			    {
-				    ++(*pUseCount); 
-			    }
-            }
-		}
-		SharedPtr& operator=(const SharedPtr& r) {
-			if (pRep == r.pRep)
-				return *this;
-			// Swap current data into a local copy
-			// this ensures we deal with rhs and this being dependent
-			SharedPtr<T> tmp(r);
-			swap(tmp);
-			return *this;
-		}
-		
-		template< class Y>
-		SharedPtr(const SharedPtr<Y>& r)
-            : pRep(0), pUseCount(0), useFreeMethod(SPFM_DELETE)
-		{
-			// lock & copy other mutex pointer
-
-            OGRE_SET_AUTO_SHARED_MUTEX_NULL
-            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
-            {
-			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
-			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
-			    pRep = r.getPointer();
-			    pUseCount = r.useCountPointer();
-				useFreeMethod = r.freeMethod();
-			    // Handle zero pointer gracefully to manage STL containers
-			    if(pUseCount)
-			    {
-				    ++(*pUseCount);
-			    }
-            }
-		}
-		template< class Y>
-		SharedPtr& operator=(const SharedPtr<Y>& r) {
-			if (pRep == r.getPointer())
-				return *this;
-			// Swap current data into a local copy
-			// this ensures we deal with rhs and this being dependent
-			SharedPtr<T> tmp(r);
-			swap(tmp);
-			return *this;
-		}
-		virtual ~SharedPtr() {
-            release();
-		}
-
-
-		inline T& operator*() const { assert(pRep); return *pRep; }
-		inline T* operator->() const { assert(pRep); return pRep; }
-		inline T* get() const { return pRep; }
-
-		/** Binds rep to the SharedPtr.
-			@remarks
-				Assumes that the SharedPtr is uninitialised!
-		*/
-		void bind(T* rep, SharedPtrFreeMethod inFreeMethod = SPFM_DELETE) {
-			assert(!pRep && !pUseCount);
-            OGRE_NEW_AUTO_SHARED_MUTEX
-			OGRE_LOCK_AUTO_SHARED_MUTEX
-			pUseCount = OGRE_NEW_T(unsigned int, MEMCATEGORY_GENERAL)(1);
-			pRep = rep;
-			useFreeMethod = inFreeMethod;
-		}
-
-		inline bool unique() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount == 1; }
-		inline unsigned int useCount() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount; }
-		inline unsigned int* useCountPointer() const { return pUseCount; }
-
-		inline T* getPointer() const { return pRep; }
-		inline SharedPtrFreeMethod freeMethod() const { return useFreeMethod; }
-
-		inline bool isNull(void) const { return pRep == 0; }
-
-        inline void setNull(void) { 
-			if (pRep)
-			{
-				// can't scope lock mutex before release in case deleted
-				release();
-				pRep = 0;
-				pUseCount = 0;
-			}
-        }
-
-    protected:
-
-        inline void release(void)
-        {
-			bool destroyThis = false;
-
-            /* If the mutex is not initialized to a non-zero value, then
-               neither is pUseCount nor pRep.
-             */
-
-            OGRE_MUTEX_CONDITIONAL(OGRE_AUTO_MUTEX_NAME)
-			{
-				// lock own mutex in limited scope (must unlock before destroy)
-				OGRE_LOCK_AUTO_SHARED_MUTEX
-				if (pUseCount)
-				{
-					if (--(*pUseCount) == 0) 
-					{
-						destroyThis = true;
-	                }
-				}
-            }
-			if (destroyThis)
-				destroy();
-
-            OGRE_SET_AUTO_SHARED_MUTEX_NULL
-        }
-
-        virtual void destroy(void)
-        {
-            // IF YOU GET A CRASH HERE, YOU FORGOT TO FREE UP POINTERS
-            // BEFORE SHUTTING OGRE DOWN
-            // Use setNull() before shutdown or make sure your pointer goes
-            // out of scope before OGRE shuts down to avoid this.
-			switch(useFreeMethod)
-			{
-			case SPFM_DELETE:
-				OGRE_DELETE pRep;
-				break;
-			case SPFM_DELETE_T:
-				OGRE_DELETE_T(pRep, T, MEMCATEGORY_GENERAL);
-				break;
-			case SPFM_FREE:
-				OGRE_FREE(pRep, MEMCATEGORY_GENERAL);
-				break;
-			};
-			// use OGRE_FREE instead of OGRE_DELETE_T since 'unsigned int' isn't a destructor
-			// we only used OGRE_NEW_T to be able to use constructor
-            OGRE_FREE(pUseCount, MEMCATEGORY_GENERAL);
-			OGRE_DELETE_AUTO_SHARED_MUTEX
-        }
-
-		virtual void swap(SharedPtr<T> &other) 
-		{
-			std::swap(pRep, other.pRep);
-			std::swap(pUseCount, other.pUseCount);
-			std::swap(useFreeMethod, other.useFreeMethod);
-#if OGRE_THREAD_SUPPORT
-			std::swap(OGRE_AUTO_MUTEX_NAME, other.OGRE_AUTO_MUTEX_NAME);
-#endif
-		}
-	};
-
-	template<class T, class U> inline bool operator==(SharedPtr<T> const& a, SharedPtr<U> const& b)
-	{
-		return a.get() == b.get();
-	}
-
-	template<class T, class U> inline bool operator!=(SharedPtr<T> const& a, SharedPtr<U> const& b)
-	{
-		return a.get() != b.get();
-	}
-
-	template<class T, class U> inline bool operator<(SharedPtr<T> const& a, SharedPtr<U> const& b)
-	{
-		return std::less<const void*>()(a.get(), b.get());
-	}
-	/** @} */
-	/** @} */
-}
-
-
-
-#endif

+ 2 - 0
CamelotRenderer/OgreStdHeaders.h

@@ -27,6 +27,8 @@
 #include <cstdarg>
 #include <cmath>
 
+#include <memory>
+
 // STL containers
 #include <vector>
 #include <map>

+ 1 - 19
CamelotRenderer/OgreTexture.h

@@ -29,7 +29,6 @@ THE SOFTWARE.
 #define _Texture_H__
 
 #include "OgrePrerequisites.h"
-#include "OgreSharedPtr.h"
 #include "OgreHardwareBuffer.h"
 #include "OgrePixelFormat.h"
 
@@ -86,9 +85,6 @@ namespace Ogre {
 		MIP_DEFAULT = -1
 	};
 
-    // Forward declaration
-    class TexturePtr;
-
     /** Abstract class representing a Texture resource.
         @remarks
             The actual concrete subclass which will exist for a texture
@@ -335,7 +331,7 @@ namespace Ogre {
 			@remarks	The buffer is invalidated when the resource is unloaded or destroyed.
 						Do not use it after the lifetime of the containing texture.
 		*/
-		virtual HardwarePixelBufferSharedPtr getBuffer(size_t face=0, size_t mipmap=0) = 0;
+		virtual HardwarePixelBufferPtr getBuffer(size_t face=0, size_t mipmap=0) = 0;
 		
 		/** Retrieve a platform or API-specific piece of information from this texture.
 		 This method of retrieving information should only be used if you know what you're doing.
@@ -393,20 +389,6 @@ namespace Ogre {
 
     };
 
-    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to TexturePtr 
-    @note Has to be a subclass since we need operator=.
-    We could templatise this instead of repeating per Resource subclass, 
-    except to do so requires a form VC6 does not support i.e.
-    ResourceSubclassPtr<T> : public SharedPtr<T>
-    */
-    class _OgreExport TexturePtr : public SharedPtr<Texture> 
-    {
-    public:
-        TexturePtr() : SharedPtr<Texture>() {}
-        explicit TexturePtr(Texture* rep) : SharedPtr<Texture>(rep) {}
-        TexturePtr(const TexturePtr& r) : SharedPtr<Texture>(r) {} 
-    };
-	/** @} */
 	/** @} */
 
 }

+ 9 - 9
CamelotRenderer/OgreTextureUnitState.cpp

@@ -185,7 +185,7 @@ namespace Ogre {
             mFrames.resize(1);
 			mFramePtrs.resize(1);
             mFrames[0] = name;
-			mFramePtrs[0].setNull();
+			mFramePtrs[0] = nullptr;
 			// defer load until used, so don't grab pointer yet
             mCurrentFrame = 0;
             mCubic = false;
@@ -225,7 +225,7 @@ namespace Ogre {
 			mFrames.clear();
 			// One reference space, set manually through _setTexturePtr
 			mFramePtrs.resize(1);
-			mFramePtrs[0].setNull();
+			mFramePtrs[0] = nullptr;
 		}
 	}
 	//-----------------------------------------------------------------------
@@ -282,7 +282,7 @@ namespace Ogre {
         for (unsigned int i = 0; i < mFrames.size(); ++i)
         {
             mFrames[i] = names[i];
-			mFramePtrs[i].setNull();
+			mFramePtrs[i] = nullptr;
         }
     }
     //-----------------------------------------------------------------------
@@ -310,7 +310,7 @@ namespace Ogre {
         {
             mFrames[frameNumber] = name;
 			// reset pointer (don't populate until requested)
-			mFramePtrs[frameNumber].setNull();	
+			mFramePtrs[frameNumber] = nullptr;
 
             if (isLoaded())
             {
@@ -387,7 +387,7 @@ namespace Ogre {
 			StringUtil::StrStreamType str;
             str << baseName << "_" << i << ext;
             mFrames[i] = str.str();
-			mFramePtrs[i].setNull();
+			mFramePtrs[i] = nullptr;
         }
 
         // Load immediately if Material loaded
@@ -412,7 +412,7 @@ namespace Ogre {
         for (unsigned int i = 0; i < mFrames.size(); ++i)
         {
             mFrames[i] = names[i];
-			mFramePtrs[i].setNull();
+			mFramePtrs[i] = nullptr;
         }
 
         // Load immediately if Material loaded
@@ -426,7 +426,7 @@ namespace Ogre {
     {
 		
 		TexturePtr tex = _getTexturePtr(frame);
-	    if (tex.isNull())
+	    if (tex == nullptr)
 		    OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Could not find texture " + mFrames[ frame ],
 		    "TextureUnitState::getTextureDimensions" );
 
@@ -956,7 +956,7 @@ namespace Ogre {
         tiend = mFramePtrs.end();
         for (ti = mFramePtrs.begin(); ti != tiend; ++ti)
         {
-            ti->setNull();
+            (*ti) = nullptr;
         }
     }
 	//-----------------------------------------------------------------------
@@ -967,7 +967,7 @@ namespace Ogre {
         tiend = mFramePtrs.end();
         for (ti = mFramePtrs.begin(); ti != tiend; ++ti)
         {
-            ti->setNull();
+            (*ti) = nullptr;
         }
     }
     //-----------------------------------------------------------------------------

+ 7 - 7
CamelotRenderer/OgreVertexIndexData.cpp

@@ -85,8 +85,8 @@ namespace Ogre {
 		vbend = bindings.end();
 		for (vbi = bindings.begin(); vbi != vbend; ++vbi)
 		{
-			HardwareVertexBufferSharedPtr srcbuf = vbi->second;
-            HardwareVertexBufferSharedPtr dstBuf;
+			HardwareVertexBufferPtr srcbuf = vbi->second;
+            HardwareVertexBufferPtr dstBuf;
             if (copyData)
             {
 			    // create new buffer with the same settings
@@ -167,7 +167,7 @@ namespace Ogre {
             size_t v;
             unsigned short posOldSource = posElem->getSource();
 
-            HardwareVertexBufferSharedPtr vbuf = vertexBufferBinding->getBuffer(posOldSource);
+            HardwareVertexBufferPtr vbuf = vertexBufferBinding->getBuffer(posOldSource);
             bool wasSharedBuffer = false;
             // Are there other elements in the buffer except for the position?
             if (vbuf->getVertexSize() > posElem->getSize())
@@ -176,7 +176,7 @@ namespace Ogre {
                 // Most drivers don't like gaps in the declaration, and in any case it's waste
                 wasSharedBuffer = true;
             }
-            HardwareVertexBufferSharedPtr newPosBuffer, newRemainderBuffer;
+            HardwareVertexBufferPtr newPosBuffer, newRemainderBuffer;
             if (wasSharedBuffer)
             {
                 newRemainderBuffer = vbuf->getManager()->createVertexBuffer(
@@ -372,7 +372,7 @@ namespace Ogre {
 		{
             size_t vertexSize = newDeclaration->getVertexSize(buf);
 
-			HardwareVertexBufferSharedPtr vbuf = 
+			HardwareVertexBufferPtr vbuf = 
 				pManager->createVertexBuffer(
 					vertexSize,
 					vertexCount, 
@@ -480,7 +480,7 @@ namespace Ogre {
                     vertexDeclaration->findElementBySemantic(
                         destelem.getSemantic(), destelem.getIndex());
                 // get buffer
-                HardwareVertexBufferSharedPtr srcbuf = 
+                HardwareVertexBufferPtr srcbuf = 
                     vertexBufferBinding->getBuffer(srcelem->getSource());
                 // improve flexibility only
                 if (srcbuf->getUsage() & HardwareBuffer::HBU_DYNAMIC)
@@ -934,7 +934,7 @@ namespace Ogre {
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	void VertexCacheProfiler::profile(const HardwareIndexBufferSharedPtr& indexBuffer)
+	void VertexCacheProfiler::profile(const HardwareIndexBufferPtr& indexBuffer)
     {
 		if (indexBuffer->isLocked()) return;
 

+ 3 - 3
CamelotRenderer/OgreVertexIndexData.h

@@ -142,7 +142,7 @@ namespace Ogre {
             Note that we don't store any vertex declaration or vertex buffer binding here because this
             can be reused in the shadow algorithm.
         */
-        HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer;
+        HardwareVertexBufferPtr hardwareShadowVolWBuffer;
 
 
 		/** Reorganises the data in the vertex buffers according to the 
@@ -247,7 +247,7 @@ namespace Ogre {
         IndexData();
         ~IndexData();
 		/// pointer to the HardwareIndexBuffer to use, must be specified if useIndexes = true
-		HardwareIndexBufferSharedPtr indexBuffer;
+		HardwareIndexBufferPtr indexBuffer;
 
 		/// index in the buffer to start from for this operation
 		size_t indexStart;
@@ -297,7 +297,7 @@ namespace Ogre {
 				OGRE_FREE(cache, MEMCATEGORY_GEOMETRY);
 			}
 
-			void profile(const HardwareIndexBufferSharedPtr& indexBuffer);
+			void profile(const HardwareIndexBufferPtr& indexBuffer);
 			void reset() { hit = 0; miss = 0; tail = 0; buffersize = 0; }
 			void flush() { tail = 0; buffersize = 0; }
 

+ 2 - 2
CamelotRenderer/RenderSystemGL/Include/OgreGLDefaultHardwareBufferManager.h

@@ -104,11 +104,11 @@ namespace Ogre {
         GLDefaultHardwareBufferManagerBase();
         ~GLDefaultHardwareBufferManagerBase();
         /// Creates a vertex buffer
-		HardwareVertexBufferSharedPtr 
+		HardwareVertexBufferPtr 
             createVertexBuffer(size_t vertexSize, size_t numVerts, 
 				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
 		/// Create a hardware vertex buffer
-		HardwareIndexBufferSharedPtr 
+		HardwareIndexBufferPtr 
             createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
 				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
 

+ 2 - 2
CamelotRenderer/RenderSystemGL/Include/OgreGLHardwareBufferManager.h

@@ -49,10 +49,10 @@ namespace Ogre {
         GLHardwareBufferManagerBase();
         ~GLHardwareBufferManagerBase();
         /// Creates a vertex buffer
-        HardwareVertexBufferSharedPtr createVertexBuffer(size_t vertexSize, 
+        HardwareVertexBufferPtr createVertexBuffer(size_t vertexSize, 
             size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer = false);
         /// Create a hardware vertex buffer
-        HardwareIndexBufferSharedPtr createIndexBuffer(
+        HardwareIndexBufferPtr createIndexBuffer(
             HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
             HardwareBuffer::Usage usage, bool useShadowBuffer = false);
         /// Utility function to get the correct GL usage based on HBU's

+ 1 - 1
CamelotRenderer/RenderSystemGL/Include/OgreGLHardwarePixelBuffer.h

@@ -104,7 +104,7 @@ namespace Ogre {
         /// Copy from framebuffer
         void copyFromFramebuffer(size_t zoffset);
         /// @copydoc HardwarePixelBuffer::blit
-        void blit(const HardwarePixelBufferSharedPtr &src, const Box &srcBox, const Box &dstBox);
+        void blit(const HardwarePixelBufferPtr &src, const Box &srcBox, const Box &dstBox);
         // Blitting implementation
         void blitFromTexture(GLTextureBuffer *src, const Box &srcBox, const Box &dstBox);
     protected:

+ 3 - 47
CamelotRenderer/RenderSystemGL/Include/OgreGLTexture.h

@@ -49,7 +49,7 @@ namespace Ogre {
         void createRenderTexture();
 			
 		/// @copydoc Texture::getBuffer
-		HardwarePixelBufferSharedPtr getBuffer(size_t face, size_t mipmap);
+		HardwarePixelBufferPtr getBuffer(size_t face, size_t mipmap);
 
         // Takes the OGRE texture type (1d/2d/3d/cube) and returns the appropriate GL one
         GLenum getGLTextureTarget(void) const;
@@ -95,55 +95,11 @@ namespace Ogre {
         GLSupport& mGLSupport;
 		
 		/// Vector of pointers to subsurfaces
-		typedef vector<HardwarePixelBufferSharedPtr>::type SurfaceList;
+		typedef vector<HardwarePixelBufferPtr>::type SurfaceList;
 		SurfaceList	mSurfaceList;
     };
 
-    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to GLTexturePtr 
-    @note Has to be a subclass since we need operator=.
-    We could templatise this instead of repeating per Resource subclass, 
-    except to do so requires a form VC6 does not support i.e.
-    ResourceSubclassPtr<T> : public SharedPtr<T>
-    */
-    class _OgreGLExport GLTexturePtr : public SharedPtr<GLTexture> 
-    {
-    public:
-        GLTexturePtr() : SharedPtr<GLTexture>() {}
-        explicit GLTexturePtr(GLTexture* rep) : SharedPtr<GLTexture>(rep) {}
-        GLTexturePtr(const GLTexturePtr& r) : SharedPtr<GLTexture>(r) {} 
-
-		GLTexturePtr(const TexturePtr& r) : SharedPtr<GLTexture>()
-		{
-			*this = r;
-		}
-
-        /// Operator used to convert a TexturePtr to a GLTexturePtr
-        GLTexturePtr& operator=(const TexturePtr& r)
-        {
-            if (pRep == static_cast<GLTexture*>(r.getPointer()))
-                return *this;
-            release();
-			// lock & copy other mutex pointer
-            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
-            {
-			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
-			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
-                pRep = static_cast<GLTexture*>(r.getPointer());
-                pUseCount = r.useCountPointer();
-                if (pUseCount)
-                {
-                    ++(*pUseCount);
-                }
-            }
-			else
-			{
-				// RHS must be a null pointer
-				assert(r.isNull() && "RHS must be null if it has no mutex!");
-				setNull();
-			}
-            return *this;
-        }
-    };
+	typedef std::shared_ptr<GLTexture> GLTexturePtr;
 }
 
 #endif // __GLTEXTURE_H__

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLProgram.cpp

@@ -196,7 +196,7 @@ namespace Ogre {
 		// We didn't create mAssemblerProgram through a manager, so override this
 		// implementation so that we don't try to remove it from one. Since getCreator()
 		// is used, it might target a different matching handle!
-		mAssemblerProgram.setNull();
+		mAssemblerProgram = nullptr;
 
 		unloadHighLevel();
 	}

+ 0 - 1
CamelotRenderer/RenderSystemGL/Source/OgreGLContext.cpp

@@ -27,7 +27,6 @@ THE SOFTWARE.
 */
 
 #include "OgreGLContext.h"
-#include "OgreSharedPtr.h"
 
 namespace Ogre {
     // Empty base class

+ 4 - 4
CamelotRenderer/RenderSystemGL/Source/OgreGLDefaultHardwareBufferManager.cpp

@@ -151,19 +151,19 @@ namespace Ogre {
         destroyAllBindings();
 	}
     //-----------------------------------------------------------------------
-	HardwareVertexBufferSharedPtr 
+	HardwareVertexBufferPtr 
         GLDefaultHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize, 
 		size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
 	{
-		return HardwareVertexBufferSharedPtr(
+		return HardwareVertexBufferPtr(
 			new GLDefaultHardwareVertexBuffer(this, vertexSize, numVerts, usage));
 	}
     //-----------------------------------------------------------------------
-	HardwareIndexBufferSharedPtr 
+	HardwareIndexBufferPtr 
         GLDefaultHardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype, 
 		size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer)
 	{
-		return HardwareIndexBufferSharedPtr(
+		return HardwareIndexBufferPtr(
 			new GLDefaultHardwareIndexBuffer(itype, numIndexes, usage) );
 	}
 }

+ 4 - 4
CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareBufferManager.cpp

@@ -82,7 +82,7 @@ namespace Ogre {
 		OGRE_FREE_ALIGN(mScratchBufferPool, MEMCATEGORY_GEOMETRY, SCRATCH_ALIGNMENT);
     }
     //-----------------------------------------------------------------------
-    HardwareVertexBufferSharedPtr GLHardwareBufferManagerBase::createVertexBuffer(
+    HardwareVertexBufferPtr GLHardwareBufferManagerBase::createVertexBuffer(
         size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
     {
 		GLHardwareVertexBuffer* buf = 
@@ -91,10 +91,10 @@ namespace Ogre {
 			OGRE_LOCK_MUTEX(mVertexBuffersMutex)
 			mVertexBuffers.insert(buf);
 		}
-		return HardwareVertexBufferSharedPtr(buf);
+		return HardwareVertexBufferPtr(buf);
     }
     //-----------------------------------------------------------------------
-    HardwareIndexBufferSharedPtr 
+    HardwareIndexBufferPtr 
     GLHardwareBufferManagerBase::createIndexBuffer(
         HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
         HardwareBuffer::Usage usage, bool useShadowBuffer)
@@ -105,7 +105,7 @@ namespace Ogre {
 			OGRE_LOCK_MUTEX(mIndexBuffersMutex)
 			mIndexBuffers.insert(buf);
 		}
-		return HardwareIndexBufferSharedPtr(buf);
+		return HardwareIndexBufferPtr(buf);
     }
     //---------------------------------------------------------------------
     GLenum GLHardwareBufferManagerBase::getGLUsage(unsigned int usage)

+ 2 - 2
CamelotRenderer/RenderSystemGL/Source/OgreGLHardwarePixelBuffer.cpp

@@ -544,9 +544,9 @@ void GLTextureBuffer::copyFromFramebuffer(size_t zoffset)
     }
 }
 //-----------------------------------------------------------------------------  
-void GLTextureBuffer::blit(const HardwarePixelBufferSharedPtr &src, const Box &srcBox, const Box &dstBox)
+void GLTextureBuffer::blit(const HardwarePixelBufferPtr &src, const Box &srcBox, const Box &dstBox)
 {
-    GLTextureBuffer *srct = static_cast<GLTextureBuffer *>(src.getPointer());
+    GLTextureBuffer *srct = static_cast<GLTextureBuffer *>(src.get());
     /// Check for FBO support first
     /// Destination texture must be 1D, 2D, 3D, or Cube
     /// Source texture must be 1D, 2D or 3D

+ 7 - 7
CamelotRenderer/RenderSystemGL/Source/OgreGLRenderSystem.cpp

@@ -1317,7 +1317,7 @@ namespace Ogre {
 	//-----------------------------------------------------------------------------
 	void GLRenderSystem::_setTexture(size_t stage, bool enabled, const TexturePtr &texPtr)
 	{
-		GLTexturePtr tex = texPtr;
+		GLTexturePtr tex = std::static_pointer_cast<GLTexture>(texPtr);
 
 		GLenum lastTextureType = mTextureTypes[stage];
 
@@ -1326,7 +1326,7 @@ namespace Ogre {
 
 		if (enabled)
 		{
-			if (!tex.isNull())
+			if (tex)
 			{
 				// note used
 				mTextureTypes[stage] = tex->getGLTextureTarget();
@@ -1348,7 +1348,7 @@ namespace Ogre {
 				glEnable( mTextureTypes[stage] );
 			}
 
-			if(!tex.isNull())
+			if(tex)
 				glBindTexture( mTextureTypes[stage], tex->getGLID() );
 			else
 			{
@@ -2603,7 +2603,7 @@ GL_RGB_SCALE : GL_ALPHA_SCALE, 1);
 			if (!op.vertexData->vertexBufferBinding->isBufferBound(elem->getSource()))
 				continue; // skip unbound elements
 
-			HardwareVertexBufferSharedPtr vertexBuffer = 
+			HardwareVertexBufferPtr vertexBuffer = 
 				op.vertexData->vertexBufferBinding->getBuffer(elem->getSource());
 			if(mCurrentCapabilities->hasCapability(RSC_VBO))
 			{
@@ -2923,19 +2923,19 @@ GL_RGB_SCALE : GL_ALPHA_SCALE, 1);
 
 		if (gptype == GPT_VERTEX_PROGRAM && mCurrentVertexProgram)
 		{
-			mActiveVertexGpuProgramParameters.setNull();
+			mActiveVertexGpuProgramParameters = nullptr;
 			mCurrentVertexProgram->unbindProgram();
 			mCurrentVertexProgram = 0;
 		}
 		else if (gptype == GPT_GEOMETRY_PROGRAM && mCurrentGeometryProgram)
 		{
-			mActiveGeometryGpuProgramParameters.setNull();
+			mActiveGeometryGpuProgramParameters = nullptr;
 			mCurrentGeometryProgram->unbindProgram();
 			mCurrentGeometryProgram = 0;
 		}
 		else if (gptype == GPT_FRAGMENT_PROGRAM && mCurrentFragmentProgram)
 		{
-			mActiveFragmentGpuProgramParameters.setNull();
+			mActiveFragmentGpuProgramParameters = nullptr;
 			mCurrentFragmentProgram->unbindProgram();
 			mCurrentFragmentProgram = 0;
 		}

+ 3 - 3
CamelotRenderer/RenderSystemGL/Source/OgreGLTexture.cpp

@@ -369,7 +369,7 @@ namespace Ogre {
 	{
 		mSurfaceList.clear();
 		
-		// For all faces and mipmaps, store surfaces as HardwarePixelBufferSharedPtr
+		// For all faces and mipmaps, store surfaces as HardwarePixelBufferPtr
 		bool wantGeneratedMips = (mUsage & TU_AUTOMIPMAP)!=0;
 		
 		// Do mipmapping in software? (uses GLU) For some cards, this is still needed. Of course,
@@ -382,7 +382,7 @@ namespace Ogre {
 			{
                 GLHardwarePixelBuffer *buf = new GLTextureBuffer("", getGLTextureTarget(), mTextureID, face, mip,
 						static_cast<HardwareBuffer::Usage>(mUsage), doSoftware && mip==0, mHwGamma, mFSAA);
-				mSurfaceList.push_back(HardwarePixelBufferSharedPtr(buf));
+				mSurfaceList.push_back(HardwarePixelBufferPtr(buf));
                 
                 /// Check for error
                 if(buf->getWidth()==0 || buf->getHeight()==0 || buf->getDepth()==0)
@@ -400,7 +400,7 @@ namespace Ogre {
 	}
 	
 	//---------------------------------------------------------------------------------------------
-	HardwarePixelBufferSharedPtr GLTexture::getBuffer(size_t face, size_t mipmap)
+	HardwarePixelBufferPtr GLTexture::getBuffer(size_t face, size_t mipmap)
 	{
 		if(face >= getNumFaces())
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Face index out of range",