Merged vwr-cat..#$%$% whitespace diffs

meow-7.2.2
Graham Madarasz 2013-03-11 12:41:06 -07:00
commit 1051220d4b
10 changed files with 779 additions and 1152 deletions

View File

@ -121,6 +121,7 @@ set(llcommon_HEADER_FILES
linden_common.h
linked_lists.h
llaccountingcost.h
llalignedarray.h
llallocator.h
llallocator_heap_profile.h
llagentconstants.h

View File

@ -0,0 +1,151 @@
/**
* @file llalignedarray.h
* @brief A static array which obeys alignment restrictions and mimics std::vector accessors.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLALIGNEDARRAY_H
#define LL_LLALIGNEDARRAY_H
#include "llmemory.h"
#if LL_WINDOWS
#include "llvector4a.h" // for 16b fast copy
#endif
template <class T, U32 alignment>
class LLAlignedArray
{
public:
T* mArray;
U32 mElementCount;
U32 mCapacity;
LLAlignedArray();
~LLAlignedArray();
void push_back(const T& elem);
U32 size() const { return mElementCount; }
void resize(U32 size);
T* append(S32 N);
T& operator[](int idx);
const T& operator[](int idx) const;
};
template <class T, U32 alignment>
LLAlignedArray<T, alignment>::LLAlignedArray()
{
llassert(alignment >= 16);
mArray = NULL;
mElementCount = 0;
mCapacity = 0;
}
template <class T, U32 alignment>
LLAlignedArray<T, alignment>::~LLAlignedArray()
{
ll_aligned_free(mArray);
mArray = NULL;
mElementCount = 0;
mCapacity = 0;
}
template <class T, U32 alignment>
void LLAlignedArray<T, alignment>::push_back(const T& elem)
{
T* old_buf = NULL;
if (mCapacity <= mElementCount)
{
mCapacity++;
mCapacity *= 2;
T* new_buf = (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment);
if (mArray)
{
#if LL_WINDOWS
LLVector4a::memcpyNonAliased16((F32*) new_buf, (F32*) mArray, sizeof(T)*mElementCount);
#else
memcpy((F32*)new_buf, (F32*)mArray, sizeof(T)*mElementCount);
#endif
}
old_buf = mArray;
mArray = new_buf;
}
mArray[mElementCount++] = elem;
//delete old array here to prevent error on a.push_back(a[0])
ll_aligned_free(old_buf);
}
template <class T, U32 alignment>
void LLAlignedArray<T, alignment>::resize(U32 size)
{
if (mCapacity < size)
{
mCapacity = size+mCapacity*2;
T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment) : NULL;
if (mArray)
{
#if LL_WINDOWS
LLVector4a::memcpyNonAliased16((F32*) new_buf, (F32*) mArray, sizeof(T)*mElementCount);
#else
memcpy((F32*) new_buf, (F32*) mArray, sizeof(T)*mElementCount);
#endif
ll_aligned_free(mArray);
}
/*for (U32 i = mElementCount; i < mCapacity; ++i)
{
new(new_buf+i) T();
}*/
mArray = new_buf;
}
mElementCount = size;
}
template <class T, U32 alignment>
T& LLAlignedArray<T, alignment>::operator[](int idx)
{
llassert(idx < mElementCount);
return mArray[idx];
}
template <class T, U32 alignment>
const T& LLAlignedArray<T, alignment>::operator[](int idx) const
{
llassert(idx < mElementCount);
return mArray[idx];
}
template <class T, U32 alignment>
T* LLAlignedArray<T, alignment>::append(S32 N)
{
U32 sz = size();
resize(sz+N);
return &((*this)[sz]);
}
#endif

View File

@ -107,15 +107,14 @@ public:
inline void rotate(const LLVector4a& v, LLVector4a& res)
{
res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
res.mul(mMatrix[0]);
LLVector4a y;
y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
y.mul(mMatrix[1]);
LLVector4a y,z;
LLVector4a z;
res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));
y = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));
z = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));
res.mul(mMatrix[0]);
y.mul(mMatrix[1]);
z.mul(mMatrix[2]);
res.add(y);

View File

@ -460,16 +460,13 @@ inline void LLVector4a::setMax(const LLVector4a& lhs, const LLVector4a& rhs)
mQ = _mm_max_ps(lhs.mQ, rhs.mQ);
}
// Set this to (c * lhs) + rhs * ( 1 - c)
// Set this to lhs + (rhs-lhs)*c
inline void LLVector4a::setLerp(const LLVector4a& lhs, const LLVector4a& rhs, F32 c)
{
LLVector4a a = lhs;
a.mul(c);
LLVector4a b = rhs;
b.mul(1.f-c);
setAdd(a, b);
LLVector4a t;
t.setSub(rhs,lhs);
t.mul(c);
setAdd(lhs, t);
}
inline LLBool32 LLVector4a::isFinite3() const

File diff suppressed because it is too large Load Diff

View File

@ -37,11 +37,11 @@ class LLPath;
template <class T> class LLOctreeNode;
class LLVector4a;
class LLVolumeFace;
class LLVolume;
class LLVolumeTriangle;
#include "llalignedarray.h"
#include "lldarray.h"
#include "lluuid.h"
#include "v4color.h"
@ -50,6 +50,8 @@ class LLVolumeTriangle;
#include "v3math.h"
#include "v3dmath.h"
#include "v4math.h"
#include "llvector4a.h"
#include "llmatrix4a.h"
#include "llquaternion.h"
#include "llstrider.h"
#include "v4coloru.h"
@ -708,16 +710,16 @@ public:
LLFaceID mFaceID;
};
std::vector<LLVector3> mProfile;
std::vector<LLVector2> mNormals;
LLAlignedArray<LLVector4a, 64> mProfile;
//LLAlignedArray<LLVector4a, 64> mNormals;
std::vector<Face> mFaces;
std::vector<LLVector3> mEdgeNormals;
std::vector<LLVector3> mEdgeCenters;
//LLAlignedArray<LLVector4a, 64> mEdgeNormals;
//LLAlignedArray<LLVector4a, 64> mEdgeCenters;
friend std::ostream& operator<<(std::ostream &s, const LLProfile &profile);
protected:
void genNormals(const LLProfileParams& params);
static S32 getNumNGonPoints(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0);
void genNGon(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0);
@ -741,13 +743,29 @@ protected:
class LLPath
{
public:
struct PathPt
class PathPt
{
LLVector3 mPos;
LLVector2 mScale;
LLQuaternion mRot;
public:
LLMatrix4a mRot;
LLVector4a mPos;
LLVector4a mScale;
F32 mTexT;
PathPt() { mPos.setVec(0,0,0); mTexT = 0; mScale.setVec(0,0); mRot.loadIdentity(); }
F32 pad[3]; //for alignment
PathPt()
{
mPos.clear();
mTexT = 0;
mScale.clear();
mRot.setRows(LLVector4a(1,0,0,0),
LLVector4a(0,1,0,0),
LLVector4a(0,0,1,0));
//distinguished data in the pad for debugging
pad[0] = 3.14159f;
pad[1] = -3.14159f;
pad[2] = 0.585f;
}
};
public:
@ -779,7 +797,7 @@ public:
friend std::ostream& operator<<(std::ostream &s, const LLPath &path);
public:
std::vector<PathPt> mPath;
LLAlignedArray<PathPt, 64> mPath;
protected:
BOOL mOpen;
@ -951,11 +969,7 @@ protected:
~LLVolume(); // use unref
public:
struct Point
{
LLVector3 mPos;
};
struct FaceParams
{
LLFaceID mFaceID;
@ -978,8 +992,8 @@ public:
const LLProfile& getProfile() const { return *mProfilep; }
LLPath& getPath() const { return *mPathp; }
void resizePath(S32 length);
const std::vector<Point>& getMesh() const { return mMesh; }
const LLVector3& getMeshPt(const U32 i) const { return mMesh[i].mPos; }
const LLAlignedArray<LLVector4a,64>& getMesh() const { return mMesh; }
const LLVector4a& getMeshPt(const U32 i) const { return mMesh[i]; }
void setDirty() { mPathp->setDirty(); mProfilep->setDirty(); }
@ -994,10 +1008,7 @@ public:
S32 getSculptLevel() const { return mSculptLevel; }
void setSculptLevel(S32 level) { mSculptLevel = level; }
S32 *getTriangleIndices(U32 &num_indices) const;
// returns number of triangle indeces required for path/profile mesh
S32 getNumTriangleIndices() const;
static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts);
S32 getNumTriangles(S32* vcount = NULL) const;
@ -1070,7 +1081,8 @@ public:
LLVolumeParams mParams;
LLPath *mPathp;
LLProfile *mProfilep;
std::vector<Point> mMesh;
LLAlignedArray<LLVector4a,64> mMesh;
BOOL mGenerateSingleFace;
typedef std::vector<LLVolumeFace> face_list_t;

View File

@ -683,30 +683,36 @@ void LLVolumeImplFlexible::doFlexibleUpdate()
LLVector4(z_axis, 0.f),
LLVector4(delta_pos, 1.f));
LL_CHECK_MEMORY
for (i=0; i<=num_render_sections; ++i)
{
new_point = &path->mPath[i];
LLVector3 pos = newSection[i].mPosition * rel_xform;
LLQuaternion rot = mSection[i].mAxisRotation * newSection[i].mRotation * delta_rot;
if (!mUpdated || (new_point->mPos-pos).magVec()/mVO->mDrawable->mDistanceWRTCamera > 0.001f)
LLVector3 np(new_point->mPos.getF32ptr());
if (!mUpdated || (np-pos).magVec()/mVO->mDrawable->mDistanceWRTCamera > 0.001f)
{
new_point->mPos = newSection[i].mPosition * rel_xform;
new_point->mPos.load3((newSection[i].mPosition * rel_xform).mV);
mUpdated = FALSE;
}
new_point->mRot = rot;
new_point->mScale = newSection[i].mScale;
new_point->mRot.loadu(LLMatrix3(rot));
new_point->mScale.set(newSection[i].mScale.mV[0], newSection[i].mScale.mV[1], 0,1);
new_point->mTexT = ((F32)i)/(num_render_sections);
}
LL_CHECK_MEMORY
mLastSegmentRotation = parentSegmentRotation;
}
static LLFastTimer::DeclareTimer FTM_FLEXI_PREBUILD("Flexi Prebuild");
void LLVolumeImplFlexible::preRebuild()
{
if (!mUpdated)
{
LLFastTimer t(FTM_FLEXI_PREBUILD);
doFlexibleRebuild();
}
}

View File

@ -739,7 +739,7 @@ class LLVolumeGeometryManager: public LLGeometryManager
virtual void rebuildGeom(LLSpatialGroup* group);
virtual void rebuildMesh(LLSpatialGroup* group);
virtual void getGeometry(LLSpatialGroup* group);
void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE);
void genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE);
void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type);
};

View File

@ -1051,8 +1051,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
}
}
}
static LLCachedControl<bool> use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback");
bool cache_in_vram = use_transform_feedback && gTransformPositionProgram.mProgramObject &&
@ -4243,11 +4242,20 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
mFaceList.clear();
std::vector<LLFace*> fullbright_faces;
std::vector<LLFace*> bump_faces;
std::vector<LLFace*> simple_faces;
const U32 MAX_FACE_COUNT = 4096;
static LLFace** fullbright_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
static LLFace** bump_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
static LLFace** simple_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
static LLFace** alpha_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64);
U32 fullbright_count = 0;
U32 bump_count = 0;
U32 simple_count = 0;
U32 alpha_count = 0;
std::vector<LLFace*> alpha_faces;
U32 useage = group->mSpatialPartition->mBufferUsage;
U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask);
@ -4258,6 +4266,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
bool emissive = false;
{
LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST);
@ -4559,7 +4569,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (facep->canRenderAsMask())
{ //can be treated as alpha mask
simple_faces.push_back(facep);
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
}
}
else
{
@ -4567,7 +4580,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //only treat as alpha in the pipeline if < 100% transparent
drawablep->setState(LLDrawable::HAS_ALPHA);
}
alpha_faces.push_back(facep);
if (alpha_count < MAX_FACE_COUNT)
{
alpha_faces[alpha_count++] = facep;
}
}
}
else
@ -4582,33 +4598,51 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
if (te->getBumpmap())
{ //needs normal + binormal
bump_faces.push_back(facep);
if (bump_count < MAX_FACE_COUNT)
{
bump_faces[bump_count++] = facep;
}
}
else if (te->getShiny() || !te->getFullbright())
{ //needs normal
simple_faces.push_back(facep);
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
}
}
else
{ //doesn't need normal
facep->setState(LLFace::FULLBRIGHT);
fullbright_faces.push_back(facep);
if (fullbright_count < MAX_FACE_COUNT)
{
fullbright_faces[fullbright_count++] = facep;
}
}
}
else
{
if (te->getBumpmap() && LLPipeline::sRenderBump)
{ //needs normal + binormal
bump_faces.push_back(facep);
if (bump_count < MAX_FACE_COUNT)
{
bump_faces[bump_count++] = facep;
}
}
else if ((te->getShiny() && LLPipeline::sRenderBump) ||
!(te->getFullbright() || bake_sunlight))
{ //needs normal
simple_faces.push_back(facep);
if (simple_count < MAX_FACE_COUNT)
{
simple_faces[simple_count++] = facep;
}
}
else
{ //doesn't need normal
facep->setState(LLFace::FULLBRIGHT);
fullbright_faces.push_back(facep);
if (fullbright_count < MAX_FACE_COUNT)
{
fullbright_faces[fullbright_count++] = facep;
}
}
}
}
@ -4658,17 +4692,17 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (batch_textures)
{
bump_mask |= LLVertexBuffer::MAP_BINORMAL;
genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, TRUE);
genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, TRUE);
genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE);
genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, TRUE);
genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, simple_count, FALSE, TRUE);
genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, fullbright_count, FALSE, TRUE);
genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, bump_count, FALSE, FALSE);
genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, alpha_count, TRUE, TRUE);
}
else
{
genDrawInfo(group, simple_mask, simple_faces);
genDrawInfo(group, fullbright_mask, fullbright_faces);
genDrawInfo(group, bump_mask, bump_faces, FALSE, TRUE);
genDrawInfo(group, alpha_mask, alpha_faces, TRUE);
genDrawInfo(group, simple_mask, simple_faces, simple_count);
genDrawInfo(group, fullbright_mask, fullbright_faces, fullbright_count);
genDrawInfo(group, bump_mask, bump_faces, bump_count, FALSE, FALSE);
genDrawInfo(group, alpha_mask, alpha_faces, alpha_count, TRUE);
}
@ -4700,6 +4734,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
static LLFastTimer::DeclareTimer FTM_REBUILD_MESH_FLUSH("Flush Mesh");
void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
{
@ -4709,11 +4744,14 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
LLFastTimer ftm(FTM_REBUILD_VOLUME_VB);
LLFastTimer t(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); //make sure getgeometryvolume shows up in the right place in timers
S32 num_mapped_veretx_buffer = LLVertexBuffer::sMappedCount ;
group->mBuilt = 1.f;
std::set<LLVertexBuffer*> mapped_buffers;
S32 num_mapped_vertex_buffer = LLVertexBuffer::sMappedCount ;
const U32 MAX_BUFFER_COUNT = 4096;
LLVertexBuffer* locked_buffer[MAX_BUFFER_COUNT];
U32 buffer_count = 0;
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
{
@ -4723,7 +4761,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
{
LLVOVolume* vobj = drawablep->getVOVolume();
vobj->preRebuild();
if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
{
vobj->updateRelativeXform(true);
@ -4748,9 +4786,9 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
}
if (buff->isLocked())
if (buff->isLocked() && buffer_count < MAX_BUFFER_COUNT)
{
mapped_buffers.insert(buff);
locked_buffer[buffer_count++] = buff;
}
}
}
@ -4766,21 +4804,24 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
}
}
for (std::set<LLVertexBuffer*>::iterator iter = mapped_buffers.begin(); iter != mapped_buffers.end(); ++iter)
{
(*iter)->flush();
}
// don't forget alpha
if(group != NULL &&
!group->mVertexBuffer.isNull() &&
group->mVertexBuffer->isLocked())
{
group->mVertexBuffer->flush();
LLFastTimer t(FTM_REBUILD_MESH_FLUSH);
for (LLVertexBuffer** iter = locked_buffer, ** end_iter = locked_buffer+buffer_count; iter != end_iter; ++iter)
{
(*iter)->flush();
}
// don't forget alpha
if(group != NULL &&
!group->mVertexBuffer.isNull() &&
group->mVertexBuffer->isLocked())
{
group->mVertexBuffer->flush();
}
}
//if not all buffers are unmapped
if(num_mapped_veretx_buffer != LLVertexBuffer::sMappedCount)
if(num_mapped_vertex_buffer != LLVertexBuffer::sMappedCount)
{
llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ;
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
@ -4840,7 +4881,7 @@ static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_RESIZE_VB("Resize VB");
void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort, BOOL batch_textures)
void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort, BOOL batch_textures)
{
LLFastTimer t(FTM_REBUILD_VOLUME_GEN_DRAW_INFO);
@ -4876,17 +4917,18 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
if (!distance_sort)
{
//sort faces by things that break batches
std::sort(faces.begin(), faces.end(), CompareBatchBreakerModified());
std::sort(faces, faces+face_count, CompareBatchBreakerModified());
}
else
{
//sort faces by distance
std::sort(faces.begin(), faces.end(), LLFace::CompareDistanceGreater());
std::sort(faces, faces+face_count, LLFace::CompareDistanceGreater());
}
}
bool hud_group = group->isHUDGroup() ;
std::vector<LLFace*>::iterator face_iter = faces.begin();
LLFace** face_iter = faces;
LLFace** end_faces = faces+face_count;
LLSpatialGroup::buffer_map_t buffer_map;
@ -4917,7 +4959,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
bool flexi = false;
while (face_iter != faces.end())
while (face_iter != end_faces)
{
//pull off next face
LLFace* facep = *face_iter;
@ -4946,10 +4988,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
//sum up vertices needed for this render batch
std::vector<LLFace*>::iterator i = face_iter;
LLFace** i = face_iter;
++i;
std::vector<LLViewerTexture*> texture_list;
const U32 MAX_TEXTURE_COUNT = 32;
LLViewerTexture* texture_list[MAX_TEXTURE_COUNT];
U32 texture_count = 0;
{
LLFastTimer t(FTM_GEN_DRAW_INFO_FACE_SIZE);
@ -4957,12 +5002,15 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
{
U8 cur_tex = 0;
facep->setTextureIndex(cur_tex);
texture_list.push_back(tex);
if (texture_count < MAX_TEXTURE_COUNT)
{
texture_list[texture_count++] = tex;
}
if (can_batch_texture(facep))
{ //populate texture_list with any textures that can be batched
//move i to the next unbatchable face
while (i != faces.end())
while (i != end_faces)
{
facep = *i;
@ -4977,7 +5025,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
if (distance_sort)
{ //textures might be out of order, see if texture exists in current batch
bool found = false;
for (U32 tex_idx = 0; tex_idx < texture_list.size(); ++tex_idx)
for (U32 tex_idx = 0; tex_idx < texture_count; ++tex_idx)
{
if (facep->getTexture() == texture_list[tex_idx])
{
@ -4989,7 +5037,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
if (!found)
{
cur_tex = texture_list.size();
cur_tex = texture_count;
}
}
else
@ -5004,7 +5052,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
tex = facep->getTexture();
texture_list.push_back(tex);
if (texture_count < MAX_TEXTURE_COUNT)
{
texture_list[texture_count++] = tex;
}
}
if (geom_count + facep->getGeomCount() > max_vertices)
@ -5027,7 +5078,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
}
else
{
while (i != faces.end() &&
while (i != end_faces &&
(LLPipeline::sTextureBindTest || (distance_sort || (*i)->getTexture() == tex)))
{
facep = *i;

View File

@ -7261,7 +7261,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
else
{
//focus on alt-zoom target
focus_point = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal());
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
focus_point = LLVector3(gAgentCamera.getFocusGlobal()-region->getOriginGlobal());
}
}
}