diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index d588d687d..fd2a845c4 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -231,9 +231,9 @@ BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices ) mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); mBaseNormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); mBaseBinormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); - mTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2)); - mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2)); - mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32)); + mTexCoords = (LLVector2*) ll_aligned_malloc_16((numVertices+numVertices%2)*sizeof(LLVector2)); + mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16((numVertices+numVertices%2)*sizeof(LLVector2)); + mWeights = (F32*) ll_aligned_malloc_16(((numVertices)*sizeof(F32)+0xF) & ~0xF); for (i = 0; i < numVertices; i++) { mBaseCoords[i].clear(); diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index a9b843af6..0e2f6e05d 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -68,7 +68,16 @@ class LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo { friend class LLPolySkeletalDistortion; public: - + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + LLPolySkeletalDistortionInfo(); /*virtual*/ ~LLPolySkeletalDistortionInfo() {}; @@ -77,12 +86,12 @@ public: protected: typedef std::vector bone_info_list_t; bone_info_list_t mBoneInfoList; -}; - +} LL_ALIGN_POSTFIX(16); //----------------------------------------------------------------------------- // LLPolySkeletalDeformation // A set of joint scale data for deforming the avatar mesh //----------------------------------------------------------------------------- +LL_ALIGN_PREFIX(16) class LLPolySkeletalDistortion : public LLViewerVisualParam { public: diff --git a/indra/llmath/llmatrix3a.h b/indra/llmath/llmatrix3a.h index 9916cfd2d..6d896613c 100644 --- a/indra/llmath/llmatrix3a.h +++ b/indra/llmath/llmatrix3a.h @@ -40,6 +40,7 @@ // LLMatrix3a is the base class for LLRotation, which should be used instead any time you're dealing with a // rotation matrix. +LL_ALIGN_PREFIX(16) class LLMatrix3a { public: @@ -113,8 +114,9 @@ protected: LL_ALIGN_16(LLVector4a mColumns[3]); -}; +} LL_ALIGN_POSTFIX(16); +LL_ALIGN_PREFIX(16) class LLRotation : public LLMatrix3a { public: @@ -123,6 +125,6 @@ public: // Returns true if this rotation is orthonormal with det ~= 1 inline bool isOkRotation() const; -}; +} LL_ALIGN_POSTFIX(16); #endif diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 981e2176f..5189d852b 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -932,10 +932,10 @@ protected: MIN = 3 } eDName; - LLVector4a mCenter; - LLVector4a mSize; - LLVector4a mMax; - LLVector4a mMin; + LL_ALIGN_16(LLVector4a mCenter); + LL_ALIGN_16(LLVector4a mSize); + LL_ALIGN_16(LLVector4a mMax); + LL_ALIGN_16(LLVector4a mMin); oct_node* mParent; U8 mOctant; @@ -964,6 +964,26 @@ public: : BaseType(center, size, parent) { } + +#ifdef LL_OCTREE_POOLS + void* operator new(size_t size) + { + return getPool(size).malloc(); + } + void operator delete(void* ptr) + { + getPool(sizeof(LLOctreeNode)).free(ptr); + } +#else + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } +#endif bool balance() { diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 44c8327f5..5582e4398 100644 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -101,7 +101,7 @@ public: } private: - LLVector4a mV; + LL_ALIGN_16(LLVector4a mV); } LL_ALIGN_POSTFIX(16); diff --git a/indra/llmath/llquaternion2.h b/indra/llmath/llquaternion2.h index 6bc0f1555..6cfe91a02 100644 --- a/indra/llmath/llquaternion2.h +++ b/indra/llmath/llquaternion2.h @@ -40,6 +40,7 @@ ///////////////////////////// #include "llquaternion.h" +LL_ALIGN_PREFIX(16) class LLQuaternion2 { public: @@ -100,8 +101,8 @@ public: protected: - LLVector4a mQ; + LL_ALIGN_16(LLVector4a mQ); -}; +} LL_ALIGN_POSTFIX(16); #endif diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 9f84663d0..2f52a5949 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -750,10 +750,10 @@ public: class PathPt { public: - LLMatrix4a mRot; - LLVector4a mPos; + LL_ALIGN_16(LLMatrix4a mRot); + LL_ALIGN_16(LLVector4a mPos); - LLVector4a mScale; + LL_ALIGN_16(LLVector4a mScale); F32 mTexT; F32 pad[3]; //for alignment PathPt() diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 40d2e890c..61b90f68a 100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -127,13 +127,14 @@ public: LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children }; +LL_ALIGN_PREFIX(16) class LLOctreeTriangleRayIntersect : public LLOctreeTraveler { public: const LLVolumeFace* mFace; - LLVector4a mStart; - LLVector4a mDir; - LLVector4a mEnd; + LL_ALIGN_16(LLVector4a mStart); + LL_ALIGN_16(LLVector4a mDir); + LL_ALIGN_16(LLVector4a mEnd); LLVector4a* mIntersection; LLVector2* mTexCoord; LLVector4a* mNormal; @@ -148,7 +149,7 @@ public: void traverse(const LLOctreeNode* node); virtual void visit(const LLOctreeNode* node); -}; +} LL_ALIGN_POSTFIX(16); class LLVolumeOctreeValidate : public LLOctreeTraveler { diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 249dee999..d56422fd9 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -322,6 +322,7 @@ public: Does not stack. Caches inverse of projection matrix used in gGLObliqueProjectionInverse */ +LL_ALIGN_PREFIX(16) class LLGLUserClipPlane { public: @@ -332,11 +333,12 @@ public: void setPlane(F32 a, F32 b, F32 c, F32 d); private: - bool mApply; - LLMatrix4a mProjection; - LLMatrix4a mModelview; -}; + LL_ALIGN_16(LLMatrix4a mProjection); + LL_ALIGN_16(LLMatrix4a mModelview); + + bool mApply; +} LL_ALIGN_POSTFIX(16); /* Modify and load projection matrix to push depth values to far clip plane. diff --git a/indra/newview/llface.h b/indra/newview/llface.h index b82acb0d8..946098bae 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -239,7 +239,7 @@ public: static U32 getRiggedDataMask(U32 type); public: //aligned members - LLVector4a mExtents[2]; + LL_ALIGN_16(LLVector4a mExtents[2]); private: F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius ); diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index deae420fb..c775f4135 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -40,13 +40,24 @@ class LLVOAvatar; class LLViewerJointMesh; +LL_ALIGN_PREFIX(16) class LLPreviewAnimation : public LLViewerDynamicTexture { public: virtual ~LLPreviewAnimation(); public: - LLPreviewAnimation(S32 width, S32 height); + LLPreviewAnimation(S32 width, S32 height); + + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } /*virtual*/ S8 getType() const ; @@ -69,7 +80,7 @@ protected: LLVector3 mCameraOffset; LLVector3 mCameraRelPos; LLPointer mDummyAvatar; -}; +} LL_ALIGN_POSTFIX(16); class LLFloaterBvhPreview : public LLFloaterNameDesc { diff --git a/indra/newview/llfloaterexploreanimations.h b/indra/newview/llfloaterexploreanimations.h index 95d97c050..bb3b91469 100644 --- a/indra/newview/llfloaterexploreanimations.h +++ b/indra/newview/llfloaterexploreanimations.h @@ -49,7 +49,7 @@ private: protected: void draw(); - LLPreviewAnimation mAnimPreview; + LL_ALIGN_16(LLPreviewAnimation mAnimPreview); LLRect mPreviewRect; S32 mLastMouseX; S32 mLastMouseY; diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index c2186450a..0acb80fd8 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -52,6 +52,16 @@ protected: public: LLImagePreviewSculpted(S32 width, S32 height); + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + /*virtual*/ S8 getType() const ; void setPreviewTarget(LLImageRaw *imagep, F32 distance); @@ -85,6 +95,16 @@ protected: public: LLImagePreviewAvatar(S32 width, S32 height); + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + /*virtual*/ S8 getType() const ; void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 6ca55bb81..32d49ec94 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -302,6 +302,16 @@ public: LLModelPreview(S32 width, S32 height, LLFloater* fmp); virtual ~LLModelPreview(); + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + void resetPreviewTarget(); void setPreviewTarget(F32 distance); void setTexture(U32 name) { mTextureName = name; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index ea19593d5..be98a6083 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3576,6 +3576,7 @@ void renderLights(LLDrawable* drawablep) } } +LL_ALIGN_PREFIX(16) class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect { public: @@ -3648,7 +3649,7 @@ public: } } } -}; +} LL_ALIGN_POSTFIX(16); void renderRaycast(LLDrawable* drawablep) { diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index b082fad07..29f86656a 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -102,7 +102,7 @@ public: void validate(); - LLVector4a mExtents[2]; + LL_ALIGN_16(LLVector4a mExtents[2]); LLPointer mVertexBuffer; LLPointer mTexture; diff --git a/indra/newview/lltoolmorph.h b/indra/newview/lltoolmorph.h index 950a3ab11..a3f557a46 100644 --- a/indra/newview/lltoolmorph.h +++ b/indra/newview/lltoolmorph.h @@ -65,6 +65,16 @@ public: LLWearable *wearable, F32 param_weight); + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + /*virtual*/ S8 getType() const ; BOOL needsRender(); @@ -110,6 +120,17 @@ protected: /*virtual */ ~LLVisualParamReset(){} public: LLVisualParamReset(); + + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + /*virtual */ BOOL render(); /*virtual*/ S8 getType() const ; diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h index 959c883da..d732a87bb 100644 --- a/indra/newview/llviewertexlayer.h +++ b/indra/newview/llviewertexlayer.h @@ -79,6 +79,16 @@ public: LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height); virtual ~LLViewerTexLayerSetBuffer(); + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + public: /*virtual*/ S8 getType() const; BOOL isInitialized(void) const;