Dragged in a bunch of alignment fixes from LL. Should allow disabling of tcmalloc on windows/linux32 if such is ever implemented.
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
#include "llallocator.h"
|
#include "llallocator.h"
|
||||||
|
|
||||||
#if LL_USE_TCMALLOC
|
#if (LL_USE_TCMALLOC && LL_USE_HEAP_PROFILER)
|
||||||
|
|
||||||
#include "google/heap-profiler.h"
|
#include "google/heap-profiler.h"
|
||||||
#include "google/commandlineflags_public.h"
|
#include "google/commandlineflags_public.h"
|
||||||
|
|||||||
@@ -444,13 +444,13 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
|
|||||||
{
|
{
|
||||||
// The new node isn't last. Place it between the previous node and
|
// The new node isn't last. Place it between the previous node and
|
||||||
// the successor.
|
// the successor.
|
||||||
newNode = (myprev + mydmi->second)/2.0;
|
newNode = (myprev + mydmi->second)/2.f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The new node is last. Bump myprev up to the next integer, add
|
// The new node is last. Bump myprev up to the next integer, add
|
||||||
// 1.0 and use that.
|
// 1.0 and use that.
|
||||||
newNode = std::ceil(myprev) + 1.0;
|
newNode = std::ceil(myprev) + 1.f;
|
||||||
}
|
}
|
||||||
// Now that newNode has a value that places it appropriately in mSignal,
|
// Now that newNode has a value that places it appropriately in mSignal,
|
||||||
// connect it.
|
// connect it.
|
||||||
|
|||||||
@@ -67,6 +67,17 @@ BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE;
|
|||||||
LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sMemAllocationTracker;
|
LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sMemAllocationTracker;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void ll_assert_aligned_func(uintptr_t ptr,U32 alignment)
|
||||||
|
{
|
||||||
|
#ifdef SHOW_ASSERT
|
||||||
|
// Redundant, place to set breakpoints.
|
||||||
|
if (ptr%alignment!=0)
|
||||||
|
{
|
||||||
|
llwarns << "alignment check failed" << llendl;
|
||||||
|
}
|
||||||
|
llassert(ptr%alignment==0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
//static
|
//static
|
||||||
void LLMemory::initClass()
|
void LLMemory::initClass()
|
||||||
{
|
{
|
||||||
@@ -246,21 +257,6 @@ U32 LLMemory::getAllocatedMemKB()
|
|||||||
return sAllocatedMemInKB ;
|
return sAllocatedMemInKB ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ll_allocate (size_t size)
|
|
||||||
{
|
|
||||||
if (size == 0)
|
|
||||||
{
|
|
||||||
llwarns << "Null allocation" << llendl;
|
|
||||||
}
|
|
||||||
void *p = malloc(size);
|
|
||||||
if (p == NULL)
|
|
||||||
{
|
|
||||||
LLMemory::freeReserve();
|
|
||||||
llerrs << "Out of memory Error" << llendl;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(LL_WINDOWS)
|
#if defined(LL_WINDOWS)
|
||||||
@@ -1415,7 +1411,7 @@ char* LLPrivateMemoryPool::allocate(U32 size)
|
|||||||
to_log = false ;
|
to_log = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char*)malloc(size) ;
|
return (char*)ll_aligned_malloc_16(size) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p ;
|
return p ;
|
||||||
@@ -1434,7 +1430,7 @@ void LLPrivateMemoryPool::freeMem(void* addr)
|
|||||||
|
|
||||||
if(!chunk)
|
if(!chunk)
|
||||||
{
|
{
|
||||||
free(addr) ; //release from heap
|
ll_aligned_free_16(addr) ; //release from heap
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1558,7 +1554,7 @@ LLPrivateMemoryPool::LLMemoryChunk* LLPrivateMemoryPool::addChunk(S32 chunk_inde
|
|||||||
|
|
||||||
mReservedPoolSize += preferred_size + overhead ;
|
mReservedPoolSize += preferred_size + overhead ;
|
||||||
|
|
||||||
char* buffer = (char*)malloc(preferred_size + overhead) ;
|
char* buffer = (char*)ll_aligned_malloc_16(preferred_size + overhead) ;
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
{
|
{
|
||||||
return NULL ;
|
return NULL ;
|
||||||
@@ -1626,7 +1622,7 @@ void LLPrivateMemoryPool::removeChunk(LLMemoryChunk* chunk)
|
|||||||
mReservedPoolSize -= chunk->getBufferSize() ;
|
mReservedPoolSize -= chunk->getBufferSize() ;
|
||||||
|
|
||||||
//release memory
|
//release memory
|
||||||
free(chunk->getBuffer()) ;
|
ll_aligned_free_16(chunk->getBuffer()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
U16 LLPrivateMemoryPool::findHashKey(const char* addr)
|
U16 LLPrivateMemoryPool::findHashKey(const char* addr)
|
||||||
@@ -1970,7 +1966,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size,
|
|||||||
|
|
||||||
if(!poolp)
|
if(!poolp)
|
||||||
{
|
{
|
||||||
p = (char*)malloc(size) ;
|
p = (char*)ll_aligned_malloc_16(size) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1999,7 +1995,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (char*)malloc(size) ;
|
return (char*)ll_aligned_malloc_16(size) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2024,7 +2020,7 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr
|
|||||||
{
|
{
|
||||||
if(!sPrivatePoolEnabled)
|
if(!sPrivatePoolEnabled)
|
||||||
{
|
{
|
||||||
free(addr) ; //private pool is disabled.
|
ll_aligned_free_16(addr) ; //private pool is disabled.
|
||||||
}
|
}
|
||||||
else if(!sInstance) //the private memory manager is destroyed, try the dangling list
|
else if(!sInstance) //the private memory manager is destroyed, try the dangling list
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,9 +39,14 @@
|
|||||||
#include <stdint.h> // uintptr_t
|
#include <stdint.h> // uintptr_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "llerror.h"
|
|
||||||
#include "llmemtype.h"
|
#include "llmemtype.h"
|
||||||
#if LL_DEBUG
|
|
||||||
|
#if LL_WINDOWS && LL_DEBUG
|
||||||
|
#define LL_CHECK_MEMORY llassert(_CrtCheckMemory());
|
||||||
|
#else
|
||||||
|
#define LL_CHECK_MEMORY
|
||||||
|
#endif
|
||||||
|
|
||||||
inline void* ll_aligned_malloc( size_t size, int align )
|
inline void* ll_aligned_malloc( size_t size, int align )
|
||||||
{
|
{
|
||||||
void* mem = malloc( size + (align - 1) + sizeof(void*) );
|
void* mem = malloc( size + (align - 1) + sizeof(void*) );
|
||||||
@@ -57,10 +62,11 @@ inline void ll_aligned_free( void* ptr )
|
|||||||
free( ((void**)ptr)[-1] );
|
free( ((void**)ptr)[-1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !LL_USE_TCMALLOC
|
||||||
inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
|
inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
|
||||||
{
|
{
|
||||||
#if defined(LL_WINDOWS)
|
#if defined(LL_WINDOWS)
|
||||||
return _mm_malloc(size, 16);
|
return _aligned_malloc(size, 16);
|
||||||
#elif defined(LL_DARWIN)
|
#elif defined(LL_DARWIN)
|
||||||
return malloc(size); // default osx malloc is 16 byte aligned.
|
return malloc(size); // default osx malloc is 16 byte aligned.
|
||||||
#else
|
#else
|
||||||
@@ -75,7 +81,7 @@ inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed wi
|
|||||||
inline void ll_aligned_free_16(void *p)
|
inline void ll_aligned_free_16(void *p)
|
||||||
{
|
{
|
||||||
#if defined(LL_WINDOWS)
|
#if defined(LL_WINDOWS)
|
||||||
_mm_free(p);
|
_aligned_free(p);
|
||||||
#elif defined(LL_DARWIN)
|
#elif defined(LL_DARWIN)
|
||||||
return free(p);
|
return free(p);
|
||||||
#else
|
#else
|
||||||
@@ -83,10 +89,35 @@ inline void ll_aligned_free_16(void *p)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // returned hunk MUST be freed with ll_aligned_free_16().
|
||||||
|
{
|
||||||
|
#if defined(LL_WINDOWS)
|
||||||
|
return _aligned_realloc(ptr, size, 16);
|
||||||
|
#elif defined(LL_DARWIN)
|
||||||
|
return realloc(ptr,size); // default osx malloc is 16 byte aligned.
|
||||||
|
#else
|
||||||
|
//FIXME: memcpy is SLOW
|
||||||
|
void* ret = ll_aligned_malloc_16(size);
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
memcpy(ret, ptr, old_size);
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // USE_TCMALLOC
|
||||||
|
// ll_aligned_foo_16 are not needed with tcmalloc
|
||||||
|
#define ll_aligned_malloc_16 malloc
|
||||||
|
#define ll_aligned_realloc_16(a,b,c) realloc(a,b)
|
||||||
|
#define ll_aligned_free_16 free
|
||||||
|
#endif // USE_TCMALLOC
|
||||||
|
|
||||||
inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed with ll_aligned_free_32().
|
inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed with ll_aligned_free_32().
|
||||||
{
|
{
|
||||||
#if defined(LL_WINDOWS)
|
#if defined(LL_WINDOWS)
|
||||||
return _mm_malloc(size, 32);
|
return _aligned_malloc(size, 32);
|
||||||
#elif defined(LL_DARWIN)
|
#elif defined(LL_DARWIN)
|
||||||
return ll_aligned_malloc( size, 32 );
|
return ll_aligned_malloc( size, 32 );
|
||||||
#else
|
#else
|
||||||
@@ -101,22 +132,13 @@ inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed wi
|
|||||||
inline void ll_aligned_free_32(void *p)
|
inline void ll_aligned_free_32(void *p)
|
||||||
{
|
{
|
||||||
#if defined(LL_WINDOWS)
|
#if defined(LL_WINDOWS)
|
||||||
_mm_free(p);
|
_aligned_free(p);
|
||||||
#elif defined(LL_DARWIN)
|
#elif defined(LL_DARWIN)
|
||||||
ll_aligned_free( p );
|
ll_aligned_free( p );
|
||||||
#else
|
#else
|
||||||
free(p); // posix_memalign() is compatible with heap deallocator
|
free(p); // posix_memalign() is compatible with heap deallocator
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else // LL_DEBUG
|
|
||||||
// ll_aligned_foo are noops now that we use tcmalloc everywhere (tcmalloc aligns automatically at appropriate intervals)
|
|
||||||
#define ll_aligned_malloc( size, align ) malloc(size)
|
|
||||||
#define ll_aligned_free( ptr ) free(ptr)
|
|
||||||
#define ll_aligned_malloc_16 malloc
|
|
||||||
#define ll_aligned_free_16 free
|
|
||||||
#define ll_aligned_malloc_32 malloc
|
|
||||||
#define ll_aligned_free_32 free
|
|
||||||
#endif // LL_DEBUG
|
|
||||||
|
|
||||||
#ifndef __DEBUG_PRIVATE_MEM__
|
#ifndef __DEBUG_PRIVATE_MEM__
|
||||||
#define __DEBUG_PRIVATE_MEM__ 0
|
#define __DEBUG_PRIVATE_MEM__ 0
|
||||||
@@ -521,6 +543,14 @@ void LLPrivateMemoryPoolTester::operator delete[](void* addr)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment);
|
||||||
|
|
||||||
|
#ifdef SHOW_ASSERT
|
||||||
|
#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment))
|
||||||
|
#else
|
||||||
|
#define ll_assert_aligned(ptr,alignment)
|
||||||
|
#endif
|
||||||
|
|
||||||
//EVENTUALLY REMOVE THESE:
|
//EVENTUALLY REMOVE THESE:
|
||||||
#include "llpointer.h"
|
#include "llpointer.h"
|
||||||
#include "llsingleton.h"
|
#include "llsingleton.h"
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ static const F32 MAX_FIELD_OF_VIEW = 175.f * DEG_TO_RAD;
|
|||||||
// roll(), pitch(), yaw()
|
// roll(), pitch(), yaw()
|
||||||
// etc...
|
// etc...
|
||||||
|
|
||||||
|
LL_ALIGN_PREFIX(16)
|
||||||
class LLCamera
|
class LLCamera
|
||||||
: public LLCoordFrame
|
: public LLCoordFrame
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLPlane mAgentPlanes[7]; //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP
|
LL_ALIGN_16(LLPlane mAgentPlanes[7]); //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP
|
||||||
U8 mPlaneMask[8]; // 8 for alignment
|
U8 mPlaneMask[8]; // 8 for alignment
|
||||||
|
|
||||||
F32 mView; // angle between top and bottom frustum planes in radians.
|
F32 mView; // angle between top and bottom frustum planes in radians.
|
||||||
@@ -122,13 +122,13 @@ private:
|
|||||||
S32 mViewHeightInPixels; // for ViewHeightInPixels() only
|
S32 mViewHeightInPixels; // for ViewHeightInPixels() only
|
||||||
F32 mNearPlane;
|
F32 mNearPlane;
|
||||||
F32 mFarPlane;
|
F32 mFarPlane;
|
||||||
LLPlane mLocalPlanes[4];
|
LL_ALIGN_16(LLPlane mLocalPlanes[4]);
|
||||||
F32 mFixedDistance; // Always return this distance, unless < 0
|
F32 mFixedDistance; // Always return this distance, unless < 0
|
||||||
LLVector3 mFrustCenter; // center of frustum and radius squared for ultra-quick exclusion test
|
LLVector3 mFrustCenter; // center of frustum and radius squared for ultra-quick exclusion test
|
||||||
F32 mFrustRadiusSquared;
|
F32 mFrustRadiusSquared;
|
||||||
|
|
||||||
LLPlane mWorldPlanes[PLANE_NUM];
|
LL_ALIGN_16(LLPlane mWorldPlanes[PLANE_NUM]);
|
||||||
LLPlane mHorizPlanes[HORIZ_PLANE_NUM];
|
LL_ALIGN_16(LLPlane mHorizPlanes[HORIZ_PLANE_NUM]);
|
||||||
|
|
||||||
U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in
|
U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ protected:
|
|||||||
void calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom);
|
void calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom);
|
||||||
void calculateFrustumPlanesFromWindow(F32 x1, F32 y1, F32 x2, F32 y2);
|
void calculateFrustumPlanesFromWindow(F32 x1, F32 y1, F32 x2, F32 y2);
|
||||||
void calculateWorldFrustumPlanes();
|
void calculateWorldFrustumPlanes();
|
||||||
};
|
} LL_ALIGN_POSTFIX(16);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
LLVector4a mColumns[3];
|
LL_ALIGN_16(LLVector4a mColumns[3]);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
class LLMatrix4a
|
class LLMatrix4a
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLVector4a mMatrix[4];
|
LL_ALIGN_16(LLVector4a mMatrix[4]);
|
||||||
|
|
||||||
inline void clear()
|
inline void clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -121,11 +121,12 @@ public:
|
|||||||
typedef typename std::vector<LLTreeListener<T>*>::iterator tree_listener_iter;
|
typedef typename std::vector<LLTreeListener<T>*>::iterator tree_listener_iter;
|
||||||
typedef LLOctreeNode<T>** child_list;
|
typedef LLOctreeNode<T>** child_list;
|
||||||
typedef LLOctreeNode<T>** child_iter;
|
typedef LLOctreeNode<T>** child_iter;
|
||||||
|
|
||||||
typedef LLTreeNode<T> BaseType;
|
typedef LLTreeNode<T> BaseType;
|
||||||
typedef LLOctreeNode<T> oct_node;
|
typedef LLOctreeNode<T> oct_node;
|
||||||
typedef LLOctreeListener<T> oct_listener;
|
typedef LLOctreeListener<T> oct_listener;
|
||||||
|
|
||||||
/*void* operator new(size_t size)
|
void* operator new(size_t size)
|
||||||
{
|
{
|
||||||
return ll_aligned_malloc_16(size);
|
return ll_aligned_malloc_16(size);
|
||||||
}
|
}
|
||||||
@@ -133,7 +134,7 @@ public:
|
|||||||
void operator delete(void* ptr)
|
void operator delete(void* ptr)
|
||||||
{
|
{
|
||||||
ll_aligned_free_16(ptr);
|
ll_aligned_free_16(ptr);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
LLOctreeNode( const LLVector4a& center,
|
LLOctreeNode( const LLVector4a& center,
|
||||||
const LLVector4a& size,
|
const LLVector4a& size,
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
// The plane normal = [A, B, C]
|
// The plane normal = [A, B, C]
|
||||||
// The closest approach = D / sqrt(A*A + B*B + C*C)
|
// The closest approach = D / sqrt(A*A + B*B + C*C)
|
||||||
|
|
||||||
|
|
||||||
|
LL_ALIGN_PREFIX(16)
|
||||||
class LLPlane
|
class LLPlane
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -100,7 +102,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LLVector4a mV;
|
LLVector4a mV;
|
||||||
};
|
} LL_ALIGN_POSTFIX(16);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,11 +67,10 @@ template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address)
|
|||||||
|
|
||||||
#define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16)
|
#define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
|
|
||||||
|
#include "llmemory.h"
|
||||||
#include "llsimdtypes.h"
|
#include "llsimdtypes.h"
|
||||||
#include "llsimdtypes.inl"
|
#include "llsimdtypes.inl"
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "llmemory.h"
|
||||||
#include "llmath.h"
|
#include "llmath.h"
|
||||||
#include "llquantize.h"
|
#include "llquantize.h"
|
||||||
|
|
||||||
@@ -44,7 +45,10 @@ extern const LLVector4a LL_V4A_EPSILON = reinterpret_cast<const LLVector4a&> ( F
|
|||||||
assert(dst != NULL);
|
assert(dst != NULL);
|
||||||
assert(bytes > 0);
|
assert(bytes > 0);
|
||||||
assert((bytes % sizeof(F32))== 0);
|
assert((bytes % sizeof(F32))== 0);
|
||||||
|
ll_assert_aligned(src,16);
|
||||||
|
ll_assert_aligned(dst,16);
|
||||||
|
assert(bytes%16==0);
|
||||||
|
|
||||||
F32* end = dst + (bytes / sizeof(F32) );
|
F32* end = dst + (bytes / sizeof(F32) );
|
||||||
|
|
||||||
if (bytes > 64)
|
if (bytes > 64)
|
||||||
@@ -189,6 +193,8 @@ void LLVector4a::quantize16( const LLVector4a& low, const LLVector4a& high )
|
|||||||
LLVector4a oneOverDelta;
|
LLVector4a oneOverDelta;
|
||||||
{
|
{
|
||||||
static LL_ALIGN_16( const F32 F_TWO_4A[4] ) = { 2.f, 2.f, 2.f, 2.f };
|
static LL_ALIGN_16( const F32 F_TWO_4A[4] ) = { 2.f, 2.f, 2.f, 2.f };
|
||||||
|
ll_assert_aligned(F_TWO_4A,16);
|
||||||
|
|
||||||
LLVector4a two; two.load4a( F_TWO_4A );
|
LLVector4a two; two.load4a( F_TWO_4A );
|
||||||
|
|
||||||
// Here we use _mm_rcp_ps plus one round of newton-raphson
|
// Here we use _mm_rcp_ps plus one round of newton-raphson
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class LLRotation;
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "llpreprocessor.h"
|
#include "llpreprocessor.h"
|
||||||
|
#include "llmemory.h"
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// FIRST TIME USERS PLEASE READ
|
// FIRST TIME USERS PLEASE READ
|
||||||
@@ -46,6 +47,7 @@ class LLRotation;
|
|||||||
// LLVector3/LLVector4.
|
// LLVector3/LLVector4.
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
|
||||||
|
LL_ALIGN_PREFIX(16)
|
||||||
class LLVector4a
|
class LLVector4a
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -90,6 +92,7 @@ public:
|
|||||||
|
|
||||||
LLVector4a()
|
LLVector4a()
|
||||||
{ //DO NOT INITIALIZE -- The overhead is completely unnecessary
|
{ //DO NOT INITIALIZE -- The overhead is completely unnecessary
|
||||||
|
ll_assert_aligned(this,16);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f)
|
LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f)
|
||||||
@@ -313,7 +316,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LLQuad mQ;
|
LLQuad mQ;
|
||||||
};
|
} LL_ALIGN_POSTFIX(16);
|
||||||
|
|
||||||
inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p)
|
inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#ifndef LL_VECTOR4LOGICAL_H
|
#ifndef LL_VECTOR4LOGICAL_H
|
||||||
#define LL_VECTOR4LOGICAL_H
|
#define LL_VECTOR4LOGICAL_H
|
||||||
|
|
||||||
|
#include "llmemory.h"
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// LLVector4Logical
|
// LLVector4Logical
|
||||||
@@ -77,6 +78,7 @@ public:
|
|||||||
inline LLVector4Logical& invert()
|
inline LLVector4Logical& invert()
|
||||||
{
|
{
|
||||||
static const LL_ALIGN_16(U32 allOnes[4]) = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
static const LL_ALIGN_16(U32 allOnes[4]) = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
|
||||||
|
ll_assert_aligned(allOnes,16);
|
||||||
mQ = _mm_andnot_ps( mQ, *(LLQuad*)(allOnes) );
|
mQ = _mm_andnot_ps( mQ, *(LLQuad*)(allOnes) );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
#include "llmath.h"
|
#include "llmath.h"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#if !LL_WINDOWS
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
#include "llmemtype.h"
|
#include "llmemtype.h"
|
||||||
@@ -6991,17 +6995,21 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con
|
|||||||
{
|
{
|
||||||
S32 new_verts = mNumVertices+1;
|
S32 new_verts = mNumVertices+1;
|
||||||
S32 new_size = new_verts*16;
|
S32 new_size = new_verts*16;
|
||||||
// S32 old_size = mNumVertices*16;
|
S32 old_size = mNumVertices*16;
|
||||||
|
|
||||||
//positions
|
//positions
|
||||||
mPositions = (LLVector4a*) realloc(mPositions, new_size);
|
mPositions = (LLVector4a*) ll_aligned_realloc_16(mPositions, new_size, old_size);
|
||||||
|
ll_assert_aligned(mPositions,16);
|
||||||
|
|
||||||
//normals
|
//normals
|
||||||
mNormals = (LLVector4a*) realloc(mNormals, new_size);
|
mNormals = (LLVector4a*) ll_aligned_realloc_16(mNormals, new_size, old_size);
|
||||||
|
ll_assert_aligned(mNormals,16);
|
||||||
|
|
||||||
//tex coords
|
//tex coords
|
||||||
new_size = ((new_verts*8)+0xF) & ~0xF;
|
new_size = ((new_verts*8)+0xF) & ~0xF;
|
||||||
mTexCoords = (LLVector2*) realloc(mTexCoords, new_size);
|
old_size = ((mNumVertices*8)+0xF) & ~0xF;
|
||||||
|
mTexCoords = (LLVector2*) ll_aligned_realloc_16(mTexCoords, new_size, old_size);
|
||||||
|
ll_assert_aligned(mTexCoords,16);
|
||||||
|
|
||||||
|
|
||||||
//just clear binormals
|
//just clear binormals
|
||||||
@@ -7095,12 +7103,12 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
|
|||||||
}
|
}
|
||||||
|
|
||||||
//allocate new buffer space
|
//allocate new buffer space
|
||||||
mPositions = (LLVector4a*) realloc(mPositions, new_count*sizeof(LLVector4a));
|
mPositions = (LLVector4a*) ll_aligned_realloc_16(mPositions, new_count*sizeof(LLVector4a), mNumVertices*sizeof(LLVector4a));
|
||||||
assert_aligned(mPositions, 16);
|
ll_assert_aligned(mPositions, 16);
|
||||||
mNormals = (LLVector4a*) realloc(mNormals, new_count*sizeof(LLVector4a));
|
mNormals = (LLVector4a*) ll_aligned_realloc_16(mNormals, new_count*sizeof(LLVector4a), mNumVertices*sizeof(LLVector4a));
|
||||||
assert_aligned(mNormals, 16);
|
ll_assert_aligned(mNormals, 16);
|
||||||
mTexCoords = (LLVector2*) realloc(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF);
|
mTexCoords = (LLVector2*) ll_aligned_realloc_16(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF, (mNumVertices*sizeof(LLVector2)+0xF) & ~0xF);
|
||||||
assert_aligned(mTexCoords, 16);
|
ll_assert_aligned(mTexCoords, 16);
|
||||||
|
|
||||||
mNumVertices = new_count;
|
mNumVertices = new_count;
|
||||||
|
|
||||||
@@ -7146,7 +7154,7 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
|
|||||||
new_count = mNumIndices + face.mNumIndices;
|
new_count = mNumIndices + face.mNumIndices;
|
||||||
|
|
||||||
//allocate new index buffer
|
//allocate new index buffer
|
||||||
mIndices = (U16*) realloc(mIndices, (new_count*sizeof(U16)+0xF) & ~0xF);
|
mIndices = (U16*) ll_aligned_realloc_16(mIndices, (new_count*sizeof(U16)+0xF) & ~0xF, (mNumIndices*sizeof(U16)+0xF) & ~0xF);
|
||||||
|
|
||||||
//get destination address into new index buffer
|
//get destination address into new index buffer
|
||||||
U16* dst_idx = mIndices+mNumIndices;
|
U16* dst_idx = mIndices+mNumIndices;
|
||||||
|
|||||||
@@ -37,6 +37,15 @@
|
|||||||
class LLVolumeTriangle : public LLRefCount
|
class LLVolumeTriangle : public LLRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
LLVolumeTriangle()
|
LLVolumeTriangle()
|
||||||
{
|
{
|
||||||
mBinIndex = -1;
|
mBinIndex = -1;
|
||||||
@@ -58,7 +67,7 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVector4a mPositionGroup;
|
LL_ALIGN_16(LLVector4a mPositionGroup);
|
||||||
|
|
||||||
const LLVector4a* mV[3];
|
const LLVector4a* mV[3];
|
||||||
U16 mIndex[3];
|
U16 mIndex[3];
|
||||||
@@ -78,6 +87,16 @@ class LLVolumeOctreeListener : public LLOctreeListener<LLVolumeTriangle>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle>* node);
|
LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle>* node);
|
||||||
~LLVolumeOctreeListener();
|
~LLVolumeOctreeListener();
|
||||||
|
|
||||||
@@ -104,8 +123,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LLVector4a mBounds[2]; // bounding box (center, size) of this node and all its children (tight fit to objects)
|
LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
|
||||||
LLVector4a mExtents[2]; // extents (min, max) of this node and all its children
|
LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLOctreeTriangleRayIntersect : public LLOctreeTraveler<LLVolumeTriangle>
|
class LLOctreeTriangleRayIntersect : public LLOctreeTraveler<LLVolumeTriangle>
|
||||||
|
|||||||
@@ -1027,7 +1027,8 @@ void LLModel::setVolumeFaceData(
|
|||||||
|
|
||||||
if (tc.get())
|
if (tc.get())
|
||||||
{
|
{
|
||||||
LLVector4a::memcpyNonAliased16((F32*) face.mTexCoords, (F32*) tc.get(), num_verts*2*sizeof(F32));
|
U32 tex_size = (num_verts*2*sizeof(F32)+0xF)&~0xF;
|
||||||
|
LLVector4a::memcpyNonAliased16((F32*) face.mTexCoords, (F32*) tc.get(), tex_size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1510,20 +1510,26 @@ void LLRender::pushUIMatrix()
|
|||||||
{
|
{
|
||||||
if (mUIOffset.empty())
|
if (mUIOffset.empty())
|
||||||
{
|
{
|
||||||
mUIOffset.push_back(new LLVector4a(0.f));
|
mUIOffset.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
||||||
|
mUIOffset.back()->splat(0.f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mUIOffset.push_back(new LLVector4a(*mUIOffset.back()));
|
const LLVector4a* last_entry = mUIOffset.back();
|
||||||
|
mUIOffset.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
||||||
|
*mUIOffset.back() = *last_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUIScale.empty())
|
if (mUIScale.empty())
|
||||||
{
|
{
|
||||||
mUIScale.push_back(new LLVector4a(1.f));
|
mUIScale.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
||||||
|
mUIScale.back()->splat(1.f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mUIScale.push_back(new LLVector4a(*mUIScale.back()));
|
const LLVector4a* last_entry = mUIScale.back();
|
||||||
|
mUIScale.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
||||||
|
*mUIScale.back() = *last_entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1533,9 +1539,9 @@ void LLRender::popUIMatrix()
|
|||||||
{
|
{
|
||||||
llerrs << "UI offset stack blown." << llendl;
|
llerrs << "UI offset stack blown." << llendl;
|
||||||
}
|
}
|
||||||
delete mUIOffset.back();
|
ll_aligned_free_16(mUIOffset.back());
|
||||||
mUIOffset.pop_back();
|
mUIOffset.pop_back();
|
||||||
delete mUIScale.back();
|
ll_aligned_free_16(mUIScale.back());
|
||||||
mUIScale.pop_back();
|
mUIScale.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class LLViewerTexture;
|
|||||||
const U32 SILHOUETTE_HIGHLIGHT = 0;
|
const U32 SILHOUETTE_HIGHLIGHT = 0;
|
||||||
|
|
||||||
// All data for new renderer goes into this class.
|
// All data for new renderer goes into this class.
|
||||||
|
LL_ALIGN_PREFIX(16)
|
||||||
class LLDrawable : public LLRefCount
|
class LLDrawable : public LLRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -81,6 +82,16 @@ public:
|
|||||||
|
|
||||||
static void initClass();
|
static void initClass();
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
LLDrawable() { init(); }
|
LLDrawable() { init(); }
|
||||||
MEM_TYPE_NEW(LLMemType::MTYPE_DRAWABLE);
|
MEM_TYPE_NEW(LLMemType::MTYPE_DRAWABLE);
|
||||||
|
|
||||||
@@ -290,8 +301,8 @@ public:
|
|||||||
} EDrawableFlags;
|
} EDrawableFlags;
|
||||||
|
|
||||||
private: //aligned members
|
private: //aligned members
|
||||||
LLVector4a mExtents[2];
|
LL_ALIGN_16(LLVector4a mExtents[2]);
|
||||||
LLVector4a mPositionGroup;
|
LL_ALIGN_16(LLVector4a mPositionGroup);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LLXformMatrix mXform;
|
LLXformMatrix mXform;
|
||||||
@@ -333,7 +344,7 @@ private:
|
|||||||
|
|
||||||
static U32 sNumZombieDrawables;
|
static U32 sNumZombieDrawables;
|
||||||
static LLDynamicArrayPtr<LLPointer<LLDrawable> > sDeadList;
|
static LLDynamicArrayPtr<LLPointer<LLDrawable> > sDeadList;
|
||||||
};
|
} LL_ALIGN_POSTFIX(16);
|
||||||
|
|
||||||
|
|
||||||
inline LLFace* LLDrawable::getFace(const S32 i) const
|
inline LLFace* LLDrawable::getFace(const S32 i) const
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ public:
|
|||||||
LLDriverParam(LLWearable *wearablep);
|
LLDriverParam(LLWearable *wearablep);
|
||||||
~LLDriverParam();
|
~LLDriverParam();
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Special: These functions are overridden by child classes
|
// Special: These functions are overridden by child classes
|
||||||
LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; }
|
LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; }
|
||||||
// This sets mInfo and calls initialization functions
|
// This sets mInfo and calls initialization functions
|
||||||
|
|||||||
@@ -36,6 +36,16 @@
|
|||||||
class LLViewerDynamicTexture : public LLViewerTexture
|
class LLViewerDynamicTexture : public LLViewerTexture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
|
LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
|
||||||
@@ -85,7 +95,7 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
BOOL mClamp;
|
BOOL mClamp;
|
||||||
LLCoordGL mOrigin;
|
LLCoordGL mOrigin;
|
||||||
LLCamera mCamera;
|
LL_ALIGN_16(LLCamera mCamera);
|
||||||
|
|
||||||
typedef std::set<LLViewerDynamicTexture*> instance_list_t;
|
typedef std::set<LLViewerDynamicTexture*> instance_list_t;
|
||||||
static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
|
static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
|
||||||
|
|||||||
@@ -64,6 +64,17 @@ class LLFace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LLFace(const LLFace& rhs)
|
LLFace(const LLFace& rhs)
|
||||||
{
|
{
|
||||||
*this = rhs;
|
*this = rhs;
|
||||||
|
|||||||
@@ -125,28 +125,28 @@ void LLPolyMeshSharedData::setupLOD(LLPolyMeshSharedData* reference_data)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void LLPolyMeshSharedData::freeMeshData()
|
void LLPolyMeshSharedData::freeMeshData()
|
||||||
{
|
{
|
||||||
if (!mReferenceData)
|
if (!mReferenceData)
|
||||||
{
|
{
|
||||||
mNumVertices = 0;
|
mNumVertices = 0;
|
||||||
|
|
||||||
delete [] mBaseCoords;
|
ll_aligned_free_16(mBaseCoords);
|
||||||
mBaseCoords = NULL;
|
mBaseCoords = NULL;
|
||||||
|
|
||||||
delete [] mBaseNormals;
|
ll_aligned_free_16(mBaseNormals);
|
||||||
mBaseNormals = NULL;
|
mBaseNormals = NULL;
|
||||||
|
|
||||||
delete [] mBaseBinormals;
|
ll_aligned_free_16(mBaseBinormals);
|
||||||
mBaseBinormals = NULL;
|
mBaseBinormals = NULL;
|
||||||
|
|
||||||
delete [] mTexCoords;
|
ll_aligned_free_16(mTexCoords);
|
||||||
mTexCoords = NULL;
|
mTexCoords = NULL;
|
||||||
|
|
||||||
delete [] mDetailTexCoords;
|
ll_aligned_free_16(mDetailTexCoords);
|
||||||
mDetailTexCoords = NULL;
|
mDetailTexCoords = NULL;
|
||||||
|
|
||||||
delete [] mWeights;
|
ll_aligned_free_16(mWeights);
|
||||||
mWeights = NULL;
|
mWeights = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mNumFaces = 0;
|
mNumFaces = 0;
|
||||||
delete [] mFaces;
|
delete [] mFaces;
|
||||||
@@ -228,14 +228,14 @@ U32 LLPolyMeshSharedData::getNumKB()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
|
BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
|
||||||
{
|
{
|
||||||
U32 i;
|
U32 i;
|
||||||
mBaseCoords = new LLVector4a[ numVertices ];
|
mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));
|
||||||
mBaseNormals = new LLVector4a[ numVertices ];
|
mBaseNormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));
|
||||||
mBaseBinormals = new LLVector4a[ numVertices ];
|
mBaseBinormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));
|
||||||
mTexCoords = new LLVector2[ numVertices ];
|
mTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2));
|
||||||
mDetailTexCoords = new LLVector2[ numVertices ];
|
mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2));
|
||||||
mWeights = new F32[ numVertices ];
|
mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32));
|
||||||
for (i = 0; i < numVertices; i++)
|
for (i = 0; i < numVertices; i++)
|
||||||
{
|
{
|
||||||
mBaseCoords[i].clear();
|
mBaseCoords[i].clear();
|
||||||
mBaseNormals[i].clear();
|
mBaseNormals[i].clear();
|
||||||
|
|||||||
@@ -428,6 +428,16 @@ public:
|
|||||||
LLPolySkeletalDistortion(LLVOAvatar *avatarp);
|
LLPolySkeletalDistortion(LLVOAvatar *avatarp);
|
||||||
~LLPolySkeletalDistortion();
|
~LLPolySkeletalDistortion();
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Special: These functions are overridden by child classes
|
// Special: These functions are overridden by child classes
|
||||||
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
|
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
|
||||||
// This sets mInfo and calls initialization functions
|
// This sets mInfo and calls initialization functions
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
|
|||||||
{
|
{
|
||||||
const S32 numVertices = mNumIndices;
|
const S32 numVertices = mNumIndices;
|
||||||
|
|
||||||
mCoords = new LLVector4a[numVertices];
|
mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||||
mNormals = new LLVector4a[numVertices];
|
mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||||
mBinormals = new LLVector4a[numVertices];
|
mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||||
mTexCoords = new LLVector2[numVertices];
|
mTexCoords = new LLVector2[numVertices];
|
||||||
mVertexIndices = new U32[numVertices];
|
mVertexIndices = new U32[numVertices];
|
||||||
|
|
||||||
@@ -90,17 +90,12 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ~LLPolyMorphData()
|
// ~LLPolyMorphData()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
LLPolyMorphData::~LLPolyMorphData()
|
LLPolyMorphData::~LLPolyMorphData()
|
||||||
{
|
{
|
||||||
delete [] mVertexIndices;
|
freeData();
|
||||||
delete [] mCoords;
|
|
||||||
delete [] mNormals;
|
|
||||||
delete [] mBinormals;
|
|
||||||
delete [] mTexCoords;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -119,12 +114,17 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// free any existing data
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
freeData();
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// allocate vertices
|
// allocate vertices
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
mCoords = new LLVector4a[numVertices];
|
mCoords = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||||
mNormals = new LLVector4a[numVertices];
|
mNormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||||
mBinormals = new LLVector4a[numVertices];
|
mBinormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(numVertices * sizeof(LLVector4a)));
|
||||||
mTexCoords = new LLVector2[numVertices];
|
mTexCoords = new LLVector2[numVertices];
|
||||||
// Actually, we are allocating more space than we need for the skiplist
|
// Actually, we are allocating more space than we need for the skiplist
|
||||||
mVertexIndices = new U32[numVertices];
|
mVertexIndices = new U32[numVertices];
|
||||||
@@ -207,6 +207,42 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// freeData()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void LLPolyMorphData::freeData()
|
||||||
|
{
|
||||||
|
if (mCoords != NULL)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(mCoords);
|
||||||
|
mCoords = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mNormals != NULL)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(mNormals);
|
||||||
|
mNormals = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mBinormals != NULL)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(mBinormals);
|
||||||
|
mBinormals = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mTexCoords != NULL)
|
||||||
|
{
|
||||||
|
delete [] mTexCoords;
|
||||||
|
mTexCoords = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mVertexIndices != NULL)
|
||||||
|
{
|
||||||
|
delete [] mVertexIndices;
|
||||||
|
mVertexIndices = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LLPolyMesh::saveLLM()
|
// LLPolyMesh::saveLLM()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -354,9 +390,9 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph)
|
|||||||
if (num_significant == 0)
|
if (num_significant == 0)
|
||||||
nindices = 1;
|
nindices = 1;
|
||||||
|
|
||||||
LLVector4a* new_coords = new LLVector4a[nindices];
|
LLVector4a* new_coords = static_cast<LLVector4a*>(ll_aligned_malloc_16(nindices * sizeof(LLVector4a)));
|
||||||
LLVector4a* new_normals = new LLVector4a[nindices];
|
LLVector4a* new_normals = static_cast<LLVector4a*>(ll_aligned_malloc_16(nindices * sizeof(LLVector4a)));
|
||||||
LLVector4a* new_binormals = new LLVector4a[nindices];
|
LLVector4a* new_binormals = static_cast<LLVector4a*>(ll_aligned_malloc_16(nindices * sizeof(LLVector4a)));
|
||||||
LLVector2* new_tex_coords = new LLVector2[nindices];
|
LLVector2* new_tex_coords = new LLVector2[nindices];
|
||||||
U32* new_vertex_indices = new U32[nindices];
|
U32* new_vertex_indices = new U32[nindices];
|
||||||
|
|
||||||
@@ -490,11 +526,7 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// reallocate vertices
|
// reallocate vertices
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
delete [] mVertexIndices;
|
freeData();
|
||||||
delete [] mCoords;
|
|
||||||
delete [] mNormals;
|
|
||||||
delete [] mBinormals;
|
|
||||||
delete [] mTexCoords;
|
|
||||||
|
|
||||||
mVertexIndices = new_vertex_indices;
|
mVertexIndices = new_vertex_indices;
|
||||||
mCoords = new_coords;
|
mCoords = new_coords;
|
||||||
|
|||||||
@@ -54,6 +54,16 @@ public:
|
|||||||
~LLPolyMorphData();
|
~LLPolyMorphData();
|
||||||
LLPolyMorphData(const LLPolyMorphData &rhs);
|
LLPolyMorphData(const LLPolyMorphData &rhs);
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
|
BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
|
||||||
const std::string& getName() { return mName; }
|
const std::string& getName() { return mName; }
|
||||||
|
|
||||||
@@ -77,6 +87,9 @@ public:
|
|||||||
F32 mMaxDistortion; // maximum single vertex distortion in a given morph
|
F32 mMaxDistortion; // maximum single vertex distortion in a given morph
|
||||||
LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph
|
LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph
|
||||||
LLPolyMeshSharedData* mMesh;
|
LLPolyMeshSharedData* mMesh;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void freeData();
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -412,6 +412,7 @@ void LLSpatialGroup::setVisible()
|
|||||||
|
|
||||||
void LLSpatialGroup::validate()
|
void LLSpatialGroup::validate()
|
||||||
{
|
{
|
||||||
|
ll_assert_aligned(this,64);
|
||||||
#if LL_OCTREE_PARANOIA_CHECK
|
#if LL_OCTREE_PARANOIA_CHECK
|
||||||
|
|
||||||
sg_assert(!isState(DIRTY));
|
sg_assert(!isState(DIRTY));
|
||||||
@@ -1075,6 +1076,8 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) :
|
|||||||
mLastUpdateDistance(-1.f),
|
mLastUpdateDistance(-1.f),
|
||||||
mLastUpdateTime(gFrameTimeSeconds)
|
mLastUpdateTime(gFrameTimeSeconds)
|
||||||
{
|
{
|
||||||
|
ll_assert_aligned(this,16);
|
||||||
|
|
||||||
sNodeCount++;
|
sNodeCount++;
|
||||||
LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
|
LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,16 @@ protected:
|
|||||||
~LLDrawInfo();
|
~LLDrawInfo();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LLDrawInfo(const LLDrawInfo& rhs)
|
LLDrawInfo(const LLDrawInfo& rhs)
|
||||||
{
|
{
|
||||||
@@ -111,7 +121,7 @@ public:
|
|||||||
F32 mPartSize;
|
F32 mPartSize;
|
||||||
F32 mVSize;
|
F32 mVSize;
|
||||||
LLSpatialGroup* mGroup;
|
LLSpatialGroup* mGroup;
|
||||||
LLFace* mFace; //associated face
|
LL_ALIGN_16(LLFace* mFace); //associated face
|
||||||
F32 mDistance;
|
F32 mDistance;
|
||||||
U32 mDrawMode;
|
U32 mDrawMode;
|
||||||
|
|
||||||
@@ -186,7 +196,7 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
LL_ALIGN_PREFIX(64)
|
LL_ALIGN_PREFIX(16)
|
||||||
class LLSpatialGroup : public LLOctreeListener<LLDrawable>
|
class LLSpatialGroup : public LLOctreeListener<LLDrawable>
|
||||||
{
|
{
|
||||||
friend class LLSpatialPartition;
|
friend class LLSpatialPartition;
|
||||||
@@ -198,6 +208,16 @@ public:
|
|||||||
*this = rhs;
|
*this = rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)
|
const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)
|
||||||
{
|
{
|
||||||
llerrs << "Illegal operation!" << llendl;
|
llerrs << "Illegal operation!" << llendl;
|
||||||
@@ -359,12 +379,12 @@ public:
|
|||||||
V4_COUNT = 10
|
V4_COUNT = 10
|
||||||
} eV4Index;
|
} eV4Index;
|
||||||
|
|
||||||
LLVector4a mBounds[2]; // bounding box (center, size) of this node and all its children (tight fit to objects)
|
LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
|
||||||
LLVector4a mExtents[2]; // extents (min, max) of this node and all its children
|
LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
|
||||||
LLVector4a mObjectExtents[2]; // extents (min, max) of objects in this node
|
LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node
|
||||||
LLVector4a mObjectBounds[2]; // bounding box (center, size) of objects in this node
|
LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node
|
||||||
LLVector4a mViewAngle;
|
LL_ALIGN_16(LLVector4a mViewAngle);
|
||||||
LLVector4a mLastUpdateViewAngle;
|
LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
|
||||||
|
|
||||||
F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3()
|
F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3()
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,16 @@ public:
|
|||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
// LLVisualParam Virtual functions
|
// LLVisualParam Virtual functions
|
||||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||||
/*virtual*/ void apply( ESex avatar_sex ) {}
|
/*virtual*/ void apply( ESex avatar_sex ) {}
|
||||||
@@ -143,6 +153,16 @@ public:
|
|||||||
LLTexLayerParamColor( LLVOAvatar* avatar );
|
LLTexLayerParamColor( LLVOAvatar* avatar );
|
||||||
/* virtual */ ~LLTexLayerParamColor();
|
/* virtual */ ~LLTexLayerParamColor();
|
||||||
|
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
||||||
|
|
||||||
// LLVisualParam Virtual functions
|
// LLVisualParam Virtual functions
|
||||||
|
|||||||
@@ -52,9 +52,20 @@ const F32 OGL_TO_CFR_ROTATION[16] = { 0.f, 0.f, -1.f, 0.f, // -Z becomes X
|
|||||||
const BOOL FOR_SELECTION = TRUE;
|
const BOOL FOR_SELECTION = TRUE;
|
||||||
const BOOL NOT_FOR_SELECTION = FALSE;
|
const BOOL NOT_FOR_SELECTION = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
LL_ALIGN_PREFIX(16)
|
||||||
class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera>
|
class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -138,6 +149,7 @@ protected:
|
|||||||
S16 mZoomSubregion;
|
S16 mZoomSubregion;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
};
|
} LL_ALIGN_POSTFIX(16);
|
||||||
|
|
||||||
|
|
||||||
#endif // LL_LLVIEWERCAMERA_H
|
#endif // LL_LLVIEWERCAMERA_H
|
||||||
|
|||||||
@@ -3139,7 +3139,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
|||||||
|
|
||||||
if (isImpostor() && !mNeedsImpostorUpdate)
|
if (isImpostor() && !mNeedsImpostorUpdate)
|
||||||
{
|
{
|
||||||
LLVector4a ext[2];
|
LL_ALIGN_16(LLVector4a ext[2]);
|
||||||
F32 distance;
|
F32 distance;
|
||||||
LLVector3 angle;
|
LLVector3 angle;
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,16 @@ protected:
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
|
LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
|
||||||
virtual void markDead();
|
virtual void markDead();
|
||||||
static void initClass(); // Initialize data that's only init'd once per class.
|
static void initClass(); // Initialize data that's only init'd once per class.
|
||||||
@@ -261,7 +271,7 @@ public:
|
|||||||
bool isBuilt() const { return mIsBuilt; }
|
bool isBuilt() const { return mIsBuilt; }
|
||||||
|
|
||||||
private: //aligned members
|
private: //aligned members
|
||||||
LLVector4a mImpostorExtents[2];
|
LL_ALIGN_16(LLVector4a mImpostorExtents[2]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients
|
BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients
|
||||||
|
|||||||
@@ -49,6 +49,16 @@ class LLVOAvatarSelf :
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
|
LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
|
||||||
virtual ~LLVOAvatarSelf();
|
virtual ~LLVOAvatarSelf();
|
||||||
virtual void markDead();
|
virtual void markDead();
|
||||||
|
|||||||
Reference in New Issue
Block a user