summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/cmake/00-Common.cmake1
-rw-r--r--indra/llcommon/llmemory.cpp19
-rw-r--r--indra/llcommon/llmemory.h31
-rw-r--r--indra/newview/lldrawpoolbump.cpp6
-rw-r--r--indra/newview/llpolymesh.cpp9
-rw-r--r--indra/newview/llviewerjointmesh_sse.cpp4
-rw-r--r--indra/newview/llviewerjointmesh_sse2.cpp4
7 files changed, 39 insertions, 35 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 113e21a715..2cc8fa5e5f 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -169,6 +169,7 @@ if (LINUX)
add_definitions(-fvisibility=hidden)
# don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The viewer doesn't need to catch SIGCHLD anyway.
add_definitions(-DLL_IGNORE_SIGCHLD)
+ add_definitions(-march=pentium3 -mfpmath=sse -ftree-vectorize)
if (NOT STANDALONE)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 2a8015e26d..5c6ca30cdd 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -73,25 +73,6 @@ void LLMemory::freeReserve()
reserveMem = NULL;
}
-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;
-}
-
-void ll_release (void *p)
-{
- free(p);
-}
//----------------------------------------------------------------------------
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 1c6f64dd8b..f0813fb4ee 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -32,14 +32,33 @@
#ifndef LLMEMORY_H
#define LLMEMORY_H
+#include <stdlib.h>
+inline void* ll_aligned_malloc(size_t size, size_t alignment = 16) // alignment MUST be power-of-two multiple of sizeof(void*). returned hunk MUST be freed with ll_aligned_free().
+{
+#if defined(LL_WINDOWS)
+ return _mm_malloc(size, alignment);
+#else
+ void *rtn;
+ if (LL_LIKELY(0 == posix_memalign(&rtn, alignment, size)))
+ {
+ return rtn;
+ }
+ else // bad alignment requested, or out of memory
+ {
+ return NULL;
+ }
+#endif
+}
-extern S32 gTotalDAlloc;
-extern S32 gTotalDAUse;
-extern S32 gDACount;
-
-extern void* ll_allocate (size_t size);
-extern void ll_release (void *p);
+inline void ll_aligned_free(void *p)
+{
+#if defined(LL_WINDOWS)
+ _mm_free(p);
+#else
+ free(p); // posix_memalign() is compatible with heap deallocator
+#endif
+}
class LL_COMMON_API LLMemory
{
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 1fae8e518c..b7092f32a2 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -82,7 +82,7 @@ static S32 bump_channel = -1;
// static
void LLStandardBumpmap::init()
{
- LLStandardBumpmap::restoreGL();
+ // do nothing
}
// static
@@ -876,6 +876,8 @@ void LLBumpImageList::clear()
// these will be re-populated on-demand
mBrightnessEntries.clear();
mDarknessEntries.clear();
+
+ LLStandardBumpmap::clear();
}
void LLBumpImageList::shutdown()
@@ -892,8 +894,8 @@ void LLBumpImageList::destroyGL()
void LLBumpImageList::restoreGL()
{
- // Images will be recreated as they are needed.
LLStandardBumpmap::restoreGL();
+ // Images will be recreated as they are needed.
}
diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp
index 98c0191397..d0164c1033 100644
--- a/indra/newview/llpolymesh.cpp
+++ b/indra/newview/llpolymesh.cpp
@@ -35,7 +35,8 @@
//-----------------------------------------------------------------------------
#include "llviewerprecompiledheaders.h"
-#include "llpolymesh.h"
+#include "llfasttimer.h"
+#include "llmemory.h"
#include "llviewercontrol.h"
#include "llxmltree.h"
@@ -45,7 +46,7 @@
#include "llvolume.h"
#include "llendianswizzle.h"
-#include "llfasttimer.h"
+#include "llpolymesh.h"
#define HEADER_ASCII "Linden Mesh 1.0"
#define HEADER_BINARY "Linden Binary Mesh 1.0"
@@ -715,7 +716,7 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_
int nfloats = nverts * (2*4 + 3*3 + 2 + 4);
//use aligned vertex data to make LLPolyMesh SSE friendly
- mVertexData = (F32*) _mm_malloc(nfloats*4, 16);
+ mVertexData = (F32*) ll_aligned_malloc(nfloats*4, 16);
int offset = 0;
//all members must be 16-byte aligned except the last 3
@@ -766,7 +767,7 @@ LLPolyMesh::~LLPolyMesh()
delete [] mClothingWeights;
delete [] mTexCoords;
#else
- _mm_free(mVertexData);
+ ll_aligned_free(mVertexData);
#endif
}
diff --git a/indra/newview/llviewerjointmesh_sse.cpp b/indra/newview/llviewerjointmesh_sse.cpp
index e586b910cd..4fb5fafad1 100644
--- a/indra/newview/llviewerjointmesh_sse.cpp
+++ b/indra/newview/llviewerjointmesh_sse.cpp
@@ -94,8 +94,8 @@ void LLViewerJointMesh::updateGeometrySSE(LLFace *face, LLPolyMesh *mesh)
buffer->getNormalStrider(o_normals, mesh->mFaceVertexOffset);
const F32* weights = mesh->getWeights();
- const LLVector3* coords = mesh->getCoords();
- const LLVector3* normals = mesh->getNormals();
+ const LLVector3* coords = (const LLVector3*)mesh->getCoords();
+ const LLVector3* normals = (const LLVector3*)mesh->getNormals();
for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index)
{
if( weight != weights[index])
diff --git a/indra/newview/llviewerjointmesh_sse2.cpp b/indra/newview/llviewerjointmesh_sse2.cpp
index 550044c321..58cd75871d 100644
--- a/indra/newview/llviewerjointmesh_sse2.cpp
+++ b/indra/newview/llviewerjointmesh_sse2.cpp
@@ -101,8 +101,8 @@ void LLViewerJointMesh::updateGeometrySSE2(LLFace *face, LLPolyMesh *mesh)
buffer->getNormalStrider(o_normals, mesh->mFaceVertexOffset);
const F32* weights = mesh->getWeights();
- const LLVector3* coords = mesh->getCoords();
- const LLVector3* normals = mesh->getNormals();
+ const LLVector3* coords = (const LLVector3*)mesh->getCoords();
+ const LLVector3* normals = (const LLVector3*)mesh->getNormals();
for (U32 index = 0, index_end = mesh->getNumVertices(); index < index_end; ++index)
{
if( weight != weights[index])