From c6aaf115ade4b335df9ca479992b08e028ffd910 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Dec 2009 09:26:53 -0600 Subject: Quick 'n dirty prioritization scheme for mesh loading. Sprinkling of fast timers in areas that are likely to stall. --- indra/newview/lldrawable.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index d60330024a..9a3be975cd 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -189,20 +189,30 @@ BOOL LLDrawable::isLight() const } } +static LLFastTimer::DeclareTimer FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); +static LLFastTimer::DeclareTimer FTM_DEREF_DRAWABLE("Deref"); +static LLFastTimer::DeclareTimer FTM_DELETE_FACES("Faces"); + void LLDrawable::cleanupReferences() { - LLFastTimer t(FTM_PIPELINE); + LLFastTimer t(FTM_CLEANUP_DRAWABLE); - std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); - mFaces.clear(); + { + LLFastTimer t(FTM_DELETE_FACES); + std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); + mFaces.clear(); + } gObjectList.removeDrawable(this); gPipeline.unlinkDrawable(this); - // Cleanup references to other objects - mVObjp = NULL; - mParent = NULL; + { + LLFastTimer t(FTM_DEREF_DRAWABLE); + // Cleanup references to other objects + mVObjp = NULL; + mParent = NULL; + } } void LLDrawable::cleanupDeadDrawables() -- cgit v1.2.3 From 4ffac619945cafc9c7da357bf56c9bc92e318b1b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 4 Mar 2010 15:30:15 -0600 Subject: Optimiziation pass. Added RenderUseStreamVBO to enable/disable usage of VBO's for streaming buffers. Faster traversal of LLCullResult members. Removal of llpushcallstacks from inner loops. Sprinkling in fast timers. --- indra/newview/lldrawable.cpp | 50 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 0447b06fcc..013577261c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -2,25 +2,31 @@ * @file lldrawable.cpp * @brief LLDrawable class implementation * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -667,8 +673,11 @@ BOOL LLDrawable::updateMoveDamped() return done_moving; } +static LLFastTimer::DeclareTimer FTM_UPDATE_DISTANCE("Update Distance"); + void LLDrawable::updateDistance(LLCamera& camera, bool force_update) { + LLFastTimer t(FTM_UPDATE_DISTANCE); if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { llerrs << "WTF?" << llendl; @@ -1301,8 +1310,12 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector* } } +static LLFastTimer::DeclareTimer FTM_BRIDGE_DISTANCE_UPDATE("Bridge Distance"); + void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) { + LLFastTimer t(FTM_BRIDGE_DISTANCE_UPDATE); + if (mDrawable == NULL) { markDead(); @@ -1360,11 +1373,10 @@ void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL imm BOOL LLSpatialBridge::updateMove() { - llassert_always(mDrawable); - llassert_always(mDrawable->mVObjp); - llassert_always(mDrawable->getRegion()); + llassert(mDrawable); + llassert(mDrawable->getRegion()); LLSpatialPartition* part = mDrawable->getRegion()->getSpatialPartition(mPartitionType); - llassert_always(part); + llassert(part); mOctree->balance(); if (part) -- cgit v1.2.3 From 60dde53d72e72b2f66390e93d9d44ca589b9b465 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 5 Mar 2010 10:49:05 -0600 Subject: Remove some fast timers that were being futzy. --- indra/newview/lldrawable.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 013577261c..38eda5bd2e 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -673,11 +673,8 @@ BOOL LLDrawable::updateMoveDamped() return done_moving; } -static LLFastTimer::DeclareTimer FTM_UPDATE_DISTANCE("Update Distance"); - void LLDrawable::updateDistance(LLCamera& camera, bool force_update) { - LLFastTimer t(FTM_UPDATE_DISTANCE); if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { llerrs << "WTF?" << llendl; @@ -1310,12 +1307,8 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector* } } -static LLFastTimer::DeclareTimer FTM_BRIDGE_DISTANCE_UPDATE("Bridge Distance"); - void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) { - LLFastTimer t(FTM_BRIDGE_DISTANCE_UPDATE); - if (mDrawable == NULL) { markDead(); -- cgit v1.2.3 From 8b88b093b9b59ba530e5e716609390fd00015efa Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Apr 2010 23:31:38 -0500 Subject: Fix for ridiculous bug that causes all sitting avatars to rebuild their geometry every frame. --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 390e950d75..03eee12707 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -533,7 +533,7 @@ F32 LLDrawable::updateXform(BOOL undamped) { // snap to final position dist_squared = 0.0f; - if (!isRoot()) + if (getVOVolume() && !isRoot()) { //child prim snapping to some position, needs a rebuild gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE); } -- cgit v1.2.3 From 1f4a4d62555836147ef5f5f94df725aa7fb49369 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Apr 2010 23:31:38 -0500 Subject: Fix for ridiculous bug that causes all sitting avatars to rebuild their geometry every frame. (transplanted from dd9dfa0c1629b21268f91ae0e46a51ca9d29f861) --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 38eda5bd2e..ed6a791e7f 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -523,7 +523,7 @@ F32 LLDrawable::updateXform(BOOL undamped) { // snap to final position dist_squared = 0.0f; - if (!isRoot()) + if (getVOVolume() && !isRoot()) { //child prim snapping to some position, needs a rebuild gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE); } -- cgit v1.2.3 From 26ba00b5554d20ee958693ced87b36fa7f6e3d99 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 3 Jun 2010 12:52:28 -0500 Subject: Vectorized octree and much of llspatialpartition and lldrawable. Octree driven raycast. --- indra/newview/lldrawable.cpp | 163 ++++++++++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 63 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 03eee12707..04e433dcfd 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -41,6 +41,7 @@ #include "llcriticaldamp.h" #include "llface.h" #include "lllightconstants.h" +#include "llmatrix4a.h" #include "llsky.h" #include "llsurfacepatch.h" #include "llviewercamera.h" @@ -91,8 +92,12 @@ void LLDrawable::incrementVisible() sCurVisible++; sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView(); } + void LLDrawable::init() { + mExtents = (LLVector4a*) _mm_malloc(sizeof(LLVector4a)*3, 32); + mPositionGroup = mExtents + 2; + // mXform mParent = NULL; mRenderType = 0; @@ -121,6 +126,11 @@ void LLDrawable::initClass() void LLDrawable::destroy() { + if (gDebugGL) + { + gPipeline.checkReferences(this); + } + if (isDead()) { sNumZombieDrawables--; @@ -139,6 +149,9 @@ void LLDrawable::destroy() { llinfos << "- Zombie drawables: " << sNumZombieDrawables << llendl; }*/ + + _mm_free(mExtents); + mExtents = mPositionGroup = NULL; } void LLDrawable::markDead() @@ -714,12 +727,14 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLFace* facep = getFace(i); if (force_update || facep->getPoolType() == LLDrawPool::POOL_ALPHA) { - LLVector3 box = (facep->mExtents[1] - facep->mExtents[0]) * 0.25f; + LLVector4a box; + box.setSub(facep->mExtents[1], facep->mExtents[0]); + box.mul(0.25f); LLVector3 v = (facep->mCenterLocal-camera.getOrigin()); const LLVector3& at = camera.getAtAxis(); for (U32 j = 0; j < 3; j++) { - v.mV[j] -= box.mV[j] * at.mV[j]; + v.mV[j] -= box[j] * at.mV[j]; } facep->mDistance = v * camera.getAtAxis(); } @@ -728,7 +743,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) } else { - pos = LLVector3(getPositionGroup()); + pos = LLVector3(getPositionGroup().getF32()); } pos -= camera.getOrigin(); @@ -777,7 +792,7 @@ BOOL LLDrawable::updateGeometry(BOOL priority) return res; } -void LLDrawable::shiftPos(const LLVector3 &shift_vector) +void LLDrawable::shiftPos(const LLVector4a &shift_vector) { if (isDead()) { @@ -809,9 +824,9 @@ void LLDrawable::shiftPos(const LLVector3 &shift_vector) for (S32 i = 0; i < getNumFaces(); i++) { LLFace *facep = getFace(i); - facep->mCenterAgent += shift_vector; - facep->mExtents[0] += shift_vector; - facep->mExtents[1] += shift_vector; + facep->mCenterAgent += LLVector3(shift_vector.getF32()); + facep->mExtents[0].add(shift_vector); + facep->mExtents[1].add(shift_vector); if (!volume && facep->hasGeometry()) { @@ -820,9 +835,9 @@ void LLDrawable::shiftPos(const LLVector3 &shift_vector) } } - mExtents[0] += shift_vector; - mExtents[1] += shift_vector; - mPositionGroup += LLVector3d(shift_vector); + mExtents[0].add(shift_vector); + mExtents[1].add(shift_vector); + mPositionGroup->add(shift_vector); } else if (mSpatialBridge) { @@ -830,9 +845,9 @@ void LLDrawable::shiftPos(const LLVector3 &shift_vector) } else if (isAvatar()) { - mExtents[0] += shift_vector; - mExtents[1] += shift_vector; - mPositionGroup += LLVector3d(shift_vector); + mExtents[0].add(shift_vector); + mExtents[1].add(shift_vector); + mPositionGroup->add(shift_vector); } mVObjp->onShift(shift_vector); @@ -844,21 +859,26 @@ const LLVector3& LLDrawable::getBounds(LLVector3& min, LLVector3& max) const return mXform.getPositionW(); } -const LLVector3* LLDrawable::getSpatialExtents() const +const LLVector4a* LLDrawable::getSpatialExtents() const { return mExtents; } -void LLDrawable::setSpatialExtents(LLVector3 min, LLVector3 max) +void LLDrawable::setSpatialExtents(const LLVector3& min, const LLVector3& max) +{ + mExtents[0].load3(min.mV); + mExtents[1].load3(max.mV); +} + +void LLDrawable::setSpatialExtents(const LLVector4a& min, const LLVector4a& max) { - LLVector3 size = max - min; mExtents[0] = min; - mExtents[1] = max; + mExtents[1] = max; } -void LLDrawable::setPositionGroup(const LLVector3d& pos) +void LLDrawable::setPositionGroup(const LLVector4a& pos) { - mPositionGroup.setVec(pos); + *mPositionGroup = pos; } void LLDrawable::updateSpatialExtents() @@ -872,7 +892,7 @@ void LLDrawable::updateSpatialExtents() if (mSpatialBridge.notNull()) { - mPositionGroup.setVec(0,0,0); + mPositionGroup->splat(0.f); } } @@ -1083,59 +1103,72 @@ void LLSpatialBridge::updateSpatialExtents() root->rebound(); } - LLXformMatrix* mat = mDrawable->getXform(); - - LLVector3 offset = root->mBounds[0]; - LLVector3 size = root->mBounds[1]; + LLVector4a offset; + LLVector4a size = root->mBounds[1]; - LLVector3 center = LLVector3(0,0,0) * mat->getWorldMatrix(); - LLQuaternion rotation = LLQuaternion(mat->getWorldMatrix()); + //VECTORIZE THIS + LLMatrix4a mat; + mat.loadu(mDrawable->getXform()->getWorldMatrix()); + + LLVector4a t; + t.splat(0.f); + + LLVector4a center; + mat.affineTransform(t, center); - offset *= rotation; - center += offset; + mat.rotate(root->mBounds[0], offset); + center.add(offset); - LLVector3 v[4]; + LLVector4a v[4]; + //get 4 corners of bounding box - v[0] = (size * rotation); - v[1] = (LLVector3(-size.mV[0], -size.mV[1], size.mV[2]) * rotation); - v[2] = (LLVector3(size.mV[0], -size.mV[1], -size.mV[2]) * rotation); - v[3] = (LLVector3(-size.mV[0], size.mV[1], -size.mV[2]) * rotation); + mat.rotate(size,v[0]); - LLVector3& newMin = mExtents[0]; - LLVector3& newMax = mExtents[1]; + LLVector4a scale; + + scale.set(-1.f, -1.f, 1.f); + scale.mul(size); + mat.rotate(scale, v[1]); + + scale.set(1.f, -1.f, -1.f); + scale.mul(size); + mat.rotate(scale, v[2]); + + scale.set(-1.f, 1.f, -1.f); + scale.mul(size); + mat.rotate(scale, v[3]); + + + LLVector4a& newMin = mExtents[0]; + LLVector4a& newMax = mExtents[1]; newMin = newMax = center; for (U32 i = 0; i < 4; i++) { - for (U32 j = 0; j < 3; j++) - { - F32 delta = fabsf(v[i].mV[j]); - F32 min = center.mV[j] - delta; - F32 max = center.mV[j] + delta; - - if (min < newMin.mV[j]) - { - newMin.mV[j] = min; - } - - if (max > newMax.mV[j]) - { - newMax.mV[j] = max; - } - } - } + LLVector4a delta; + delta.setAbs(v[i]); + LLVector4a min; + min.setSub(center, delta); + LLVector4a max; + max.setAdd(center, delta); - LLVector3 diagonal = newMax - newMin; - mRadius = diagonal.magVec() * 0.5f; + newMin.setMin(min); + newMax.setMax(max); + } + + LLVector4a diagonal; + diagonal.setSub(newMax, newMin); + mRadius = diagonal.length3() * 0.5f; - mPositionGroup.setVec((newMin + newMax) * 0.5f); + mPositionGroup->setAdd(newMin,newMax); + mPositionGroup->mul(0.5f); updateBinRadius(); } void LLSpatialBridge::updateBinRadius() { - mBinRadius = llmin((F32) mOctree->getSize().mdV[0]*0.5f, 256.f); + mBinRadius = llmin( mOctree->getSize()[0]*0.5f, 256.f); } LLCamera LLSpatialBridge::transformCamera(LLCamera& camera) @@ -1276,8 +1309,12 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector* LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0); group->rebound(); - LLVector3 center = (mExtents[0] + mExtents[1]) * 0.5f; - LLVector3 size = (mExtents[1]-mExtents[0]) * 0.5f; + LLVector4a center; + center.setAdd(mExtents[0], mExtents[1]); + center.mul(0.5f); + LLVector4a size; + size.setSub(mExtents[1], mExtents[0]); + size.mul(0.5f); if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) || LLPipeline::sImpostorRender || @@ -1389,11 +1426,11 @@ BOOL LLSpatialBridge::updateMove() return TRUE; } -void LLSpatialBridge::shiftPos(const LLVector3& vec) +void LLSpatialBridge::shiftPos(const LLVector4a& vec) { - mExtents[0] += vec; - mExtents[1] += vec; - mPositionGroup += LLVector3d(vec); + mExtents[0].add(vec); + mExtents[1].add(vec); + mPositionGroup->add(vec); } void LLSpatialBridge::cleanupReferences() @@ -1511,7 +1548,7 @@ F32 LLHUDBridge::calcPixelArea(LLSpatialGroup* group, LLCamera& camera) } -void LLHUDBridge::shiftPos(const LLVector3& vec) +void LLHUDBridge::shiftPos(const LLVector4a& vec) { //don't shift hud bridges on region crossing } -- cgit v1.2.3 From f40d07512ab54ba3da38c8a8b92cf0c6d1469bc6 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 4 Jun 2010 09:04:36 +0100 Subject: finish conversion to ll_aligned_*() wrappers --- indra/newview/lldrawable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 04e433dcfd..96ec51300f 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -95,7 +95,7 @@ void LLDrawable::incrementVisible() void LLDrawable::init() { - mExtents = (LLVector4a*) _mm_malloc(sizeof(LLVector4a)*3, 32); + mExtents = (LLVector4a*) ll_aligned_malloc_32(sizeof(LLVector4a)*3, 32); mPositionGroup = mExtents + 2; // mXform @@ -150,7 +150,7 @@ void LLDrawable::destroy() llinfos << "- Zombie drawables: " << sNumZombieDrawables << llendl; }*/ - _mm_free(mExtents); + ll_aligned_free_32(mExtents); mExtents = mPositionGroup = NULL; } -- cgit v1.2.3 From 83aed5b6b7aae32c48abcbd3a6bead6e2b099f7d Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 4 Jun 2010 09:26:23 +0100 Subject: fix new macro usage. --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 96ec51300f..ca408a309e 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -95,7 +95,7 @@ void LLDrawable::incrementVisible() void LLDrawable::init() { - mExtents = (LLVector4a*) ll_aligned_malloc_32(sizeof(LLVector4a)*3, 32); + mExtents = (LLVector4a*) ll_aligned_malloc_32(sizeof(LLVector4a)*3); mPositionGroup = mExtents + 2; // mXform -- cgit v1.2.3 From 2fea1d5d33ec1b41a3cfa4307a1bfa58d8014f88 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 19 Aug 2010 12:25:15 -0500 Subject: Integrate SIMD API from oreh/server-trunk-oreh --- indra/newview/lldrawable.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 8d0a06378f..68f52e04bc 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -743,7 +743,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) } else { - pos = LLVector3(getPositionGroup().getF32()); + pos = LLVector3(getPositionGroup().getF32ptr()); } pos -= camera.getOrigin(); @@ -824,7 +824,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) for (S32 i = 0; i < getNumFaces(); i++) { LLFace *facep = getFace(i); - facep->mCenterAgent += LLVector3(shift_vector.getF32()); + facep->mCenterAgent += LLVector3(shift_vector.getF32ptr()); facep->mExtents[0].add(shift_vector); facep->mExtents[1].add(shift_vector); @@ -1153,13 +1153,13 @@ void LLSpatialBridge::updateSpatialExtents() LLVector4a max; max.setAdd(center, delta); - newMin.setMin(min); - newMax.setMax(max); + newMin.setMin(newMin, min); + newMax.setMax(newMax, max); } LLVector4a diagonal; diagonal.setSub(newMax, newMin); - mRadius = diagonal.length3() * 0.5f; + mRadius = diagonal.getLength3().getF32() * 0.5f; mPositionGroup->setAdd(newMin,newMax); mPositionGroup->mul(0.5f); -- cgit v1.2.3 From 90da6d6fdc33343be72252101aed1be641e822b5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sun, 19 Sep 2010 23:07:15 -0500 Subject: Raycasting for rigged attachments now works for your own attachments while in edit mode. --- indra/newview/lldrawable.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 68f52e04bc..5949a373ae 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -189,6 +189,20 @@ LLVOVolume* LLDrawable::getVOVolume() const } } +const LLMatrix4& LLDrawable::getRenderMatrix() const +{ + if (LLDrawable::isState(LLDrawable::RIGGED)) + { + LLVOAvatar* avatar = mVObjp->getAvatar(); + if (avatar) + { + return avatar->mDrawable->getWorldMatrix(); + } + } + + return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix(); +} + BOOL LLDrawable::isLight() const { LLViewerObject* objectp = mVObjp; -- cgit v1.2.3 From c42ed54b0a532cb4e0ad30a1b0b5038cef9938f2 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 20 Sep 2010 18:45:56 -0500 Subject: Stop using ll_aligned_malloc/free in llvolume. Fix for garbage data in vertex weight array crashing software skinning. Proper integration of picking for rigged attachhments. Optimization in LLDrawable::updateDistance (don't call updateRelativeXform, just use spatial group position). --- indra/newview/lldrawable.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5949a373ae..efbb62011c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -191,15 +191,6 @@ LLVOVolume* LLDrawable::getVOVolume() const const LLMatrix4& LLDrawable::getRenderMatrix() const { - if (LLDrawable::isState(LLDrawable::RIGGED)) - { - LLVOAvatar* avatar = mVObjp->getAvatar(); - if (avatar) - { - return avatar->mDrawable->getWorldMatrix(); - } - } - return isRoot() ? getWorldMatrix() : getParent()->getWorldMatrix(); } @@ -727,8 +718,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVOVolume* volume = getVOVolume(); if (volume) { - volume->updateRelativeXform(); - pos = volume->getRelativeXform().getTranslation(); + pos.set(getPositionGroup().getF32ptr()); if (isStatic()) { pos += volume->getRegion()->getOriginAgent(); -- cgit v1.2.3 From 90e3d83a5cb35e98a02a3017dd79ebc272bbfe85 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 21 Sep 2010 13:26:52 -0400 Subject: Fix for build failures - disabling tcmalloc for now --- indra/newview/lldrawable.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/newview/lldrawable.cpp (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From a5619d16f74863168f45b04b37cc6383e1a92263 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 13 Oct 2010 07:24:37 -0400 Subject: correct licenses (fix problem with license change merge) --- indra/newview/lldrawable.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index efbb62011c..8efe2db3d5 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -2,31 +2,25 @@ * @file lldrawable.cpp * @brief LLDrawable class implementation * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * 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. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From 892d70f5d5ef4694f2624aacdffac2645df507ba Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sun, 21 Nov 2010 03:48:11 -0600 Subject: Prune ll_aligned_malloc/free calls out of lldrawable and llface --- indra/newview/lldrawable.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5b5efdeabf..086702de87 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -89,9 +89,6 @@ void LLDrawable::incrementVisible() void LLDrawable::init() { - mExtents = (LLVector4a*) ll_aligned_malloc_32(sizeof(LLVector4a)*3); - mPositionGroup = mExtents + 2; - // mXform mParent = NULL; mRenderType = 0; @@ -144,8 +141,6 @@ void LLDrawable::destroy() llinfos << "- Zombie drawables: " << sNumZombieDrawables << llendl; }*/ - ll_aligned_free_32(mExtents); - mExtents = mPositionGroup = NULL; } void LLDrawable::markDead() @@ -836,7 +831,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) mExtents[0].add(shift_vector); mExtents[1].add(shift_vector); - mPositionGroup->add(shift_vector); + mPositionGroup.add(shift_vector); } else if (mSpatialBridge) { @@ -846,7 +841,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) { mExtents[0].add(shift_vector); mExtents[1].add(shift_vector); - mPositionGroup->add(shift_vector); + mPositionGroup.add(shift_vector); } mVObjp->onShift(shift_vector); @@ -877,7 +872,7 @@ void LLDrawable::setSpatialExtents(const LLVector4a& min, const LLVector4a& max) void LLDrawable::setPositionGroup(const LLVector4a& pos) { - *mPositionGroup = pos; + mPositionGroup = pos; } void LLDrawable::updateSpatialExtents() @@ -891,7 +886,7 @@ void LLDrawable::updateSpatialExtents() if (mSpatialBridge.notNull()) { - mPositionGroup->splat(0.f); + mPositionGroup.splat(0.f); } } @@ -1160,8 +1155,8 @@ void LLSpatialBridge::updateSpatialExtents() diagonal.setSub(newMax, newMin); mRadius = diagonal.getLength3().getF32() * 0.5f; - mPositionGroup->setAdd(newMin,newMax); - mPositionGroup->mul(0.5f); + mPositionGroup.setAdd(newMin,newMax); + mPositionGroup.mul(0.5f); updateBinRadius(); } @@ -1430,7 +1425,7 @@ void LLSpatialBridge::shiftPos(const LLVector4a& vec) { mExtents[0].add(vec); mExtents[1].add(vec); - mPositionGroup->add(vec); + mPositionGroup.add(vec); } void LLSpatialBridge::cleanupReferences() -- cgit v1.2.3 From 32c4a448b113731a8c9ae32613fe4aa50b5c9997 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 19 Jan 2011 23:16:53 -0600 Subject: SH-571 Fix for shadows disappearing for a frame whenever an object switches octree nodes. Regressed EXT-7155 so fix for regression included. --- indra/newview/lldrawable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 086702de87..73c4cf94ef 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -763,7 +763,7 @@ void LLDrawable::updateTexture() if (getVOVolume()) { - if (isActive()) + /*if (isActive()) { if (isRoot()) { @@ -773,7 +773,7 @@ void LLDrawable::updateTexture() { getParent()->mQuietCount = 0; } - } + }*/ gPipeline.markRebuild(this, LLDrawable::REBUILD_MATERIAL, TRUE); } -- cgit v1.2.3 From bb113f75efefffc1f976267be6d722289929e596 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 2 Feb 2011 19:01:27 -0600 Subject: SH-900 Fix for only lowest LoD appearing for objects in neighboring regions. --- indra/newview/lldrawable.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 73c4cf94ef..cbee800acb 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -709,11 +709,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) if (volume) { pos.set(getPositionGroup().getF32ptr()); - if (isStatic()) - { - pos += volume->getRegion()->getOriginAgent(); - } - + if (isState(LLDrawable::HAS_ALPHA)) { for (S32 i = 0; i < getNumFaces(); i++) @@ -733,7 +729,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) facep->mDistance = v * camera.getAtAxis(); } } - } + } } else { -- cgit v1.2.3 From e55e91a5a546832b79643fdcd2208b5e4f62b6df Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 22 Feb 2011 18:36:50 -0600 Subject: SH-874 Better VBO usage hints, most notably don't use VBOs for occlusion queries if GL is set to not use VBOs for stream draw. --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index cbee800acb..d370c72a04 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1052,7 +1052,7 @@ BOOL LLDrawable::isVisible() const //======================================= LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) -: LLSpatialPartition(data_mask, render_by_group, FALSE) +: LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB) { mDrawable = root; root->setSpatialBridge(this); -- cgit v1.2.3 From 162d467b4a8ca1dae6b16ece1728873d43a287ac Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 3 Mar 2011 16:14:52 -0600 Subject: SH-1085 Fix for crash when unchecking "mirror." Basically got LLFace to be paranoid about who gets to touch its LLVertexBuffer members. Reviewed by Nyx. --- indra/newview/lldrawable.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index d370c72a04..fe743e7451 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -820,8 +820,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) if (!volume && facep->hasGeometry()) { - facep->mVertexBuffer = NULL; - facep->mLastVertexBuffer = NULL; + facep->clearVertexBuffer(); } } @@ -935,6 +934,18 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) { mSpatialGroupp->setState(LLSpatialGroup::GEOM_DIRTY); }*/ + + if (mSpatialGroupp != groupp && getVOVolume()) + { //NULL out vertex buffer references for volumes on spatial group change to maintain + //requirement that every face vertex buffer is either NULL or points to a vertex buffer + //contained by its drawable's spatial group + for (S32 i = 0; i < getNumFaces(); ++i) + { + LLFace* facep = getFace(i); + facep->clearVertexBuffer(); + } + } + mSpatialGroupp = groupp; } -- cgit v1.2.3 From b89af09f598af21b67b14e5ff940461d9c89afb8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 4 Mar 2011 14:25:46 -0600 Subject: SH-998 Fix for improper LoD when an object is first rezzed. --- indra/newview/lldrawable.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index fe743e7451..bdc12ec0e3 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -708,7 +708,14 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVOVolume* volume = getVOVolume(); if (volume) { - pos.set(getPositionGroup().getF32ptr()); + if (getSpatialGroup()) + { + pos.set(getPositionGroup().getF32ptr()); + } + else + { + pos = getPositionAgent(); + } if (isState(LLDrawable::HAS_ALPHA)) { -- cgit v1.2.3