diff options
author | davep@billy.gateway.2wire.net <davep@billy.gateway.2wire.net> | 2010-02-09 12:24:04 -0600 |
---|---|---|
committer | davep@billy.gateway.2wire.net <davep@billy.gateway.2wire.net> | 2010-02-09 12:24:04 -0600 |
commit | 871a40f2f290106f9da58dd4d09cec28fbecb0fa (patch) | |
tree | fab5c657732c6da25a4fbcbd837af7389ec283f5 /indra/newview | |
parent | d1efc0fd52c0e5dc59951f50435e121305fe9b69 (diff) | |
parent | 6d4b4762d1eb0a1431e1793a7254f8cac220062a (diff) |
merge
Diffstat (limited to 'indra/newview')
38 files changed, 506 insertions, 285 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4f1ae87dae..8b3a7b5e51 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7395,8 +7395,19 @@ <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>0</integer> + <integer>1</integer> </map> + <key>RenderUseTriStrips</key> + <map> + <key>Comment</key> + <string>Use triangle strips for rendering prims.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderUseFarClip</key> <map> <key>Comment</key> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2354323a66..9f2186f7f7 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3017,6 +3017,9 @@ void LLAgent::endAnimationUpdateUI() //----------------------------------------------------------------------------- void LLAgent::updateCamera() { + static LLFastTimer::DeclareTimer ftm("Camera"); + LLFastTimer t(ftm); + //Ventrella - changed camera_skyward to the new global "mCameraUpVector" mCameraUpVector = LLVector3::z_axis; //LLVector3 camera_skyward(0.f, 0.f, 1.f); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index aeb13f8a08..5b5aad4ea3 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3623,13 +3623,15 @@ void LLAppViewer::idle() { // Handle pending gesture processing + static LLFastTimer::DeclareTimer ftm("Agent Position"); + LLFastTimer t(ftm); LLGestureManager::instance().update(); gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY); } { - LLFastTimer t(FTM_OBJECTLIST_UPDATE); // Actually "object update" + LLFastTimer t(FTM_OBJECTLIST_UPDATE); if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { @@ -3663,6 +3665,8 @@ void LLAppViewer::idle() // { + static LLFastTimer::DeclareTimer ftm("HUD Effects"); + LLFastTimer t(ftm); LLSelectMgr::getInstance()->updateEffects(); LLHUDManager::getInstance()->cleanupEffects(); LLHUDManager::getInstance()->sendEffects(); diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 9a3be975cd..634cff14a3 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -396,8 +396,6 @@ void LLDrawable::makeActive() mParent->makeActive(); } - gPipeline.setActive(this, TRUE); - //all child objects must also be active llassert_always(mVObjp); @@ -444,7 +442,6 @@ void LLDrawable::makeStatic(BOOL warning_enabled) if (isState(ACTIVE)) { clearState(ACTIVE); - gPipeline.setActive(this, FALSE); if (mParent.notNull() && mParent->isActive() && warning_enabled) { diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 95ddacb722..ef946ac49e 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -496,8 +496,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) params.mGroup->rebuildMesh(); } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); - gPipeline.addTrianglesDrawn(params.mCount/3); + params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); } if (params.mTextureMatrix && texture && params.mTexture.notNull()) diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 6d77361414..0e02bc4b01 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -250,8 +250,8 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask) params.mGroup->rebuildMesh(); } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); - gPipeline.addTrianglesDrawn(params.mCount/3); + params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); } } } @@ -380,8 +380,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); - gPipeline.addTrianglesDrawn(params.mCount/3); + params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); if (params.mTextureMatrix && params.mTexture.notNull()) { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 9f037e79fa..a4a8dc80b5 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -560,8 +560,8 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL params.mGroup->rebuildMesh(); } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); - gPipeline.addTrianglesDrawn(params.mCount/3); + params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); } } @@ -1243,8 +1243,8 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) params.mGroup->rebuildMesh(); } params.mVertexBuffer->setBuffer(mask); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); - gPipeline.addTrianglesDrawn(params.mCount/3); + params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode); if (params.mTextureMatrix) { if (mShiny) diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 5521fb05a8..1a5d55d793 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -115,7 +115,7 @@ void LLDrawPoolTree::render(S32 pass) LLFace *face = *iter; face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); - gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()/3); + gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()); } } } @@ -237,7 +237,7 @@ void LLDrawPoolTree::renderForSelect() face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); - gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()/3); + gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()); } } } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 8fbc521d25..0a9976f511 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -889,7 +889,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, llpushcallstacks ; const LLVolumeFace &vf = volume.getVolumeFace(f); S32 num_vertices = (S32)vf.mVertices.size(); - S32 num_indices = (S32)vf.mIndices.size(); + S32 num_indices = LLPipeline::sUseTriStrips ? (S32)vf.mTriStrip.size() : (S32) vf.mIndices.size(); if (mVertexBuffer.notNull()) { @@ -1079,9 +1079,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (full_rebuild) { mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); - for (S32 i = 0; i < num_indices; i++) + if (LLPipeline::sUseTriStrips) { - *indicesp++ = vf.mIndices[i] + index_offset; + for (U16 i = 0; i < num_indices; i++) + { + *indicesp++ = vf.mTriStrip[i] + index_offset; + } + } + else + { + for (U16 i = 0; i < num_indices; i++) + { + *indicesp++ = vf.mIndices[i] + index_offset; + } } } @@ -1593,8 +1603,13 @@ S32 LLFace::pushVertices(const U16* index_array) const { if (mIndicesCount) { - mVertexBuffer->drawRange(LLRender::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); - gPipeline.addTrianglesDrawn(mIndicesCount/3); + U32 render_type = LLRender::TRIANGLES; + if (mDrawInfo) + { + render_type = mDrawInfo->mDrawMode; + } + mVertexBuffer->drawRange(render_type, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); + gPipeline.addTrianglesDrawn(mIndicesCount, render_type); } return mIndicesCount; diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index aea2de8e92..561965d021 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -51,6 +51,9 @@ /*static*/ F32 LLVolumeImplFlexible::sUpdateFactor = 1.0f; +static LLFastTimer::DeclareTimer FTM_FLEXIBLE_REBUILD("Rebuild"); +static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Update"); + // LLFlexibleObjectData::pack/unpack now in llprimitive.cpp //----------------------------------------------- @@ -194,7 +197,6 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so } } - //----------------------------------------------------------------------------- void LLVolumeImplFlexible::setAttributesOfAllSections(LLVector3* inScale) { @@ -363,6 +365,7 @@ inline S32 log2(S32 x) void LLVolumeImplFlexible::doFlexibleUpdate() { + LLFastTimer ftm(FTM_DO_FLEXIBLE_UPDATE); LLVolume* volume = mVO->getVolume(); LLPath *path = &volume->getPath(); if (mSimulateRes == 0) @@ -693,7 +696,10 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) } volume->updateRelativeXform(); - doFlexibleUpdate(); + { + LLFastTimer t(FTM_DO_FLEXIBLE_UPDATE); + doFlexibleUpdate(); + } // Object may have been rotated, which means it needs a rebuild. See SL-47220 BOOL rotated = FALSE; @@ -710,7 +716,10 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) volume->regenFaces(); volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME); volume->dirtySpatialGroup(); - doFlexibleRebuild(); + { + LLFastTimer t(FTM_FLEXIBLE_REBUILD); + doFlexibleRebuild(); + } volume->genBBoxes(isVolumeGlobal()); } else if (!mUpdated || rotated) diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 61568df12e..9917593c91 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -688,6 +688,9 @@ BOOL LLImagePreviewAvatar::render() mNeedsUpdate = FALSE; LLVOAvatar* avatarp = mDummyAvatar; + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + glMatrixMode(GL_PROJECTION); gGL.pushMatrix(); glLoadIdentity(); @@ -696,6 +699,7 @@ BOOL LLImagePreviewAvatar::render() glMatrixMode(GL_MODELVIEW); gGL.pushMatrix(); glLoadIdentity(); + LLGLSUIDefault def; gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); @@ -741,6 +745,7 @@ BOOL LLImagePreviewAvatar::render() avatarPoolp->renderAvatars(avatarp); // renders only one avatar } + gGL.popUIMatrix(); gGL.color4f(1,1,1,1); return TRUE; } diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 750a9d478f..8569e208eb 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -897,19 +897,21 @@ void LLViewerObjectList::renderObjectBeacons() S32 last_line_width = -1; // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) - for (S32 i = 0; i < mDebugBeacons.count(); i++) + BOOL flush = FALSE; + for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { - const LLDebugBeacon &debug_beacon = mDebugBeacons[i]; + const LLDebugBeacon &debug_beacon = *iter; LLColor4 color = debug_beacon.mColor; color.mV[3] *= 0.25f; S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - if (i > 0) + if (flush) { gGL.end(); - gGL.flush(); } + flush = TRUE; + gGL.flush(); glLineWidth( (F32)line_width ); last_line_width = line_width; gGL.begin(LLRender::LINES); @@ -936,18 +938,20 @@ void LLViewerObjectList::renderObjectBeacons() S32 last_line_width = -1; // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) - for (S32 i = 0; i < mDebugBeacons.count(); i++) + BOOL flush = FALSE; + for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { - const LLDebugBeacon &debug_beacon = mDebugBeacons[i]; + const LLDebugBeacon &debug_beacon = *iter; S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - if (i > 0) + if (flush) { gGL.end(); - gGL.flush(); } + flush = TRUE; + gGL.flush(); glLineWidth( (F32)line_width ); last_line_width = line_width; gGL.begin(LLRender::LINES); @@ -969,9 +973,9 @@ void LLViewerObjectList::renderObjectBeacons() gGL.flush(); glLineWidth(1.f); - for (S32 i = 0; i < mDebugBeacons.count(); i++) + for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { - LLDebugBeacon &debug_beacon = mDebugBeacons[i]; + LLDebugBeacon &debug_beacon = *iter; if (debug_beacon.mString == "") { continue; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index a02dc3355b..325c9c260c 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -121,24 +121,24 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); - + gGL.pushMatrix(); LLUI::pushMatrix(); gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight()); gViewerWindow->setup3DViewport(); - //gViewerWindow->setup2DRender(); - + winX -= world_view_rect.mLeft; winY -= world_view_rect.mBottom; LLUI::loadIdentity(); + glLoadIdentity(); LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); - //glRotatef(angle * RAD_TO_DEG, axis.mV[VX], axis.mV[VY], axis.mV[VZ]); - //glScalef(right_scale, up_scale, 1.f); F32 right_x; font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x); + LLUI::popMatrix(); - + gGL.popMatrix(); + glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 2c0cbd4c66..9ed5d13831 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -555,7 +555,7 @@ void LLHUDText::renderText(BOOL for_select) } } /// Reset the default color to white. The renderer expects this to be the default. - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); if (for_select) { gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 501a137b42..bf33d8527e 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -724,14 +724,14 @@ void LLMediaCtrl::draw() LLGLSUIDefault gls_ui; LLGLDisable gls_alphaTest( GL_ALPHA_TEST ); - gGL.pushMatrix(); + gGL.pushUIMatrix(); { if (mIgnoreUIScale) { - glLoadIdentity(); + gGL.loadUIIdentity(); // font system stores true screen origin, need to scale this by UI scale factor // to get render origin for this view (with unit scale) - gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), + gGL.translateUI(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), LLFontGL::sCurOrigin.mZ); } @@ -825,7 +825,7 @@ void LLMediaCtrl::draw() gGL.end(); gGL.setSceneBlendType(LLRender::BT_ALPHA); } - gGL.popMatrix(); + gGL.popUIMatrix(); } else diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 234fe13217..05623198ab 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -153,6 +153,18 @@ void LLNetMap::draw() // Prepare a scissor region F32 rotation = 0; + gGL.pushMatrix(); + gGL.pushUIMatrix(); + + LLVector3 offset = gGL.getUITranslation(); + LLVector3 scale = gGL.getUIScale(); + + glLoadIdentity(); + gGL.loadUIIdentity(); + + glScalef(scale.mV[0], scale.mV[1], scale.mV[2]); + gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); + { LLLocalClipRect clip(getLocalRect()); { @@ -435,6 +447,9 @@ void LLNetMap::draw() } } + gGL.popMatrix(); + gGL.popUIMatrix(); + LLUICtrl::draw(); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 2ae546a2d9..f45abca246 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4919,13 +4919,15 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) // set up transform to encompass bounding box of HUD glMatrixMode(GL_PROJECTION); - glPushMatrix(); + gGL.pushMatrix(); glLoadIdentity(); F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); glLoadIdentity(); glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); @@ -5022,10 +5024,11 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) if (for_hud && avatar) { glMatrixMode(GL_PROJECTION); - glPopMatrix(); + gGL.popMatrix(); glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + gGL.popUIMatrix(); stop_glerror(); } @@ -5453,7 +5456,10 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) } glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + if (!is_hud_object) { glLoadIdentity(); @@ -5572,7 +5578,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) gGL.end(); gGL.flush(); } - glPopMatrix(); + gGL.popMatrix(); + gGL.popUIMatrix(); } // diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 4702a95702..19bf40b56a 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3379,7 +3379,8 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, mVSize(0.f), mGroup(NULL), mFace(NULL), - mDistance(0.f) + mDistance(0.f), + mDrawMode(LLRender::TRIANGLES) { mDebugColor = (rand() << 16) + rand(); if (mStart >= mVertexBuffer->getRequestedVerts() || diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 1d9127639a..c5719bebcc 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -94,6 +94,7 @@ public: LLFace* mFace; //associated face F32 mDistance; LLVector3 mExtents[2]; + U32 mDrawMode; struct CompareTexture { diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 4fb75f7a49..5f825b461e 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -167,13 +167,16 @@ BOOL LLVisualParamHint::render() LLVisualParamReset::sDirty = TRUE; LLVOAvatar* avatarp = gAgent.getAvatarObject(); + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + glMatrixMode(GL_PROJECTION); - glPushMatrix(); + gGL.pushMatrix(); glLoadIdentity(); glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); glLoadIdentity(); LLGLSUIDefault gls_ui; @@ -181,10 +184,10 @@ BOOL LLVisualParamHint::render() mBackgroundp->draw(0, 0, mFullWidth, mFullHeight); glMatrixMode(GL_PROJECTION); - glPopMatrix(); + gGL.popMatrix(); glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); mNeedsUpdate = FALSE; mIsVisible = TRUE; @@ -247,6 +250,7 @@ BOOL LLVisualParamHint::render() mVisualParam->setWeight(mLastParamWeight, FALSE); gGL.color4f(1,1,1,1); mGLTexturep->setGLTextureCreated(true); + gGL.popUIMatrix(); return TRUE; } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 64eabe65cf..0b7f6900ed 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -510,10 +510,12 @@ void settings_setup_listeners() gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2)); gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2)); gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2)); + gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderShadowResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index f0f1c0cfab..356d8467c0 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -862,10 +862,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { gPipeline.mDeferredScreen.flush(); + LLRenderTarget::copyContentsToFramebuffer(gPipeline.mDeferredScreen, 0, 0, gPipeline.mDeferredScreen.getWidth(), gPipeline.mDeferredScreen.getHeight(), + 0, 0, gPipeline.mDeferredScreen.getWidth(), gPipeline.mDeferredScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); } else { gPipeline.mScreen.flush(); + LLRenderTarget::copyContentsToFramebuffer(gPipeline.mScreen, 0, 0, gPipeline.mScreen.getWidth(), gPipeline.mScreen.getHeight(), + 0, 0, gPipeline.mScreen.getWidth(), gPipeline.mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); } } diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 1a67fc0966..7225aa1523 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -626,7 +626,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) mFace->mVertexBuffer->drawRange(LLRender::TRIANGLES, start, end, count, offset); glPopMatrix(); } - gPipeline.addTrianglesDrawn(count/3); + gPipeline.addTrianglesDrawn(count); triangle_count += count; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index d0afa9d9de..b5642d07a5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2001,6 +2001,9 @@ BOOL LLViewerObject::isActive() const BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { + static LLFastTimer::DeclareTimer ftm("Viewer Object"); + LLFastTimer t(ftm); + if (mDead) { // It's dead. Don't update it. diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 7a6f479685..7f147836a1 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -93,7 +93,7 @@ extern LLPipeline gPipeline; // Statics for object lookup tables. U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check. -LLMap<U64, U32> LLViewerObjectList::sIPAndPortToIndex; +std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex; std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID; LLViewerObjectList::LLViewerObjectList() @@ -571,10 +571,9 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys, void LLViewerObjectList::dirtyAllObjectInventory() { - S32 count = mObjects.count(); - for(S32 i = 0; i < count; ++i) + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - mObjects[i]->dirtyInventory(); + (*iter)->dirtyInventory(); } } @@ -587,14 +586,14 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) S32 num_updates, max_value; if (NUM_BINS - 1 == mCurBin) { - num_updates = mObjects.count() - mCurLazyUpdateIndex; - max_value = mObjects.count(); + num_updates = (S32) mObjects.size() - mCurLazyUpdateIndex; + max_value = (S32) mObjects.size(); gTextureList.setUpdateStats(TRUE); } else { - num_updates = (mObjects.count() / NUM_BINS) + 1; - max_value = llmin(mObjects.count(), mCurLazyUpdateIndex + num_updates); + num_updates = ((S32) mObjects.size() / NUM_BINS) + 1; + max_value = llmin((S32) mObjects.size(), mCurLazyUpdateIndex + num_updates); } @@ -647,7 +646,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) } mCurLazyUpdateIndex = max_value; - if (mCurLazyUpdateIndex == mObjects.count()) + if (mCurLazyUpdateIndex == mObjects.size()) { mCurLazyUpdateIndex = 0; } @@ -694,20 +693,26 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) // Make a copy of the list in case something in idleUpdate() messes with it std::vector<LLViewerObject*> idle_list; - idle_list.reserve( mActiveObjects.size() ); + + static LLFastTimer::DeclareTimer idle_copy("Idle Copy"); - for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); - active_iter != mActiveObjects.end(); active_iter++) { - objectp = *active_iter; - if (objectp) + LLFastTimer t(idle_copy); + idle_list.reserve( mActiveObjects.size() ); + + for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); + active_iter != mActiveObjects.end(); active_iter++) { - idle_list.push_back( objectp ); - } - else - { // There shouldn't be any NULL pointers in the list, but they have caused - // crashes before. This may be idleUpdate() messing with the list. - llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl; + objectp = *active_iter; + if (objectp) + { + idle_list.push_back( objectp ); + } + else + { // There shouldn't be any NULL pointers in the list, but they have caused + // crashes before. This may be idleUpdate() messing with the list. + llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl; + } } } @@ -807,7 +812,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) } */ - LLViewerStats::getInstance()->mNumObjectsStat.addValue(mObjects.count()); + LLViewerStats::getInstance()->mNumObjectsStat.addValue((S32) mObjects.size()); LLViewerStats::getInstance()->mNumActiveObjectsStat.addValue(num_active_objects); LLViewerStats::getInstance()->mNumSizeCulledStat.addValue(mNumSizeCulled); LLViewerStats::getInstance()->mNumVisCulledStat.addValue(mNumVisCulled); @@ -815,9 +820,9 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) void LLViewerObjectList::clearDebugText() { - for (S32 i = 0; i < mObjects.count(); i++) + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - mObjects[i]->setDebugText(""); + (*iter)->setDebugText(""); } } @@ -856,7 +861,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) if (objectp->isOnMap()) { - mMapObjects.removeObj(objectp); + removeFromMap(objectp); } // Don't clean up mObject references, these will be cleaned up more efficiently later! @@ -917,10 +922,10 @@ void LLViewerObjectList::killObjects(LLViewerRegion *regionp) { LLViewerObject *objectp; - S32 i; - for (i = 0; i < mObjects.count(); i++) + + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - objectp = mObjects[i]; + objectp = *iter; if (objectp->mRegionp == regionp) { @@ -937,10 +942,9 @@ void LLViewerObjectList::killAllObjects() // Used only on global destruction. LLViewerObject *objectp; - for (S32 i = 0; i < mObjects.count(); i++) + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - objectp = mObjects[i]; - + objectp = *iter; killObject(objectp); llassert(objectp->isDead()); } @@ -949,7 +953,7 @@ void LLViewerObjectList::killAllObjects() if(!mObjects.empty()) { - llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.count() << llendl; + llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << llendl; mObjects.clear(); } @@ -974,16 +978,15 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) return; } - S32 i = 0; S32 num_removed = 0; LLViewerObject *objectp; - while (i < mObjects.count()) + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ) { // Scan for all of the dead objects and remove any "global" references to them. - objectp = mObjects[i]; + objectp = *iter; if (objectp->isDead()) { - mObjects.remove(i); + iter = mObjects.erase(iter); num_removed++; if (num_removed == mNumDeadObjects) @@ -994,8 +997,7 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) } else { - // iterate, this isn't a dead object. - i++; + ++iter; } } @@ -1045,12 +1047,11 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset) } LLViewerObject *objectp; - S32 i; - for (i = 0; i < mObjects.count(); i++) + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - objectp = getObject(i); + objectp = *iter; // There could be dead objects on the object list, so don't update stuff if the object is dead. - if (objectp) + if (!objectp->isDead()) { objectp->updatePositionCaches(); @@ -1080,9 +1081,9 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius"); - for (S32 i = 0; i < mMapObjects.count(); i++) + for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != mMapObjects.end(); ++iter) { - LLViewerObject* objectp = mMapObjects[i]; + LLViewerObject* objectp = *iter; if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment()) { continue; @@ -1148,21 +1149,14 @@ void LLViewerObjectList::renderObjectBounds(const LLVector3 ¢er) { } -void LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, const LLRect& screen_rect, BOOL pick_parcel_wall, BOOL render_transparent) -{ - generatePickList(camera); - renderPickList(screen_rect, pick_parcel_wall, render_transparent); -} - void LLViewerObjectList::generatePickList(LLCamera &camera) { LLViewerObject *objectp; S32 i; // Reset all of the GL names to zero. - for (i = 0; i < mObjects.count(); i++) + for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - objectp = mObjects[i]; - objectp->mGLName = 0; + (*iter)->mGLName = 0; } mSelectPickList.clear(); @@ -1325,17 +1319,19 @@ void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent, const LLColor4 &text_color, S32 line_width) { - LLDebugBeacon *beaconp = mDebugBeacons.reserve_block(1); - beaconp->mPositionAgent = pos_agent; - beaconp->mString = string; - beaconp->mColor = color; - beaconp->mTextColor = text_color; - beaconp->mLineWidth = line_width; + LLDebugBeacon beacon; + beacon.mPositionAgent = pos_agent; + beacon.mString = string; + beacon.mColor = color; + beacon.mTextColor = text_color; + beacon.mLineWidth = line_width; + + mDebugBeacons.push_back(beacon); } void LLViewerObjectList::resetObjectBeacons() { - mDebugBeacons.reset(); + mDebugBeacons.clear(); } LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp) @@ -1353,7 +1349,7 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi mUUIDObjectMap[fullid] = objectp; - mObjects.put(objectp); + mObjects.push_back(objectp); updateActive(objectp); @@ -1392,7 +1388,7 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); - mObjects.put(objectp); + mObjects.push_back(objectp); updateActive(objectp); @@ -1415,11 +1411,11 @@ LLViewerObject *LLViewerObjectList::replaceObject(const LLUUID &id, const LLPCod S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const { LLViewerObject *objectp; - S32 i; S32 num_refs = 0; - for (i = 0; i < mObjects.count(); i++) + + for (vobj_list_t::const_iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { - objectp = mObjects[i]; + objectp = *iter; if (objectp->mDrawable.notNull()) { num_refs += objectp->mDrawable->findReferences(drawablep); @@ -1464,15 +1460,15 @@ void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip // Unknown parent, add to orpaned child list U64 parent_info = getIndex(parent_id, ip, port); - if (-1 == mOrphanParents.find(parent_info)) + if (std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info) == mOrphanParents.end()) { - mOrphanParents.put(parent_info); + mOrphanParents.push_back(parent_info); } LLViewerObjectList::OrphanInfo oi(parent_info, childp->mID); - if (-1 == mOrphanChildren.find(oi)) + if (std::find(mOrphanChildren.begin(), mOrphanChildren.end(), oi) == mOrphanChildren.end()) { - mOrphanChildren.put(oi); + mOrphanChildren.push_back(oi); mNumOrphans++; } } @@ -1495,28 +1491,29 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) // See if we are a parent of an orphan. // Note: This code is fairly inefficient but it should happen very rarely. // It can be sped up if this is somehow a performance issue... - if (0 == mOrphanParents.count()) + if (mOrphanParents.empty()) { // no known orphan parents return; } - if (-1 == mOrphanParents.find(getIndex(objectp->mLocalID, ip, port))) + if (std::find(mOrphanParents.begin(), mOrphanParents.end(), getIndex(objectp->mLocalID, ip, port)) == mOrphanParents.end()) { // did not find objectp in OrphanParent list return; } - S32 i; U64 parent_info = getIndex(objectp->mLocalID, ip, port); BOOL orphans_found = FALSE; // Iterate through the orphan list, and set parents of matching children. - for (i = 0; i < mOrphanChildren.count(); i++) - { - if (mOrphanChildren[i].mParentInfo != parent_info) + + for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); ) + { + if (iter->mParentInfo != parent_info) { + ++iter; continue; } - LLViewerObject *childp = findObject(mOrphanChildren[i].mChildInfo); + LLViewerObject *childp = findObject(iter->mChildInfo); if (childp) { if (childp == objectp) @@ -1550,29 +1547,35 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) objectp->addChild(childp); orphans_found = TRUE; + ++iter; } else { llinfos << "Missing orphan child, removing from list" << llendl; - mOrphanChildren.remove(i); - i--; + + iter = mOrphanChildren.erase(iter); } } // Remove orphan parent and children from lists now that they've been found - mOrphanParents.remove(mOrphanParents.find(parent_info)); - - i = 0; - while (i < mOrphanChildren.count()) { - if (mOrphanChildren[i].mParentInfo == parent_info) + std::vector<U64>::iterator iter = std::find(mOrphanParents.begin(), mOrphanParents.end(), parent_info); + if (iter != mOrphanParents.end()) + { + mOrphanParents.erase(iter); + } + } + + for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); ) + { + if (iter->mParentInfo == parent_info) { - mOrphanChildren.remove(i); + iter = mOrphanChildren.erase(iter); mNumOrphans--; } else { - i++; + ++iter; } } diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index ace5c5038e..8d3d2c4b44 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -38,8 +38,6 @@ // common includes #include "llstat.h" -#include "lldarrayptr.h" -#include "llmap.h" // *TODO: switch to std::map #include "llstring.h" // project includes @@ -50,7 +48,7 @@ class LLNetMap; class LLDebugBeacon; const U32 CLOSE_BIN_SIZE = 10; -const U32 NUM_BINS = 16; +const U32 NUM_BINS = 128; // GL name = position in object list + GL_NAME_INDEX_OFFSET so that // we can have special numbers like zero. @@ -111,13 +109,12 @@ public: void updateAvatarVisibility(); // Selection related stuff - void renderObjectsForSelect(LLCamera &camera, const LLRect& screen_rect, BOOL pick_parcel_wall = FALSE, BOOL render_transparent = TRUE); void generatePickList(LLCamera &camera); void renderPickList(const LLRect& screen_rect, BOOL pick_parcel_wall, BOOL render_transparent); LLViewerObject *getSelectedObject(const U32 object_id); - inline S32 getNumObjects() { return mObjects.count(); } + inline S32 getNumObjects() { return (S32) mObjects.size(); } void addToMap(LLViewerObject *objectp); void removeFromMap(LLViewerObject *objectp); @@ -131,7 +128,7 @@ public: S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value. - S32 getOrphanParentCount() const { return mOrphanParents.count(); } + S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); } S32 getOrphanCount() const { return mNumOrphans; } void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port); void findOrphans(LLViewerObject* objectp, U32 ip, U32 port); @@ -179,26 +176,28 @@ public: S32 mNumUnknownKills; S32 mNumDeadObjects; protected: - LLDynamicArray<U64> mOrphanParents; // LocalID/ip,port of orphaned objects - LLDynamicArray<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects + std::vector<U64> mOrphanParents; // LocalID/ip,port of orphaned objects + std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects S32 mNumOrphans; - LLDynamicArrayPtr<LLPointer<LLViewerObject>, 256> mObjects; + typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t; + + vobj_list_t mObjects; std::set<LLPointer<LLViewerObject> > mActiveObjects; - LLDynamicArrayPtr<LLPointer<LLViewerObject> > mMapObjects; + vobj_list_t mMapObjects; typedef std::map<LLUUID, LLPointer<LLViewerObject> > vo_map; vo_map mDeadObjects; // Need to keep multiple entries per UUID std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap; - LLDynamicArray<LLDebugBeacon> mDebugBeacons; + std::vector<LLDebugBeacon> mDebugBeacons; S32 mCurLazyUpdateIndex; static U32 sSimulatorMachineIndex; - static LLMap<U64, U32> sIPAndPortToIndex; + static std::map<U64, U32> sIPAndPortToIndex; static std::map<U64, LLUUID> sIndexAndLocalIDToUUID; @@ -260,12 +259,16 @@ inline LLViewerObject *LLViewerObjectList::getObject(const S32 index) inline void LLViewerObjectList::addToMap(LLViewerObject *objectp) { - mMapObjects.put(objectp); + mMapObjects.push_back(objectp); } inline void LLViewerObjectList::removeFromMap(LLViewerObject *objectp) { - mMapObjects.removeObj(objectp); + std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mMapObjects.begin(), mMapObjects.end(), objectp); + if (iter != mMapObjects.end()) + { + mMapObjects.erase(iter); + } } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index ebfe7e0df4..a4899c30a1 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -496,7 +496,9 @@ void LLViewerTexture::init(bool firstinit) mAdditionalDecodePriority = 0.f ; mParcelMedia = NULL ; mNumFaces = 0 ; + mNumVolumes = 0; mFaceList.clear() ; + mVolumeList.clear(); } //virtual @@ -508,7 +510,7 @@ S8 LLViewerTexture::getType() const void LLViewerTexture::cleanup() { mFaceList.clear() ; - + mVolumeList.clear(); if(mGLTexturep) { mGLTexturep->cleanup(); @@ -661,6 +663,42 @@ S32 LLViewerTexture::getNumFaces() const return mNumFaces ; } + +//virtual +void LLViewerTexture::addVolume(LLVOVolume* volumep) +{ + if( mNumVolumes >= mVolumeList.size()) + { + mVolumeList.resize(2 * mNumVolumes + 1) ; + } + mVolumeList[mNumVolumes] = volumep ; + volumep->setIndexInTex(mNumVolumes) ; + mNumVolumes++ ; + mLastVolumeListUpdateTimer.reset() ; +} + +//virtual +void LLViewerTexture::removeVolume(LLVOVolume* volumep) +{ + if(mNumVolumes > 1) + { + S32 index = volumep->getIndexInTex() ; + mVolumeList[index] = mVolumeList[--mNumVolumes] ; + mVolumeList[index]->setIndexInTex(index) ; + } + else + { + mVolumeList.clear() ; + mNumVolumes = 0 ; + } + mLastVolumeListUpdateTimer.reset() ; +} + +S32 LLViewerTexture::getNumVolumes() const +{ + return mNumVolumes ; +} + void LLViewerTexture::reorganizeFaceList() { static const F32 MAX_WAIT_TIME = 20.f; // seconds @@ -680,6 +718,27 @@ void LLViewerTexture::reorganizeFaceList() mFaceList.erase(mFaceList.begin() + mNumFaces, mFaceList.end()); } +void LLViewerTexture::reorganizeVolumeList() +{ + static const F32 MAX_WAIT_TIME = 20.f; // seconds + static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ; + + if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size()) + { + return ; + } + + if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) + { + return ; + } + + mLastVolumeListUpdateTimer.reset() ; + mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end()); +} + + + //virtual void LLViewerTexture::switchToCachedImage() { @@ -1598,6 +1657,7 @@ void LLViewerFetchedTexture::updateVirtualSize() } mNeedsResetMaxVirtualSize = TRUE ; reorganizeFaceList() ; + reorganizeVolumeList(); } bool LLViewerFetchedTexture::updateFetch() @@ -3252,6 +3312,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() mNeedsResetMaxVirtualSize = TRUE ; reorganizeFaceList() ; + reorganizeVolumeList(); return mMaxVirtualSize ; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 79d9c4e7bb..85f03b5839 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -134,7 +134,9 @@ public: static S32 getIndexFromCategory(S32 category) ; static S32 getCategoryFromIndex(S32 index) ; - typedef std::vector<LLFace*> ll_face_list_t ; + typedef std::vector<LLFace*> ll_face_list_t; + typedef std::vector<LLVOVolume*> ll_volume_list_t; + protected: virtual ~LLViewerTexture(); @@ -178,6 +180,11 @@ public: S32 getNumFaces() const; const ll_face_list_t* getFaceList() const {return &mFaceList;} + virtual void addVolume(LLVOVolume* volumep); + virtual void removeVolume(LLVOVolume* volumep); + S32 getNumVolumes() const; + const ll_volume_list_t* getVolumeList() const { return &mVolumeList; } + void generateGLTexture() ; void destroyGLTexture() ; @@ -242,7 +249,7 @@ protected: void cleanup() ; void init(bool firstinit) ; void reorganizeFaceList() ; - + void reorganizeVolumeList() ; private: //note: do not make this function public. /*virtual*/ LLImageGL* getGLTexture() const ; @@ -269,6 +276,10 @@ protected: U32 mNumFaces ; LLFrameTimer mLastFaceListUpdateTimer ; + ll_volume_list_t mVolumeList; + U32 mNumVolumes; + LLFrameTimer mLastVolumeListUpdateTimer; + //do not use LLPointer here. LLViewerMediaTexture* mParcelMedia ; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 19cc8b14ee..a9468f8fae 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -486,6 +486,10 @@ public: } ypos += y_inc; + addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls)); + LLRender::sUICalls = LLRender::sUIVerts = 0; + ypos += y_inc; + addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount)); ypos += y_inc; @@ -1358,7 +1362,7 @@ LLViewerWindow::LLViewerWindow( gSavedSettings.getBOOL("DisableVerticalSync"), !gNoRender, ignore_pixel_depth, - gSavedSettings.getU32("RenderFSAASamples")); + 0); //gSavedSettings.getU32("RenderFSAASamples")); if (!LLAppViewer::instance()->restoreErrorTrap()) { @@ -1988,12 +1992,15 @@ void LLViewerWindow::drawDebugText() { gGL.color4f(1,1,1,1); gGL.pushMatrix(); + gGL.pushUIMatrix(); { // scale view by UI global scale factor and aspect ratio correction factor - glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); + gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); mDebugText->draw(); } + gGL.popUIMatrix(); gGL.popMatrix(); + gGL.flush(); } @@ -2041,9 +2048,11 @@ void LLViewerWindow::draw() // No translation needed, this view is glued to 0,0 gGL.pushMatrix(); + LLUI::pushMatrix(); { + // scale view by UI global scale factor and aspect ratio correction factor - glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); + gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); LLVector2 old_scale_factor = LLUI::sGLScaleFactor; // apply camera zoom transform (for high res screenshots) @@ -2109,6 +2118,7 @@ void LLViewerWindow::draw() LLUI::sGLScaleFactor = old_scale_factor; } + LLUI::popMatrix(); gGL.popMatrix(); #if LL_DEBUG @@ -2461,6 +2471,9 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params) // event processing. void LLViewerWindow::updateUI() { + static LLFastTimer::DeclareTimer ftm("Update UI"); + LLFastTimer t(ftm); + static std::string last_handle_msg; // animate layout stacks so we have up to date rect for world view @@ -3040,7 +3053,6 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point) // Must be called after displayObjects is called, which sets the mGLName parameter // NOTE: This function gets called 3 times: // render_ui_3d: FALSE, FALSE, TRUE -// renderObjectsForSelect: TRUE, pick_parcel_wall, FALSE // render_hud_elements: FALSE, FALSE, FALSE void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ) { @@ -4571,8 +4583,9 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, return TRUE; } - U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); - U32 old_fsaa = mWindow->getFSAASamples(); + //U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); + //U32 old_fsaa = mWindow->getFSAASamples(); + // going from windowed to windowed if (!old_fullscreen && !fullscreen) { @@ -4582,7 +4595,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, mWindow->setSize(size); } - if (fsaa == old_fsaa) + //if (fsaa == old_fsaa) { return TRUE; } @@ -4611,13 +4624,13 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, gSavedSettings.setS32("WindowY", old_pos.mY); } - mWindow->setFSAASamples(fsaa); + //mWindow->setFSAASamples(fsaa); result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync); if (!result_first_try) { // try to switch back - mWindow->setFSAASamples(old_fsaa); + //mWindow->setFSAASamples(old_fsaa); result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync); if (!result_second_try) diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp index 177cb16c50..5153cef709 100644 --- a/indra/newview/llvoclouds.cpp +++ b/indra/newview/llvoclouds.cpp @@ -77,9 +77,11 @@ BOOL LLVOClouds::isActive() const return TRUE; } - BOOL LLVOClouds::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { + static LLFastTimer::DeclareTimer ftm("Idle Clouds"); + LLFastTimer t(ftm); + if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS))) { return TRUE; diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp index 75beab519e..428ef20006 100644 --- a/indra/newview/llvotextbubble.cpp +++ b/indra/newview/llvotextbubble.cpp @@ -84,6 +84,9 @@ BOOL LLVOTextBubble::isActive() const BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { + static LLFastTimer::DeclareTimer ftm("Text Bubble"); + LLFastTimer t(ftm); + F32 dt = mUpdateTimer.getElapsedTimeF32(); // Die after a few seconds. if (dt > 1.5f) diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 24f1c4bd24..55e2c58a52 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -1141,7 +1141,7 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD glLoadMatrixf((F32*) scale_mat.mMatrix); glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]); - gPipeline.addTrianglesDrawn(LEAF_INDICES/3); + gPipeline.addTrianglesDrawn(LEAF_INDICES); stop_glerror(); ret += sLODIndexCount[trunk_LOD]; } @@ -1191,7 +1191,7 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD glLoadMatrixf((F32*) scale_mat.mMatrix); glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp); - gPipeline.addTrianglesDrawn(LEAF_INDICES/3); + gPipeline.addTrianglesDrawn(LEAF_INDICES); stop_glerror(); ret += LEAF_INDICES; } @@ -1216,7 +1216,7 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD glLoadMatrixf((F32*) scale_mat.mMatrix); glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp); - gPipeline.addTrianglesDrawn(LEAF_INDICES/3); + gPipeline.addTrianglesDrawn(LEAF_INDICES); stop_glerror(); ret += LEAF_INDICES; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index be2744aede..fb28b78daf 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -202,6 +202,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mMediaImplList.resize(getNumTEs()); mLastFetchedMediaVersion = -1; + mIndexInTex = 0; } LLVOVolume::~LLVOVolume() @@ -236,6 +237,11 @@ void LLVOVolume::markDead() { removeMediaImpl(i); } + + if (mSculptTexture.notNull()) + { + mSculptTexture->removeVolume(this); + } } LLViewerObject::markDead(); @@ -607,6 +613,9 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { LLViewerObject::idleUpdate(agent, world, time); + static LLFastTimer::DeclareTimer ftm("Volume"); + LLFastTimer t(ftm); + if (mDead || mDrawable.isNull()) { return TRUE; @@ -628,6 +637,18 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) mVolumeImpl->doIdleUpdate(agent, world, time); } + const S32 MAX_ACTIVE_OBJECT_QUIET_FRAMES = 40; + + if (mDrawable->isActive()) + { + if (mDrawable->isRoot() && + mDrawable->mQuietCount++ > MAX_ACTIVE_OBJECT_QUIET_FRAMES && + (!mDrawable->getParent() || !mDrawable->getParent()->isActive())) + { + mDrawable->makeStatic(); + } + } + return TRUE; } @@ -736,53 +757,52 @@ void LLVOVolume::updateTextureVirtualSize() { LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID id = sculpt_params->getSculptTexture(); - U8 sculpt_type = sculpt_params->getSculptType(); + + updateSculptTexture(); + + - if ((sculpt_type & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH) + if (mSculptTexture.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - - if (mSculptTexture.notNull()) - { - mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), + mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), (S32)LLViewerTexture::BOOST_SCULPTED)); - mSculptTexture->setForSculpt() ; + mSculptTexture->setForSculpt() ; - if(!mSculptTexture->isCachedRawImageReady()) - { - S32 lod = llmin(mLOD, 3); - F32 lodf = ((F32)(lod + 1.0f)/4.f); - F32 tex_size = lodf * LLViewerTexture::sMaxSculptRez ; - mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE); - - //if the sculpty very close to the view point, load first - { + if(!mSculptTexture->isCachedRawImageReady()) + { + S32 lod = llmin(mLOD, 3); + F32 lodf = ((F32)(lod + 1.0f)/4.f); + F32 tex_size = lodf * LLViewerTexture::sMaxSculptRez ; + mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE); + + //if the sculpty very close to the view point, load first + { LLVector3 lookAt = getPositionAgent() - camera->getOrigin(); - F32 dist = lookAt.normVec() ; + F32 dist = lookAt.normVec() ; F32 cos_angle_to_view_dir = lookAt * camera->getXAxis() ; - mSculptTexture->setAdditionalDecodePriority(0.8f * LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist)) ; - } + mSculptTexture->setAdditionalDecodePriority(0.8f * LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist)) ; } + } - S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture - S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ; + S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture + S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ; - if (texture_discard >= 0 && //texture has some data available - (texture_discard < current_discard || //texture has more data than last rebuild - current_discard < 0)) //no previous rebuild - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); - mSculptChanged = TRUE; - } + if (texture_discard >= 0 && //texture has some data available + (texture_discard < current_discard || //texture has more data than last rebuild + current_discard < 0)) //no previous rebuild + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); + mSculptChanged = TRUE; + } - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) - { - setDebugText(llformat("T%d C%d V%d\n%dx%d", + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) + { + setDebugText(llformat("T%d C%d V%d\n%dx%d", texture_discard, current_discard, getVolume()->getSculptLevel(), mSculptTexture->getHeight(), mSculptTexture->getWidth())); - } } } + } if (getLightTextureID().notNull()) @@ -952,9 +972,13 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms, const S32 detail, bool { mVolumeImpl->onSetVolume(volume_params, mLOD); } - + + updateSculptTexture(); + if (isSculpted()) { + updateSculptTexture(); + // if it's a mesh if ((volume_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH) { @@ -971,34 +995,48 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms, const S32 detail, bool } else // otherwise is sculptie { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(volume_params.getSculptID(), TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (mSculptTexture.notNull()) { - //ignore sculpt GL usage since bao fixed this in a separate branch - if (!gGLActive) - { - gGLActive = TRUE; - sculpt(); - gGLActive = FALSE; - } - else - { - sculpt(); - } + sculpt(); } } } - else - { - mSculptTexture = NULL; - } return TRUE; } return FALSE; } +void LLVOVolume::updateSculptTexture() +{ + LLPointer<LLViewerFetchedTexture> old_sculpt = mSculptTexture; + + if (isSculpted()) + { + LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLUUID id = sculpt_params->getSculptTexture(); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + } + else + { + mSculptTexture = NULL; + } + + if (mSculptTexture != old_sculpt) + { + if (old_sculpt.notNull()) + { + old_sculpt->removeVolume(this); + } + if (mSculptTexture.notNull()) + { + mSculptTexture->addVolume(this); + } + } + +} + void LLVOVolume::notifyMeshLoaded() @@ -1071,6 +1109,17 @@ void LLVOVolume::sculpt() } } getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); + + //notify rebuild any other VOVolumes that reference this sculpty volume + for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i) + { + LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i]; + if (volume != this && volume->getVolume() == getVolume()) + { + gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE); + volume->mSculptChanged = TRUE; + } + } } } @@ -1100,7 +1149,7 @@ BOOL LLVOVolume::calcLOD() S32 cur_detail = 0; F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length(); - F32 distance = llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE); + F32 distance = mDrawable->mDistanceWRTCamera; //llmin(mDrawable->mDistanceWRTCamera, MAX_LOD_DISTANCE); distance *= sDistanceFactor; F32 rampDist = LLVOVolume::sLODFactor * 2; @@ -1536,7 +1585,14 @@ void LLVOVolume::updateFaceSize(S32 idx) else { const LLVolumeFace& vol_face = getVolume()->getVolumeFace(idx); - facep->setSize(vol_face.mVertices.size(), vol_face.mIndices.size()); + if (LLPipeline::sUseTriStrips) + { + facep->setSize(vol_face.mVertices.size(), vol_face.mTriStrip.size()); + } + else + { + facep->setSize(vol_face.mVertices.size(), vol_face.mIndices.size()); + } } } @@ -3338,6 +3394,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mExtents[0] = facep->mExtents[0]; draw_info->mExtents[1] = facep->mExtents[1]; validate_draw_info(*draw_info); + + if (LLPipeline::sUseTriStrips) + { + draw_info->mDrawMode = LLRender::TRIANGLE_STRIP; + } } } @@ -3422,7 +3483,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) drawablep->updateFaceSize(i); LLFace* facep = drawablep->getFace(i); - if (cur_total > max_total) + if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0) { facep->mVertexBuffer = NULL; facep->mLastVertexBuffer = NULL; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 280ffea76d..2776988a12 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -179,8 +179,10 @@ public: /*virtual*/ BOOL setMaterial(const U8 material); void setTexture(const S32 face); - + S32 getIndexInTex() const {return mIndexInTex ;} /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); + void updateSculptTexture(); + void setIndexInTex(S32 index) { mIndexInTex = index ;} void sculpt(); static void rebuildMeshAssetCallback(LLVFS *vfs, const LLUUID& asset_uuid, @@ -313,7 +315,7 @@ private: LLPointer<LLViewerFetchedTexture> mLightTexture; media_list_t mMediaImplList; S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1 - + S32 mIndexInTex; // statics public: static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index 0272a2ab34..1749ccef94 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -519,7 +519,7 @@ void LLVOWLSky::drawDome(void) LLRender::TRIANGLE_STRIP, 0, strips_segment->getRequestedVerts()-1, strips_segment->getRequestedIndices(), 0); - gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices() - 2); + gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices(), LLRender::TRIANGLE_STRIP); } #else diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index feab6d126b..f01e30f9da 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -657,6 +657,9 @@ void LLWorld::updateParticles() void LLWorld::updateClouds(const F32 dt) { + static LLFastTimer::DeclareTimer ftm("World Clouds"); + LLFastTimer t(ftm); + if (gSavedSettings.getBOOL("FreezeTime") || !gSavedSettings.getBOOL("SkyUseClassicClouds")) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b25c7c9212..f10f9f9784 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -118,7 +118,6 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f; const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f; -const S32 MAX_ACTIVE_OBJECT_QUIET_FRAMES = 40; const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10; const U32 REFLECTION_MAP_RES = 128; @@ -273,6 +272,7 @@ BOOL LLPipeline::sDelayVBUpdate = TRUE; BOOL LLPipeline::sFastAlpha = TRUE; BOOL LLPipeline::sDisableShaders = FALSE; BOOL LLPipeline::sRenderBump = TRUE; +BOOL LLPipeline::sUseTriStrips = TRUE; BOOL LLPipeline::sUseFarClip = TRUE; BOOL LLPipeline::sShadowRender = FALSE; BOOL LLPipeline::sWaterReflections = FALSE; @@ -361,6 +361,7 @@ void LLPipeline::init() sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); + sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); @@ -1426,38 +1427,26 @@ void LLPipeline::updateMove() assertInitialized(); - for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin(); - iter != mRetexturedList.end(); ++iter) { - LLDrawable* drawablep = *iter; - if (drawablep && !drawablep->isDead()) - { - drawablep->updateTexture(); - } - } - mRetexturedList.clear(); - - updateMovedList(mMovedList); + static LLFastTimer::DeclareTimer ftm("Retexture"); + LLFastTimer t(ftm); - for (LLDrawable::drawable_set_t::iterator iter = mActiveQ.begin(); - iter != mActiveQ.end(); ) - { - LLDrawable::drawable_set_t::iterator curiter = iter++; - LLDrawable* drawablep = *curiter; - if (drawablep && !drawablep->isDead()) + for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin(); + iter != mRetexturedList.end(); ++iter) { - if (drawablep->isRoot() && - drawablep->mQuietCount++ > MAX_ACTIVE_OBJECT_QUIET_FRAMES && - (!drawablep->getParent() || !drawablep->getParent()->isActive())) + LLDrawable* drawablep = *iter; + if (drawablep && !drawablep->isDead()) { - drawablep->makeStatic(); // removes drawable and its children from mActiveQ - iter = mActiveQ.upper_bound(drawablep); // next valid entry + drawablep->updateTexture(); } } - else - { - mActiveQ.erase(curiter); - } + mRetexturedList.clear(); + } + + { + static LLFastTimer::DeclareTimer ftm("Moved List"); + LLFastTimer t(ftm); + updateMovedList(mMovedList); } //balance octrees @@ -3076,12 +3065,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } } - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING)) - { - LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect"); - gObjectList.renderObjectsForSelect(camera, gViewerWindow->getWindowRectScaled()); - } - else { LLFastTimer t(FTM_POOLS); @@ -3519,9 +3502,19 @@ void LLPipeline::renderGeomShadow(LLCamera& camera) } -void LLPipeline::addTrianglesDrawn(S32 count) +void LLPipeline::addTrianglesDrawn(S32 index_count, U32 render_type) { assertInitialized(); + S32 count = 0; + if (render_type == LLRender::TRIANGLE_STRIP) + { + count = index_count-2; + } + else + { + count = index_count/3; + } + mTrianglesDrawn += count; mBatchCount++; mMaxBatchSize = llmax(mMaxBatchSize, count); @@ -4807,10 +4800,6 @@ void LLPipeline::findReferences(LLDrawable *drawablep) llinfos << "In mRetexturedList" << llendl; } - if (mActiveQ.find(drawablep) != mActiveQ.end()) - { - llinfos << "In mActiveQ" << llendl; - } if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end()) { llinfos << "In mBuildQ1" << llendl; @@ -4967,19 +4956,6 @@ void LLPipeline::setLight(LLDrawable *drawablep, BOOL is_light) } } -void LLPipeline::setActive(LLDrawable *drawablep, BOOL active) -{ - assertInitialized(); - if (active) - { - mActiveQ.insert(drawablep); - } - else - { - mActiveQ.erase(drawablep); - } -} - //static void LLPipeline::toggleRenderType(U32 type) { @@ -5395,6 +5371,7 @@ void LLPipeline::resetVertexBuffers(LLDrawable* drawable) void LLPipeline::resetVertexBuffers() { sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); + sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 0b040acf51..c61274bfb1 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -272,15 +272,14 @@ public: void shiftObjects(const LLVector3 &offset); void setLight(LLDrawable *drawablep, BOOL is_light); - void setActive(LLDrawable *drawablep, BOOL active); - + BOOL hasRenderBatches(const U32 type) const; LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type); LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type); LLCullResult::sg_list_t::iterator beginAlphaGroups(); LLCullResult::sg_list_t::iterator endAlphaGroups(); - void addTrianglesDrawn(S32 count); + void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); BOOL hasRenderType(const U32 type) const { return (type && (mRenderTypeMask & (1<<type))) ? TRUE : FALSE; } BOOL hasRenderDebugFeatureMask(const U32 mask) const { return (mRenderDebugFeatureMask & mask) ? TRUE : FALSE; } BOOL hasRenderDebugMask(const U32 mask) const { return (mRenderDebugMask & mask) ? TRUE : FALSE; } @@ -450,7 +449,7 @@ public: static BOOL sFastAlpha; static BOOL sDisableShaders; // if TRUE, rendering will be done without shaders static BOOL sRenderBump; - static BOOL sUseFBO; + static BOOL sUseTriStrips; static BOOL sUseFarClip; static BOOL sShadowRender; static BOOL sWaterReflections; @@ -591,8 +590,6 @@ protected: LLViewerObject::vobj_list_t mCreateQ; - LLDrawable::drawable_set_t mActiveQ; - LLDrawable::drawable_set_t mRetexturedList; class HighlightItem |