瀏覽代碼

Removed ogre memory stuff

Marko Pintera 13 年之前
父節點
當前提交
23a37a948f
共有 26 個文件被更改,包括 154 次插入231 次删除
  1. 2 2
      CamelotRenderer/OgreAxisAlignedBox.h
  2. 2 2
      CamelotRenderer/OgreD3D9HardwareBufferManager.h
  3. 7 7
      CamelotRenderer/OgreDefaultHardwareBufferManager.cpp
  4. 2 2
      CamelotRenderer/OgreDefaultHardwareBufferManager.h
  5. 4 4
      CamelotRenderer/OgreGpuProgram.cpp
  6. 2 2
      CamelotRenderer/OgreGpuProgramManager.cpp
  7. 4 4
      CamelotRenderer/OgreHardwareBufferManager.cpp
  8. 2 2
      CamelotRenderer/OgreHardwareIndexBuffer.cpp
  9. 2 2
      CamelotRenderer/OgreHardwareVertexBuffer.cpp
  10. 1 1
      CamelotRenderer/OgreHighLevelGpuProgram.cpp
  11. 4 4
      CamelotRenderer/OgreHighLevelGpuProgramManager.cpp
  12. 4 4
      CamelotRenderer/OgreMath.cpp
  13. 4 4
      CamelotRenderer/OgrePixelFormat.cpp
  14. 81 0
      CamelotRenderer/OgrePlatform.h
  15. 0 87
      CamelotRenderer/OgrePlatformInformation.h
  16. 0 71
      CamelotRenderer/OgrePortMemory.h
  17. 6 6
      CamelotRenderer/OgreRenderSystem.cpp
  18. 4 4
      CamelotRenderer/OgreRenderTarget.cpp
  19. 10 10
      CamelotRenderer/OgreVertexIndexData.cpp
  20. 2 2
      CamelotRenderer/OgreVertexIndexData.h
  21. 2 2
      CamelotRenderer/RenderSystemGL/Include/OgreGLDefaultHardwareBufferManager.h
  22. 2 2
      CamelotRenderer/RenderSystemGL/Include/OgreGLHardwareBufferManager.h
  23. 1 1
      CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLProgramFactory.h
  24. 1 1
      CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLProgram.cpp
  25. 3 3
      CamelotRenderer/RenderSystemGL/Source/OgreGLDefaultHardwareBufferManager.cpp
  26. 2 2
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareBufferManager.cpp

+ 2 - 2
CamelotRenderer/OgreAxisAlignedBox.h

@@ -141,7 +141,7 @@ namespace CamelotEngine {
 		~AxisAlignedBox()
 		{
 			if (mpCorners)
-				OGRE_FREE(mpCorners, MEMCATEGORY_SCENE_CONTROL);
+				free(mpCorners);
 		}
 
 
@@ -310,7 +310,7 @@ namespace CamelotEngine {
 			//   around face (looking onto the face)
 			// Only for optimization/compatibility.
 			if (!mpCorners)
-				mpCorners = OGRE_ALLOC_T(Vector3, 8, MEMCATEGORY_SCENE_CONTROL);
+				mpCorners = (Vector3*)malloc(sizeof(Vector3) * 8);
 
 			mpCorners[0] = mMinimum;
 			mpCorners[1].x = mMinimum.x; mpCorners[1].y = mMaximum.y; mpCorners[1].z = mMinimum.z;

+ 2 - 2
CamelotRenderer/OgreD3D9HardwareBufferManager.h

@@ -58,13 +58,13 @@ namespace CamelotEngine {
 	{
 	public:
 		D3D9HardwareBufferManager()
-			: HardwareBufferManager(OGRE_NEW D3D9HardwareBufferManagerBase()) 
+			: HardwareBufferManager(new D3D9HardwareBufferManagerBase()) 
 		{
 
 		}
 		~D3D9HardwareBufferManager()
 		{
-			OGRE_DELETE mImpl;
+			delete mImpl;
 		}
 	};
 

+ 7 - 7
CamelotRenderer/OgreDefaultHardwareBufferManager.cpp

@@ -35,7 +35,7 @@ namespace CamelotEngine {
 	: HardwareVertexBuffer(0, vertexSize, numVertices, usage, true, false) // always software, never shadowed
 	{
         // Allocate aligned memory for better SIMD processing friendly.
-        mpData = static_cast<unsigned char*>(OGRE_MALLOC_SIMD(mSizeInBytes, MEMCATEGORY_GEOMETRY));
+        mpData = static_cast<unsigned char*>(_aligned_malloc(mSizeInBytes, CM_SIMD_ALIGNMENT));
 	}
 	//-----------------------------------------------------------------------
 	DefaultHardwareVertexBuffer::DefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices, 
@@ -43,12 +43,12 @@ namespace CamelotEngine {
         : HardwareVertexBuffer(mgr, vertexSize, numVertices, usage, true, false) // always software, never shadowed
 	{
         // Allocate aligned memory for better SIMD processing friendly.
-        mpData = static_cast<unsigned char*>(OGRE_MALLOC_SIMD(mSizeInBytes, MEMCATEGORY_GEOMETRY));
+        mpData = static_cast<unsigned char*>(_aligned_malloc(mSizeInBytes, CM_SIMD_ALIGNMENT));
 	}
 	//-----------------------------------------------------------------------
     DefaultHardwareVertexBuffer::~DefaultHardwareVertexBuffer()
 	{
-		OGRE_FREE_SIMD(mpData, MEMCATEGORY_GEOMETRY);
+		_aligned_free(mpData);
 	}
 	//-----------------------------------------------------------------------
     void* DefaultHardwareVertexBuffer::lockImpl(size_t offset, size_t length, LockOptions options)
@@ -94,12 +94,12 @@ namespace CamelotEngine {
 		size_t numIndexes, HardwareBuffer::Usage usage) 
 		: HardwareIndexBuffer(0, idxType, numIndexes, usage, true, false) // always software, never shadowed
 	{
-		mpData = OGRE_ALLOC_T(unsigned char, mSizeInBytes, MEMCATEGORY_GEOMETRY);
+		mpData = (unsigned char*)malloc(sizeof(unsigned char) * mSizeInBytes);
 	}
 	//-----------------------------------------------------------------------
     DefaultHardwareIndexBuffer::~DefaultHardwareIndexBuffer()
 	{
-		OGRE_FREE(mpData, MEMCATEGORY_GEOMETRY);
+		free(mpData);
 	}
 	//-----------------------------------------------------------------------
     void* DefaultHardwareIndexBuffer::lockImpl(size_t offset, size_t length, LockOptions options)
@@ -155,7 +155,7 @@ namespace CamelotEngine {
         DefaultHardwareBufferManagerBase::createVertexBuffer(size_t vertexSize, 
 		size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer)
 	{
-        DefaultHardwareVertexBuffer* vb = OGRE_NEW DefaultHardwareVertexBuffer(this, vertexSize, numVerts, usage);
+        DefaultHardwareVertexBuffer* vb = new DefaultHardwareVertexBuffer(this, vertexSize, numVerts, usage);
         return HardwareVertexBufferPtr(vb);
 	}
     //-----------------------------------------------------------------------
@@ -163,7 +163,7 @@ namespace CamelotEngine {
         DefaultHardwareBufferManagerBase::createIndexBuffer(HardwareIndexBuffer::IndexType itype, 
 		size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer)
 	{
-        DefaultHardwareIndexBuffer* ib = OGRE_NEW DefaultHardwareIndexBuffer(itype, numIndexes, usage);
+        DefaultHardwareIndexBuffer* ib = new DefaultHardwareIndexBuffer(itype, numIndexes, usage);
 		return HardwareIndexBufferPtr(ib);
 	}
 }

+ 2 - 2
CamelotRenderer/OgreDefaultHardwareBufferManager.h

@@ -120,13 +120,13 @@ namespace CamelotEngine {
 	{
 	public:
 		DefaultHardwareBufferManager()
-			: HardwareBufferManager(OGRE_NEW DefaultHardwareBufferManagerBase()) 
+			: HardwareBufferManager(new DefaultHardwareBufferManagerBase()) 
 		{
 
 		}
 		~DefaultHardwareBufferManager()
 		{
-			OGRE_DELETE mImpl;
+			delete mImpl;
 		}
 	};
 

+ 4 - 4
CamelotRenderer/OgreGpuProgram.cpp

@@ -109,21 +109,21 @@ namespace CamelotEngine
 	void GpuProgram::createLogicalParameterMappingStructures(bool recreateIfExists) const
 	{
 		if (recreateIfExists || (mFloatLogicalToPhysical == nullptr))
-			mFloatLogicalToPhysical = GpuLogicalBufferStructPtr(OGRE_NEW GpuLogicalBufferStruct());
+			mFloatLogicalToPhysical = GpuLogicalBufferStructPtr(new GpuLogicalBufferStruct());
 		if (recreateIfExists || (mIntLogicalToPhysical == nullptr))
-			mIntLogicalToPhysical = GpuLogicalBufferStructPtr(OGRE_NEW GpuLogicalBufferStruct());
+			mIntLogicalToPhysical = GpuLogicalBufferStructPtr(new GpuLogicalBufferStruct());
 	}
 	//---------------------------------------------------------------------
 	void GpuProgram::createNamedParameterMappingStructures(bool recreateIfExists) const
 	{
 		if (recreateIfExists || (mConstantDefs == nullptr))
-			mConstantDefs = GpuNamedConstantsPtr(OGRE_NEW GpuNamedConstants());
+			mConstantDefs = GpuNamedConstantsPtr(new GpuNamedConstants());
 	}
     //-----------------------------------------------------------------------------
     GpuProgramParametersSharedPtr GpuProgram::createParameters(void)
     {
         // Default implementation simply returns standard parameters.
-        GpuProgramParametersSharedPtr ret = GpuProgramParametersSharedPtr(OGRE_NEW GpuProgramParameters());	
+        GpuProgramParametersSharedPtr ret = GpuProgramParametersSharedPtr(new GpuProgramParameters());	
 		
 		// set up named parameters, if any
 		if ((mConstantDefs != nullptr) && !mConstantDefs->map.empty())

+ 2 - 2
CamelotRenderer/OgreGpuProgramManager.cpp

@@ -97,7 +97,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------------
 	GpuProgramParametersSharedPtr GpuProgramManager::createParameters(void)
 	{
-		return GpuProgramParametersSharedPtr(OGRE_NEW GpuProgramParameters());
+		return GpuProgramParametersSharedPtr(new GpuProgramParameters());
 	}
 	//---------------------------------------------------------------------
 	GpuSharedParametersPtr GpuProgramManager::createSharedParameters(const String& name)
@@ -108,7 +108,7 @@ namespace CamelotEngine {
 				"The shared parameter set '" + name + "' already exists!", 
 				"GpuProgramManager::createSharedParameters");
 		}
-		GpuSharedParametersPtr ret(OGRE_NEW GpuSharedParameters(name));
+		GpuSharedParametersPtr ret(new GpuSharedParameters(name));
 		mSharedParametersMap[name] = ret;
 		return ret;
 	}

+ 4 - 4
CamelotRenderer/OgreHardwareBufferManager.cpp

@@ -105,22 +105,22 @@ namespace CamelotEngine {
     //-----------------------------------------------------------------------
     VertexDeclaration* HardwareBufferManagerBase::createVertexDeclarationImpl(void)
     {
-        return OGRE_NEW VertexDeclaration();
+        return new VertexDeclaration();
     }
     //-----------------------------------------------------------------------
     void HardwareBufferManagerBase::destroyVertexDeclarationImpl(VertexDeclaration* decl)
     {
-        OGRE_DELETE decl;
+        delete decl;
     }
     //-----------------------------------------------------------------------
 	VertexBufferBinding* HardwareBufferManagerBase::createVertexBufferBindingImpl(void)
 	{
-		return OGRE_NEW VertexBufferBinding();
+		return new VertexBufferBinding();
 	}
     //-----------------------------------------------------------------------
 	void HardwareBufferManagerBase::destroyVertexBufferBindingImpl(VertexBufferBinding* binding)
 	{
-		OGRE_DELETE binding;
+		delete binding;
 	}
     //-----------------------------------------------------------------------
     void HardwareBufferManagerBase::destroyAllDeclarations(void)

+ 2 - 2
CamelotRenderer/OgreHardwareIndexBuffer.cpp

@@ -57,7 +57,7 @@ namespace CamelotEngine {
         // Create a shadow buffer if required
         if (mUseShadowBuffer)
         {
-            mpShadowBuffer = OGRE_NEW DefaultHardwareIndexBuffer(mIndexType, 
+            mpShadowBuffer = new DefaultHardwareIndexBuffer(mIndexType, 
                 mNumIndexes, HardwareBuffer::HBU_DYNAMIC);
         }
 
@@ -73,7 +73,7 @@ namespace CamelotEngine {
 
         if (mpShadowBuffer)
         {
-            OGRE_DELETE mpShadowBuffer;
+            delete mpShadowBuffer;
         }
     }
 }

+ 2 - 2
CamelotRenderer/OgreHardwareVertexBuffer.cpp

@@ -52,7 +52,7 @@ namespace CamelotEngine {
         // Create a shadow buffer if required
         if (mUseShadowBuffer)
         {
-            mpShadowBuffer = OGRE_NEW DefaultHardwareVertexBuffer(mMgr, mVertexSize, 
+            mpShadowBuffer = new DefaultHardwareVertexBuffer(mMgr, mVertexSize, 
                     mNumVertices, HardwareBuffer::HBU_DYNAMIC);
         }
 
@@ -66,7 +66,7 @@ namespace CamelotEngine {
 		}
         if (mpShadowBuffer)
         {
-            OGRE_DELETE mpShadowBuffer;
+            delete mpShadowBuffer;
         }
     }
     //-----------------------------------------------------------------------------

+ 1 - 1
CamelotRenderer/OgreHighLevelGpuProgram.cpp

@@ -78,7 +78,7 @@ namespace CamelotEngine
 		CM_LOCK_AUTO_MUTEX
 
         // Make sure param defs are loaded
-        GpuProgramParametersSharedPtr params = GpuProgramParametersSharedPtr(OGRE_NEW GpuProgramParameters());
+        GpuProgramParametersSharedPtr params = GpuProgramParametersSharedPtr(new GpuProgramParameters());
 		// Only populate named parameters if we can support this program
 		if (this->isSupported())
 		{

+ 4 - 4
CamelotRenderer/OgreHighLevelGpuProgramManager.cpp

@@ -83,11 +83,11 @@ namespace CamelotEngine {
 		}
 		HighLevelGpuProgram* create(const String& source, const String& entryPoint, GpuProgramProfile profile)
 		{
-			return OGRE_NEW NullProgram();
+			return new NullProgram();
 		}
 		void destroy(HighLevelGpuProgram* prog)
 		{
-			OGRE_DELETE prog;
+			delete prog;
 		}
 
 	};
@@ -105,13 +105,13 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	HighLevelGpuProgramManager::HighLevelGpuProgramManager()
 	{
-		mNullFactory = OGRE_NEW NullProgramFactory();
+		mNullFactory = new NullProgramFactory();
 		addFactory(mNullFactory);
 	}
 	//-----------------------------------------------------------------------
 	HighLevelGpuProgramManager::~HighLevelGpuProgramManager()
 	{
-		OGRE_DELETE mNullFactory;
+		delete mNullFactory;
 	}
     //---------------------------------------------------------------------------
 	void HighLevelGpuProgramManager::addFactory(HighLevelGpuProgramFactory* factory)

+ 4 - 4
CamelotRenderer/OgreMath.cpp

@@ -63,8 +63,8 @@ namespace CamelotEngine
         mTrigTableSize = trigTableSize;
         mTrigTableFactor = mTrigTableSize / Math::TWO_PI;
 
-        mSinTable = OGRE_ALLOC_T(Real, mTrigTableSize, MEMCATEGORY_GENERAL);
-        mTanTable = OGRE_ALLOC_T(Real, mTrigTableSize, MEMCATEGORY_GENERAL);
+        mSinTable = (Real*)malloc(sizeof(Real) * mTrigTableSize);
+        mTanTable = (Real*)malloc(sizeof(Real) * mTrigTableSize);
 
         buildTrigTables();
     }
@@ -72,8 +72,8 @@ namespace CamelotEngine
     //-----------------------------------------------------------------------
     Math::~Math()
     {
-        OGRE_FREE(mSinTable, MEMCATEGORY_GENERAL);
-        OGRE_FREE(mTanTable, MEMCATEGORY_GENERAL);
+        free(mSinTable);
+        free(mTanTable);
     }
 
     //-----------------------------------------------------------------------

+ 4 - 4
CamelotRenderer/OgrePixelFormat.cpp

@@ -1382,7 +1382,7 @@ namespace CamelotEngine {
 			{
 				// Allocate temporary buffer of destination size in source format 
 				temp = PixelBox(scaled.getWidth(), scaled.getHeight(), scaled.getDepth(), src.format);
-				temp.data = OGRE_MALLOC(temp.getConsecutiveSize(), 0);
+				temp.data = malloc(temp.getConsecutiveSize());
 			}
 			// super-optimized: no conversion
 			switch (PixelUtil::getNumElemBytes(src.format)) 
@@ -1404,7 +1404,7 @@ namespace CamelotEngine {
 				// Blit temp buffer
 				PixelUtil::bulkPixelConversion(temp, scaled);
 
-				OGRE_FREE(temp.data, 0);
+				free(temp.data);
 			}
 			break;
 
@@ -1426,7 +1426,7 @@ namespace CamelotEngine {
 				{
 					// Allocate temp buffer of destination size in source format 
 					temp = PixelBox(scaled.getWidth(), scaled.getHeight(), scaled.getDepth(), src.format);
-					temp.data = OGRE_MALLOC(temp.getConsecutiveSize(), 0);
+					temp.data = malloc(temp.getConsecutiveSize());
 				}
 				// super-optimized: byte-oriented math, no conversion
 				switch (PixelUtil::getNumElemBytes(src.format)) 
@@ -1443,7 +1443,7 @@ namespace CamelotEngine {
 				{
 					// Blit temp buffer
 					PixelUtil::bulkPixelConversion(temp, scaled);
-					OGRE_FREE(temp.data, 0);
+					free(temp.data);
 				}
 				break;
 			case PF_FLOAT32_RGB:

+ 81 - 0
CamelotRenderer/OgrePlatform.h

@@ -253,6 +253,87 @@ typedef char int8;
 	typedef long long int64;
 #endif
 
+/* Initial CPU stuff to set.
+*/
+#define CM_CPU_UNKNOWN    0
+#define CM_CPU_X86        1
+#define CM_CPU_PPC        2
+#define OGRE_CPU_ARM        3
+
+/* Find CPU type
+*/
+#if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || \
+    (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#   define CM_CPU CM_CPU_X86
+
+#elif CM_PLATFORM == CM_PLATFORM_APPLE && defined(__BIG_ENDIAN__)
+#   define CM_CPU CM_CPU_PPC
+#elif CM_PLATFORM == CM_PLATFORM_APPLE
+#	define CM_CPU CM_CPU_X86
+#elif CM_PLATFORM == OGRE_PLATFORM_IPHONE && (defined(__i386__) || defined(__x86_64__))
+#	define CM_CPU CM_CPU_X86
+#elif defined(__arm__)
+#	define CM_CPU OGRE_CPU_ARM
+#else
+#   define CM_CPU CM_CPU_UNKNOWN
+#endif
+
+/* Find how to declare aligned variable.
+*/
+#if CM_COMPILER == CM_COMPILER_MSVC
+#   define CM_ALIGNED_DECL(type, var, alignment)  __declspec(align(alignment)) type var
+
+#elif CM_COMPILER == CM_COMPILER_GNUC
+#   define CM_ALIGNED_DECL(type, var, alignment)  type var __attribute__((__aligned__(alignment)))
+
+#else
+#   define CM_ALIGNED_DECL(type, var, alignment)  type var
+#endif
+
+/** Find perfect alignment (should supports SIMD alignment if SIMD available)
+*/
+#if CM_CPU == CM_CPU_X86
+#   define CM_SIMD_ALIGNMENT  16
+
+#else
+#   define CM_SIMD_ALIGNMENT  16
+#endif
+
+/* Declare variable aligned to SIMD alignment.
+*/
+#define CM_SIMD_ALIGNED_DECL(type, var)   CM_ALIGNED_DECL(type, var, CM_SIMD_ALIGNMENT)
+
+/* Define whether or not Ogre compiled with SSE supports.
+*/
+#if OGRE_DOUBLE_PRECISION == 0 && CM_CPU == CM_CPU_X86 && CM_COMPILER == CM_COMPILER_MSVC
+#   define __OGRE_HAVE_SSE  1
+#elif OGRE_DOUBLE_PRECISION == 0 && CM_CPU == CM_CPU_X86 && CM_COMPILER == CM_COMPILER_GNUC && CM_PLATFORM != OGRE_PLATFORM_APPLE_IOS
+#   define __OGRE_HAVE_SSE  1
+#endif
+
+/* Define whether or not Ogre compiled with VFP supports.
+ */
+#if OGRE_DOUBLE_PRECISION == 0 && CM_CPU == OGRE_CPU_ARM && CM_COMPILER == CM_COMPILER_GNUC && defined(__ARM_ARCH_6K__) && defined(__VFP_FP__)
+#   define __OGRE_HAVE_VFP  1
+#endif
+
+/* Define whether or not Ogre compiled with NEON supports.
+ */
+#if OGRE_DOUBLE_PRECISION == 0 && CM_CPU == OGRE_CPU_ARM && CM_COMPILER == CM_COMPILER_GNUC && defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__)
+#   define __OGRE_HAVE_NEON  1
+#endif
+
+#ifndef __OGRE_HAVE_SSE
+#   define __OGRE_HAVE_SSE  0
+#endif
+
+#ifndef __OGRE_HAVE_VFP
+#   define __OGRE_HAVE_VFP  0
+#endif
+
+#ifndef __OGRE_HAVE_NEON
+#   define __OGRE_HAVE_NEON  0
+#endif
 
 }
 

+ 0 - 87
CamelotRenderer/OgrePlatformInformation.h

@@ -30,92 +30,5 @@ THE SOFTWARE.
 
 #include "OgrePrerequisites.h"
 
-namespace CamelotEngine {
-//
-// TODO: Puts following macros into OgrePlatform.h?
-//
-
-/* Initial CPU stuff to set.
-*/
-#define CM_CPU_UNKNOWN    0
-#define CM_CPU_X86        1
-#define CM_CPU_PPC        2
-#define OGRE_CPU_ARM        3
-
-/* Find CPU type
-*/
-#if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || \
-    (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
-#   define CM_CPU CM_CPU_X86
-
-#elif CM_PLATFORM == CM_PLATFORM_APPLE && defined(__BIG_ENDIAN__)
-#   define CM_CPU CM_CPU_PPC
-#elif CM_PLATFORM == CM_PLATFORM_APPLE
-#	define CM_CPU CM_CPU_X86
-#elif CM_PLATFORM == OGRE_PLATFORM_IPHONE && (defined(__i386__) || defined(__x86_64__))
-#	define CM_CPU CM_CPU_X86
-#elif defined(__arm__)
-#	define CM_CPU OGRE_CPU_ARM
-#else
-#   define CM_CPU CM_CPU_UNKNOWN
-#endif
-
-/* Find how to declare aligned variable.
-*/
-#if CM_COMPILER == CM_COMPILER_MSVC
-#   define CM_ALIGNED_DECL(type, var, alignment)  __declspec(align(alignment)) type var
-
-#elif CM_COMPILER == CM_COMPILER_GNUC
-#   define CM_ALIGNED_DECL(type, var, alignment)  type var __attribute__((__aligned__(alignment)))
-
-#else
-#   define CM_ALIGNED_DECL(type, var, alignment)  type var
-#endif
-
-/** Find perfect alignment (should supports SIMD alignment if SIMD available)
-*/
-#if CM_CPU == CM_CPU_X86
-#   define CM_SIMD_ALIGNMENT  16
-
-#else
-#   define CM_SIMD_ALIGNMENT  16
-#endif
-
-/* Declare variable aligned to SIMD alignment.
-*/
-#define CM_SIMD_ALIGNED_DECL(type, var)   CM_ALIGNED_DECL(type, var, CM_SIMD_ALIGNMENT)
-
-/* Define whether or not Ogre compiled with SSE supports.
-*/
-#if OGRE_DOUBLE_PRECISION == 0 && CM_CPU == CM_CPU_X86 && CM_COMPILER == CM_COMPILER_MSVC
-#   define __OGRE_HAVE_SSE  1
-#elif OGRE_DOUBLE_PRECISION == 0 && CM_CPU == CM_CPU_X86 && CM_COMPILER == CM_COMPILER_GNUC && CM_PLATFORM != OGRE_PLATFORM_APPLE_IOS
-#   define __OGRE_HAVE_SSE  1
-#endif
-
-/* Define whether or not Ogre compiled with VFP supports.
- */
-#if OGRE_DOUBLE_PRECISION == 0 && CM_CPU == OGRE_CPU_ARM && CM_COMPILER == CM_COMPILER_GNUC && defined(__ARM_ARCH_6K__) && defined(__VFP_FP__)
-#   define __OGRE_HAVE_VFP  1
-#endif
-
-/* Define whether or not Ogre compiled with NEON supports.
- */
-#if OGRE_DOUBLE_PRECISION == 0 && CM_CPU == OGRE_CPU_ARM && CM_COMPILER == CM_COMPILER_GNUC && defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__)
-#   define __OGRE_HAVE_NEON  1
-#endif
-
-#ifndef __OGRE_HAVE_SSE
-#   define __OGRE_HAVE_SSE  0
-#endif
-
-#ifndef __OGRE_HAVE_VFP
-#   define __OGRE_HAVE_VFP  0
-#endif
-
-#ifndef __OGRE_HAVE_NEON
-#   define __OGRE_HAVE_NEON  0
-#endif
-}
 
 #endif  // __PlatformInformation_H__

+ 0 - 71
CamelotRenderer/OgrePortMemory.h

@@ -4,74 +4,3 @@
 
 #include <malloc.h>
 #include "OgreAlignedAllocator.h"
-
-#define OGRE_NEW new
-#define OGRE_DELETE delete
-
-#define OGRE_MALLOC(bytes, category) malloc(bytes)
-#define OGRE_ALLOC_T(T, count, category) static_cast<T*>(malloc(sizeof(T)*(count)))
-#define OGRE_FREE(ptr, category) free((void*)ptr)
-
-#define OGRE_NEW_T(T, category) new T
-#define OGRE_NEW_ARRAY_T(T, count, category) new T[count] 
-#define OGRE_DELETE_T(ptr, T, category) if(ptr){delete ptr;}
-#define OGRE_DELETE_ARRAY_T(ptr, T, count, category) if(ptr){delete[] ptr;}
-
-namespace CamelotEngine
-{
-	template<typename T>
-	T* constructN(T* basePtr, size_t count)
-	{
-		for (size_t i = 0; i < count; ++i)
-		{
-			new ((void*)(basePtr+i)) T();
-		}
-		return basePtr;
-	}
-}
-
-#define OGRE_MALLOC_SIMD(bytes, category) ::CamelotEngine::AlignedMemory::allocate(bytes)
-#define OGRE_MALLOC_ALIGN(bytes, category, align) ::CamelotEngine::AlignedMemory::allocate(bytes, align)
-#define OGRE_ALLOC_T_SIMD(T, count, category) static_cast<T*>(::CamelotEngine::AlignedMemory::allocate(sizeof(T)*(count),CM_SIMD_ALIGNMENT))
-#define OGRE_ALLOC_T_ALIGN(T, count, category, align) static_cast<T*>(::CamelotEngine::AlignedMemory::allocate(sizeof(T)*(count), align))
-#define OGRE_FREE_SIMD(ptr, category) ::CamelotEngine::AlignedMemory::deallocate(ptr)
-#define OGRE_FREE_ALIGN(ptr, category, align) ::CamelotEngine::AlignedMemory::deallocate(ptr)
-//
-#define OGRE_NEW_T_SIMD(T, category) new (::CamelotEngine::AlignedMemory::allocate(sizeof(T))) T
-#define OGRE_NEW_ARRAY_T_SIMD(T, count, category) ::CamelotEngine::constructN(static_cast<T*>(::CamelotEngine::AlignedMemory::allocate(sizeof(T)*(count))), count) 
-#define OGRE_DELETE_T_SIMD(ptr, T, category) if(ptr){(ptr)->~T(); ::CamelotEngine::AlignedMemory::deallocate(ptr);}
-#define OGRE_DELETE_ARRAY_T_SIMD(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::CamelotEngine::AlignedMemory::deallocate(ptr);}
-#define OGRE_NEW_T_ALIGN(T, category, align) new (::CamelotEngine::AlignedMemory::allocate(sizeof(T), align)) T
-#define OGRE_NEW_ARRAY_T_ALIGN(T, count, category, align) ::CamelotEngine::constructN(static_cast<T*>(::CamelotEngine::AlignedMemory::allocate(sizeof(T)*(count), align)), count) 
-#define OGRE_DELETE_T_ALIGN(ptr, T, category, align) if(ptr){(ptr)->~T(); ::CamelotEngine::AlignedMemory::deallocate(ptr);}
-#define OGRE_DELETE_ARRAY_T_ALIGN(ptr, T, count, category, align) if(ptr){for (size_t _b = 0; _b < count; ++_b) { (ptr)[_b].~T();} ::CamelotEngine::AlignedMemory::deallocate(ptr);}
-
-namespace CamelotEngine
-{
-	enum MemoryCategory
-	{
-		/// General purpose
-		MEMCATEGORY_GENERAL = 0,
-		/// Geometry held in main memory
-		MEMCATEGORY_GEOMETRY = 1, 
-		/// Animation data like tracks, bone matrices
-		MEMCATEGORY_ANIMATION = 2, 
-		/// Nodes, control data
-		MEMCATEGORY_SCENE_CONTROL = 3,
-		/// Scene object instances
-		MEMCATEGORY_SCENE_OBJECTS = 4,
-		/// Other resources
-		MEMCATEGORY_RESOURCE = 5,
-		/// Scripting
-		MEMCATEGORY_SCRIPTING = 6,
-		/// Rendersystem structures
-		MEMCATEGORY_RENDERSYS = 7,
-
-		
-		// sentinel value, do not use 
-		MEMCATEGORY_COUNT = 8
-	};
-	/** @} */
-	/** @} */
-
-}

+ 6 - 6
CamelotRenderer/OgreRenderSystem.cpp

@@ -75,7 +75,7 @@ namespace CamelotEngine {
     RenderSystem::~RenderSystem()
     {
         shutdown();
-		OGRE_DELETE mRealCapabilities;
+		delete mRealCapabilities;
 		mRealCapabilities = 0;
 		// Current capabilities managed externally
 		mCurrentCapabilities = 0;
@@ -220,7 +220,7 @@ namespace CamelotEngine {
     void RenderSystem::destroyRenderTarget(const String& name)
     {
         RenderTarget* rt = detachRenderTarget(name);
-        OGRE_DELETE rt;
+        delete rt;
     }
     //---------------------------------------------------------------------------------------------
     void RenderSystem::attachRenderTarget( RenderTarget &target )
@@ -393,7 +393,7 @@ namespace CamelotEngine {
 		for (HardwareOcclusionQueryList::iterator i = mHwOcclusionQueries.begin();
 			i != mHwOcclusionQueries.end(); ++i)
 		{
-			OGRE_DELETE *i;
+			delete *i;
 		}
 		mHwOcclusionQueries.clear();
 
@@ -405,9 +405,9 @@ namespace CamelotEngine {
 			if (!primary && it->second->isPrimary())
 				primary = it->second;
 			else
-				OGRE_DELETE it->second;
+				delete it->second;
 		}
-		OGRE_DELETE primary;
+		delete primary;
 		mRenderTargets.clear();
 
 		mPrioritisedRenderTargets.clear();
@@ -588,7 +588,7 @@ namespace CamelotEngine {
 		if (i != mHwOcclusionQueries.end())
 		{
 			mHwOcclusionQueries.erase(i);
-			OGRE_DELETE hq;
+			delete hq;
 		}
 	}
 	//-----------------------------------------------------------------------

+ 4 - 4
CamelotRenderer/OgreRenderTarget.cpp

@@ -50,7 +50,7 @@ namespace CamelotEngine {
         for (ViewportList::iterator i = mViewportList.begin();
             i != mViewportList.end(); ++i)
         {
-            OGRE_DELETE (*i).second;
+            delete (*i).second;
         }
     }
 
@@ -133,7 +133,7 @@ namespace CamelotEngine {
         }
         // Add viewport to list
         // Order based on Z-Order
-        Viewport* vp = OGRE_NEW Viewport(this, left, top, width, height, ZOrder);
+        Viewport* vp = new Viewport(this, left, top, width, height, ZOrder);
 
         mViewportList.insert(ViewportList::value_type(ZOrder, vp));
 
@@ -146,7 +146,7 @@ namespace CamelotEngine {
 
         if (it != mViewportList.end())
         {
-            OGRE_DELETE (*it).second;
+            delete (*it).second;
             mViewportList.erase(ZOrder);
         }
     }
@@ -155,7 +155,7 @@ namespace CamelotEngine {
     {
         for (ViewportList::iterator it = mViewportList.begin(); it != mViewportList.end(); ++it)
         {
-            OGRE_DELETE (*it).second;
+            delete (*it).second;
         }
 
         mViewportList.clear();

+ 10 - 10
CamelotRenderer/OgreVertexIndexData.cpp

@@ -74,7 +74,7 @@ namespace CamelotEngine {
 	{
 		HardwareBufferManagerBase* pManager = mgr ? mgr : mMgr;
 
-		VertexData* dest = OGRE_NEW VertexData(mgr);
+		VertexData* dest = new VertexData(mgr);
 
 		// Copy vertex buffers in turn
 		const VertexBufferBinding::VertexBufferBindingMap& bindings = 
@@ -672,7 +672,7 @@ namespace CamelotEngine {
 	IndexData* IndexData::clone(bool copyData, HardwareBufferManagerBase* mgr) const
 	{
 		HardwareBufferManagerBase* pManager = mgr ? mgr : HardwareBufferManager::getSingletonPtr();
-		IndexData* dest = OGRE_NEW IndexData();
+		IndexData* dest = new IndexData();
 		if (indexBuffer.get())
 		{
             if (copyData)
@@ -800,7 +800,7 @@ namespace CamelotEngine {
 
 		if (indexBuffer->getType() == HardwareIndexBuffer::IT_16BIT)
 		{
-			triangles = OGRE_ALLOC_T(Triangle, nTriangles, MEMCATEGORY_GEOMETRY);
+			triangles = (Triangle*) malloc(sizeof(Triangle) * nTriangles);
 			source = (uint16 *)buffer;
 			dest = (uint32 *)triangles;
 			for (i = 0; i < nIndexes; ++i) dest[i] = source[i];
@@ -809,8 +809,8 @@ namespace CamelotEngine {
 			triangles = (Triangle*)buffer;
 
 		// sort triangles based on shared edges
-		uint32 *destlist = OGRE_ALLOC_T(uint32, nTriangles, MEMCATEGORY_GEOMETRY);
-		unsigned char *visited = OGRE_ALLOC_T(unsigned char, nTriangles, MEMCATEGORY_GEOMETRY);
+		uint32 *destlist = (uint32*)malloc(sizeof(uint32) * nTriangles);
+		unsigned char *visited = (unsigned char*)malloc(sizeof(unsigned char) * nTriangles);
 
 		for (i = 0; i < nTriangles; ++i) visited[i] = 0;
 
@@ -854,11 +854,11 @@ namespace CamelotEngine {
 				source[j++] = (uint16)t->b;
 				source[j++] = (uint16)t->c;
 			}
-			OGRE_FREE(triangles, MEMCATEGORY_GEOMETRY);
+			free(triangles);
 		}
 		else
 		{
-			uint32 *reflist = OGRE_ALLOC_T(uint32, nTriangles, MEMCATEGORY_GEOMETRY);
+			uint32 *reflist = (uint32*)malloc(sizeof(uint32) * nTriangles);
 
 			// fill the referencebuffer
 			for (i = 0; i < nTriangles; ++i)
@@ -881,11 +881,11 @@ namespace CamelotEngine {
 				// destlist[i] = i; // not needed, it will not be used
 			}
 
-			OGRE_FREE(reflist, MEMCATEGORY_GEOMETRY);
+			free(reflist);
 		}
 
-		OGRE_FREE(destlist, MEMCATEGORY_GEOMETRY);
-		OGRE_FREE(visited, MEMCATEGORY_GEOMETRY);
+		free(destlist);
+		free(visited);
 					
 		indexBuffer->unlock();
 	}

+ 2 - 2
CamelotRenderer/OgreVertexIndexData.h

@@ -257,12 +257,12 @@ namespace CamelotEngine {
 			VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
 				: size ( cachesize ), type ( cachetype ), tail (0), buffersize (0), hit (0), miss (0)
 			{
-				cache = OGRE_ALLOC_T(uint32, size, MEMCATEGORY_GEOMETRY);
+				cache = (uint32*)malloc(sizeof(uint32) * size);
 			}
 
 			~VertexCacheProfiler()
 			{
-				OGRE_FREE(cache, MEMCATEGORY_GEOMETRY);
+				free(cache);
 			}
 
 			void profile(const HardwareIndexBufferPtr& indexBuffer);

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

@@ -119,13 +119,13 @@ namespace CamelotEngine {
 	{
 	public:
 		GLDefaultHardwareBufferManager()
-			: HardwareBufferManager(OGRE_NEW GLDefaultHardwareBufferManagerBase()) 
+			: HardwareBufferManager(new GLDefaultHardwareBufferManagerBase()) 
 		{
 
 		}
 		~GLDefaultHardwareBufferManager()
 		{
-			OGRE_DELETE mImpl;
+			delete mImpl;
 		}
 	};
 }

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

@@ -84,13 +84,13 @@ namespace CamelotEngine {
 	{
 	public:
 		GLHardwareBufferManager()
-			: HardwareBufferManager(OGRE_NEW GLHardwareBufferManagerBase()) 
+			: HardwareBufferManager(new GLHardwareBufferManagerBase()) 
 		{
 
 		}
 		~GLHardwareBufferManager()
 		{
-			OGRE_DELETE mImpl;
+			delete mImpl;
 		}
 
 

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLProgramFactory.h

@@ -33,7 +33,7 @@ THE SOFTWARE.
 #include "OgreHighLevelGpuProgramManager.h"
 #include "OgreGLSLExtSupport.h"
 
-namespace Ogre
+namespace CamelotEngine
 {
     /** Factory class for GLSL programs. */
     class _OgreGLExport GLSLProgramFactory : public HighLevelGpuProgramFactory

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

@@ -179,7 +179,7 @@ namespace CamelotEngine {
 	//-----------------------------------------------------------------------
 	void GLSLProgram::createLowLevelImpl(void)
 	{
-		mAssemblerProgram = GpuProgramPtr(OGRE_NEW GLSLGpuProgram( this ));
+		mAssemblerProgram = GpuProgramPtr(new GLSLGpuProgram( this ));
 	}
 	//---------------------------------------------------------------------------
 	void GLSLProgram::unloadImpl()

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

@@ -34,19 +34,19 @@ namespace CamelotEngine {
 																 HardwareBuffer::Usage usage)
 	: HardwareVertexBuffer(0, vertexSize, numVertices, usage, true, false) // always software, never shadowed
 	{
-        mpData = static_cast<unsigned char*>(OGRE_MALLOC_SIMD(mSizeInBytes, MEMCATEGORY_GEOMETRY));
+		mpData = static_cast<unsigned char*>(_aligned_malloc(mSizeInBytes, CM_SIMD_ALIGNMENT));
 	}
 	//-----------------------------------------------------------------------
 	GLDefaultHardwareVertexBuffer::GLDefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices, 
 		HardwareBuffer::Usage usage)
         : HardwareVertexBuffer(mgr, vertexSize, numVertices, usage, true, false) // always software, never shadowed
 	{
-        mpData = static_cast<unsigned char*>(OGRE_MALLOC_SIMD(mSizeInBytes, MEMCATEGORY_GEOMETRY));
+        mpData = static_cast<unsigned char*>(_aligned_malloc(mSizeInBytes, CM_SIMD_ALIGNMENT));
 	}
 	//-----------------------------------------------------------------------
     GLDefaultHardwareVertexBuffer::~GLDefaultHardwareVertexBuffer()
 	{
-		OGRE_FREE_SIMD(mpData, MEMCATEGORY_GEOMETRY);
+		_aligned_free(mpData);
 	}
 	//-----------------------------------------------------------------------
     void* GLDefaultHardwareVertexBuffer::lockImpl(size_t offset, size_t length, LockOptions options)

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

@@ -52,7 +52,7 @@ namespace CamelotEngine {
 		// Init scratch pool
 		// TODO make it a configurable size?
 		// 32-bit aligned buffer
-		mScratchBufferPool = static_cast<char*>(OGRE_MALLOC_ALIGN(SCRATCH_POOL_SIZE, MEMCATEGORY_GEOMETRY, SCRATCH_ALIGNMENT));
+		mScratchBufferPool = static_cast<char*>(_aligned_malloc(SCRATCH_POOL_SIZE, SCRATCH_ALIGNMENT));
 		GLScratchBufferAlloc* ptrAlloc = (GLScratchBufferAlloc*)mScratchBufferPool;
 		ptrAlloc->size = SCRATCH_POOL_SIZE - sizeof(GLScratchBufferAlloc);
 		ptrAlloc->free = 1;
@@ -79,7 +79,7 @@ namespace CamelotEngine {
         destroyAllDeclarations();
         destroyAllBindings();
 
-		OGRE_FREE_ALIGN(mScratchBufferPool, MEMCATEGORY_GEOMETRY, SCRATCH_ALIGNMENT);
+		_aligned_free(mScratchBufferPool);
     }
     //-----------------------------------------------------------------------
     HardwareVertexBufferPtr GLHardwareBufferManagerBase::createVertexBuffer(