Skip to content

Commit 3a78568

Browse files
committed
Intermediary commit #2.
1 parent 2d8fbb8 commit 3a78568

30 files changed

Lines changed: 765 additions & 170 deletions

indra/llrender/llgltexture.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class LLGLTexture : public LLTexture
4949
enum EBoostLevel
5050
{
5151
BOOST_NONE = 0,
52+
BOOST_ALM , //acts like NONE when ALM is on, max discard when ALM is off
5253
BOOST_AVATAR_BAKED ,
5354
BOOST_AVATAR ,
5455
BOOST_CLOUDS ,

indra/newview/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ set(viewer_SOURCE_FILES
440440
llsavedsettingsglue.cpp
441441
llscrollingpanelparam.cpp
442442
llscrollingpanelparambase.cpp
443+
llsculptidsize.cpp
443444
llselectmgr.cpp
444445
llshareavatarhandler.cpp
445446
llskinningutil.cpp
@@ -976,6 +977,7 @@ set(viewer_HEADER_FILES
976977
llsavedsettingsglue.h
977978
llscrollingpanelparam.h
978979
llscrollingpanelparambase.h
980+
llsculptidsize.h
979981
llselectmgr.h
980982
llsimplestat.h
981983
llskinningutil.h

indra/newview/llagent.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
934934
{
935935
gSky.mVOGroundp->setRegion(regionp);
936936
}
937+
938+
if (regionp->capabilitiesReceived())
939+
{
940+
regionp->requestSimulatorFeatures();
941+
}
942+
else
943+
{
944+
regionp->setCapabilitiesReceivedCallback(boost::bind(&LLViewerRegion::requestSimulatorFeatures, regionp));
945+
}
946+
937947
}
938948
else
939949
{

indra/newview/lldrawable.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "material_codes.h"
3333

3434
// viewer includes
35+
#include "llagent.h"
3536
#include "llcriticaldamp.h"
3637
#include "llface.h"
3738
#include "lllightconstants.h"
@@ -49,6 +50,7 @@
4950
#include "llspatialpartition.h"
5051
#include "llviewerobjectlist.h"
5152
#include "llviewerwindow.h"
53+
#include "lldrawpoolavatar.h"
5254

5355
const F32 MIN_INTERPOLATE_DISTANCE_SQUARED = 0.001f * 0.001f;
5456
const F32 MAX_INTERPOLATE_DISTANCE_SQUARED = 10.f * 10.f;
@@ -113,6 +115,28 @@ void LLDrawable::init()
113115
initVisible(sCurVisible - 2);//invisible for the current frame and the last frame.
114116
}
115117

118+
void LLDrawable::unload()
119+
{
120+
LLVOVolume *pVVol = getVOVolume();
121+
pVVol->setNoLOD();
122+
123+
for (S32 i = 0; i < getNumFaces(); i++)
124+
{
125+
LLFace* facep = getFace(i);
126+
if (facep->isState(LLFace::RIGGED))
127+
{
128+
LLDrawPoolAvatar* pool = (LLDrawPoolAvatar*)facep->getPool();
129+
if (pool) {
130+
pool->removeRiggedFace(facep);
131+
}
132+
facep->setVertexBuffer(NULL);
133+
}
134+
facep->clearState(LLFace::RIGGED);
135+
}
136+
137+
pVVol->markForUpdate(TRUE);
138+
}
139+
116140
// static
117141
void LLDrawable::initClass()
118142
{

indra/newview/lldrawable.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class LLDrawable
9898
void markDead(); // Mark this drawable as dead
9999
BOOL isDead() const { return isState(DEAD); }
100100
BOOL isNew() const { return !isState(BUILT); }
101-
101+
BOOL isUnload() const { return isState(FOR_UNLOAD); }
102102
BOOL isLight() const;
103103

104104
virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE);
@@ -155,6 +155,7 @@ class LLDrawable
155155
void mergeFaces(LLDrawable* src);
156156

157157
void init();
158+
void unload();
158159
void destroy();
159160

160161
void update();
@@ -296,6 +297,7 @@ class LLDrawable
296297
PARTITION_MOVE = 0x10000000,
297298
ANIMATED_CHILD = 0x20000000,
298299
ACTIVE_CHILD = 0x40000000,
300+
FOR_UNLOAD = 0x80000000, //should be unload from memory
299301
} EDrawableFlags;
300302

301303
public:

indra/newview/lldrawpoolavatar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
460460
}
461461
LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
462462

463-
if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull())
463+
if (avatarp->isDead() || avatarp->isUIAvatar() || avatarp->mDrawable.isNull())
464464
{
465465
return;
466466
}

indra/newview/llface.cpp

Lines changed: 31 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include "llviewershadermgr.h"
6060
#include "llviewertexture.h"
6161
#include "llvoavatar.h"
62+
#include "llsculptidsize.h"
6263

6364
#define LL_MAX_INDICES_COUNT 1000000
6465

@@ -851,90 +852,49 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
851852
//get bounding box
852853
if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))
853854
{
854-
//VECTORIZE THIS
855-
const LLMatrix4a& mat_vert = mat_vert_in;
856-
//mat_vert.loadu(mat_vert_in);
857-
858-
LLVector4a min,max;
859-
860855
if (f >= volume.getNumVolumeFaces())
861856
{
862857
LL_WARNS() << "Generating bounding box for invalid face index!" << LL_ENDL;
863858
f = 0;
864859
}
865860

866861
const LLVolumeFace &face = volume.getVolumeFace(f);
867-
min = face.mExtents[0];
868-
max = face.mExtents[1];
869862

870-
llassert(less_than_max_mag(min));
871-
llassert(less_than_max_mag(max));
872-
873-
//min, max are in volume space, convert to drawable render space
874863

875-
//get 8 corners of bounding box
876-
LLVector4Logical mask[6];
877-
878-
for (U32 i = 0; i < 6; ++i)
864+
// MAINT-8264 - stray vertices, especially in low LODs, cause bounding box errors.
865+
if (face.mNumVertices < 3)
879866
{
880-
mask[i].clear();
867+
LL_DEBUGS("RiggedBox") << "skipping face " << f << ", bad num vertices "
868+
<< face.mNumVertices << " " << face.mNumIndices << " " << face.mWeights << LL_ENDL;
869+
return FALSE;
881870
}
882871

883-
mask[0].setElement<2>(); //001
884-
mask[1].setElement<1>(); //010
885-
mask[2].setElement<1>(); //011
886-
mask[2].setElement<2>();
887-
mask[3].setElement<0>(); //100
888-
mask[4].setElement<0>(); //101
889-
mask[4].setElement<2>();
890-
mask[5].setElement<0>(); //110
891-
mask[5].setElement<1>();
892-
893-
LLVector4a v[8];
894-
895-
v[6] = min;
896-
v[7] = max;
897-
898-
for (U32 i = 0; i < 6; ++i)
899-
{
900-
v[i].setSelectWithMask(mask[i], min, max);
901-
}
902-
903-
LLVector4a tv[8];
904-
905-
//transform bounding box into drawable space
906-
for (U32 i = 0; i < 8; ++i)
907-
{
908-
mat_vert.affineTransform(v[i], tv[i]);
909-
}
910-
911-
//find bounding box
912-
LLVector4a& newMin = mExtents[0];
913-
LLVector4a& newMax = mExtents[1];
872+
//VECTORIZE THIS
873+
LLMatrix4a mat_vert = mat_vert_in;
874+
LLVector4a new_extents[2];
914875

915-
newMin = newMax = tv[0];
876+
llassert(less_than_max_mag(face.mExtents[0]));
877+
llassert(less_than_max_mag(face.mExtents[1]));
916878

917-
for (U32 i = 1; i < 8; ++i)
918-
{
919-
newMin.setMin(newMin, tv[i]);
920-
newMax.setMax(newMax, tv[i]);
921-
}
879+
matMulBoundBox(mat_vert, face.mExtents, mExtents);
922880

923881
if (!mDrawablep->isActive())
924882
{ // Shift position for region
925883
LLVector4a offset;
926884
offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
927-
newMin.add(offset);
928-
newMax.add(offset);
885+
mExtents[0].add(offset);
886+
mExtents[1].add(offset);
887+
LL_DEBUGS("RiggedBox") << "updating extents for face " << f
888+
<< " not active, added offset " << offset << LL_ENDL;
929889
}
930890

931891
LLVector4a t;
932-
t.setAdd(newMin,newMax);
892+
t.setAdd(mExtents[0],mExtents[1]);
933893
t.mul(0.5f);
934894

935895
mCenterLocal.set(t.getF32ptr());
936896

937-
t.setSub(newMax,newMin);
897+
t.setSub(mExtents[1],mExtents[0]);
938898
mBoundingSphereRadius = t.getLength3().getF32()*0.5f;
939899

940900
updateCenterAgent();
@@ -2521,12 +2481,25 @@ LLViewerTexture* LLFace::getTexture(U32 ch) const
25212481

25222482
void LLFace::setVertexBuffer(LLVertexBuffer* buffer)
25232483
{
2484+
if (buffer)
2485+
{
2486+
LLSculptIDSize::instance().inc(mDrawablep, buffer->getSize() + buffer->getIndicesSize());
2487+
}
2488+
2489+
if (mVertexBuffer)
2490+
{
2491+
LLSculptIDSize::instance().dec(mDrawablep);
2492+
}
25242493
mVertexBuffer = buffer;
25252494
llassert(verify());
25262495
}
25272496

25282497
void LLFace::clearVertexBuffer()
25292498
{
2499+
if (mVertexBuffer)
2500+
{
2501+
LLSculptIDSize::instance().dec(mDrawablep);
2502+
}
25302503
mVertexBuffer = NULL;
25312504
}
25322505

indra/newview/llfloaterbvhpreview.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,17 +1308,10 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicT
13081308
mCameraPitch = 0.f;
13091309
mCameraZoom = 1.f;
13101310

1311-
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion());
1312-
mDummyAvatar->createDrawable(&gPipeline);
1313-
mDummyAvatar->mIsDummy = TRUE;
1311+
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
13141312
mDummyAvatar->mSpecialRenderMode = 1;
1315-
mDummyAvatar->setPositionAgent(LLVector3::zero);
1316-
mDummyAvatar->slamPosition();
1317-
mDummyAvatar->updateJointLODs();
1318-
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
13191313
mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
13201314
mDummyAvatar->hideSkirt();
1321-
//gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance());
13221315

13231316
// stop extraneous animations
13241317
mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE );

indra/newview/llfloaterimagepreview.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,8 @@ LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDyna
621621
mCameraPitch = 0.f;
622622
mCameraZoom = 1.f;
623623

624-
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion());
625-
mDummyAvatar->createDrawable(&gPipeline);
626-
mDummyAvatar->mIsDummy = TRUE;
624+
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
627625
mDummyAvatar->mSpecialRenderMode = 2;
628-
mDummyAvatar->setPositionAgent(LLVector3::zero);
629-
mDummyAvatar->slamPosition();
630-
mDummyAvatar->updateJointLODs();
631-
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
632-
// gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance());
633626

634627
mTextureName = 0;
635628
}

indra/newview/llmeshrepository.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,7 +2918,7 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id)
29182918
{
29192919
LLMutexLock lock(mHeaderMutex);
29202920
mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
2921-
if (iter != mMeshHeader.end())
2921+
if (iter != mMeshHeader.end() && mMeshHeaderSize[mesh_id] > 0)
29222922
{
29232923
return iter->second;
29242924
}
@@ -2944,10 +2944,11 @@ void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3
29442944

29452945
S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod)
29462946
{
2947-
if (mThread)
2947+
if (mThread && mesh_id.notNull() && LLPrimitive::NO_LOD != lod)
29482948
{
2949+
LLMutexLock lock(mThread->mHeaderMutex);
29492950
LLMeshRepoThread::mesh_header_map::iterator iter = mThread->mMeshHeader.find(mesh_id);
2950-
if (iter != mThread->mMeshHeader.end())
2951+
if (iter != mThread->mMeshHeader.end() && mThread->mMeshHeaderSize[mesh_id] > 0)
29512952
{
29522953
LLSD& header = iter->second;
29532954

@@ -3087,7 +3088,7 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32
30873088
}
30883089
}
30893090

3090-
F32 max_area = 102932.f; //area of circle that encompasses region
3091+
F32 max_area = 102944.f; //area of circle that encompasses region (see MAINT-6559)
30913092
F32 min_area = 1.f;
30923093

30933094
F32 high_area = llmin(F_PI*dmid*dmid, max_area);

0 commit comments

Comments
 (0)