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:
Shyotl
2012-10-16 02:33:05 -05:00
parent e8ec81bf04
commit 1b89e5c973
32 changed files with 381 additions and 136 deletions

View File

@@ -29,6 +29,10 @@
#include "llmath.h"
#include <set>
#if !LL_WINDOWS
#include <stdint.h>
#endif
#include <cmath>
#include "llerror.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_size = new_verts*16;
// S32 old_size = mNumVertices*16;
S32 old_size = mNumVertices*16;
//positions
mPositions = (LLVector4a*) realloc(mPositions, new_size);
mPositions = (LLVector4a*) ll_aligned_realloc_16(mPositions, new_size, old_size);
ll_assert_aligned(mPositions,16);
//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
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
@@ -7095,12 +7103,12 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
}
//allocate new buffer space
mPositions = (LLVector4a*) realloc(mPositions, new_count*sizeof(LLVector4a));
assert_aligned(mPositions, 16);
mNormals = (LLVector4a*) realloc(mNormals, new_count*sizeof(LLVector4a));
assert_aligned(mNormals, 16);
mTexCoords = (LLVector2*) realloc(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF);
assert_aligned(mTexCoords, 16);
mPositions = (LLVector4a*) ll_aligned_realloc_16(mPositions, new_count*sizeof(LLVector4a), mNumVertices*sizeof(LLVector4a));
ll_assert_aligned(mPositions, 16);
mNormals = (LLVector4a*) ll_aligned_realloc_16(mNormals, new_count*sizeof(LLVector4a), mNumVertices*sizeof(LLVector4a));
ll_assert_aligned(mNormals, 16);
mTexCoords = (LLVector2*) ll_aligned_realloc_16(mTexCoords, (new_count*sizeof(LLVector2)+0xF) & ~0xF, (mNumVertices*sizeof(LLVector2)+0xF) & ~0xF);
ll_assert_aligned(mTexCoords, 16);
mNumVertices = new_count;
@@ -7146,7 +7154,7 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat
new_count = mNumIndices + face.mNumIndices;
//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
U16* dst_idx = mIndices+mNumIndices;