summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp156
1 files changed, 85 insertions, 71 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index a3b402c1a3..5e54d4ab78 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2,25 +2,31 @@
* @file pipeline.cpp
* @brief Rendering pipeline.
*
- * $LicenseInfo:firstyear=2005&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ *
+ * Copyright (c) 2005-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$
*/
@@ -278,7 +284,6 @@ BOOL LLPipeline::sRenderFrameTest = FALSE;
BOOL LLPipeline::sRenderAttachedLights = TRUE;
BOOL LLPipeline::sRenderAttachedParticles = TRUE;
BOOL LLPipeline::sRenderDeferred = FALSE;
-BOOL LLPipeline::sAllowRebuildPriorityGroup = FALSE ;
S32 LLPipeline::sVisibleLightCount = 0;
F32 LLPipeline::sMinRenderSize = 0.f;
@@ -356,7 +361,6 @@ void LLPipeline::init()
sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips");
- LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO");
sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
@@ -1776,19 +1780,13 @@ void LLPipeline::updateGL()
void LLPipeline::rebuildPriorityGroups()
{
- if(!sAllowRebuildPriorityGroup)
- {
- return ;
- }
- sAllowRebuildPriorityGroup = FALSE ;
-
LLTimer update_timer;
LLMemType mt(LLMemType::MTYPE_PIPELINE);
assertInitialized();
// Iterate through all drawables on the priority build queue,
- for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
+ for (LLSpatialGroup::sg_list_t::iterator iter = mGroupQ1.begin();
iter != mGroupQ1.end(); ++iter)
{
LLSpatialGroup* group = *iter;
@@ -1801,6 +1799,7 @@ void LLPipeline::rebuildPriorityGroups()
void LLPipeline::rebuildGroups()
{
+ llpushcallstacks ;
// Iterate through some drawables on the non-priority build queue
S32 size = (S32) mGroupQ2.size();
S32 min_count = llclamp((S32) ((F32) (size * size)/4096*0.25f), 1, size);
@@ -2202,6 +2201,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
//LLVertexBuffer::unbind();
grabReferences(result);
+
for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
{
LLSpatialGroup* group = *iter;
@@ -2219,6 +2219,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
}
}
}
+
for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
{
LLSpatialGroup* group = *iter;
@@ -2234,6 +2235,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
}
}
+
if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
{
for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
@@ -2247,6 +2249,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
}
}
}
+
{
LLFastTimer ftm(FTM_STATESORT_DRAWABLE);
for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList();
@@ -2259,12 +2262,13 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
}
}
}
+
{
LLFastTimer ftm(FTM_CLIENT_COPY);
LLVertexBuffer::clientCopy();
}
-
- postSort(camera);
+
+ postSort(camera);
}
void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
@@ -2534,7 +2538,6 @@ void LLPipeline::postSort(LLCamera& camera)
assertInitialized();
- llpushcallstacks ;
//rebuild drawable geometry
for (LLCullResult::sg_list_t::iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i)
{
@@ -2545,7 +2548,7 @@ void LLPipeline::postSort(LLCamera& camera)
group->rebuildGeom();
}
}
- llpushcallstacks ;
+
//rebuild groups
sCull->assertDrawMapsEmpty();
@@ -2565,7 +2568,6 @@ void LLPipeline::postSort(LLCamera& camera)
rebuildPriorityGroups();
- llpushcallstacks ;
const S32 bin_count = 1024*8;
@@ -2667,7 +2669,7 @@ void LLPipeline::postSort(LLCamera& camera)
std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater());
}
- llpushcallstacks ;
+
// only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus
if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender)
{
@@ -2715,7 +2717,7 @@ void LLPipeline::postSort(LLCamera& camera)
forAllVisibleDrawables(renderSoundHighlights);
}
}
- llpushcallstacks ;
+
// If managing your telehub, draw beacons at telehub and currently selected spawnpoint.
if (LLFloaterTelehub::renderBeacons())
{
@@ -2745,7 +2747,6 @@ void LLPipeline::postSort(LLCamera& camera)
}
//LLSpatialGroup::sNoDelete = FALSE;
- llpushcallstacks ;
}
@@ -2957,9 +2958,6 @@ void LLPipeline::renderHighlights()
}
}
-//debug use
-U32 LLPipeline::sCurRenderPoolType = 0 ;
-
void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_GEOM);
@@ -3069,9 +3067,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
cur_type = poolp->getType();
- //debug use
- sCurRenderPoolType = cur_type ;
-
if (occlude && cur_type >= LLDrawPool::POOL_GRASS)
{
occlude = FALSE;
@@ -3409,26 +3404,14 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
- renderHighlights();
- mHighlightFaces.clear();
-
- renderDebug();
-
- LLVertexBuffer::unbind();
-
- if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- // Render debugging beacons.
- gObjectList.renderObjectBeacons();
- gObjectList.resetObjectBeacons();
- }
-
if (occlude)
{
occlude = FALSE;
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
doOcclusion(camera);
+ gGLLastMatrix = NULL;
+ glLoadMatrix(gGLModelView);
}
}
@@ -3861,14 +3844,15 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render
}
// pick HUD objects
- if (isAgentAvatarValid() && sShowHUDAttachments)
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (avatarp && sShowHUDAttachments)
{
glh::matrix4f save_proj(glh_get_current_projection());
glh::matrix4f save_model(glh_get_current_modelview());
setup_hud_matrices(screen_rect);
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
- iter != gAgentAvatarp->mAttachmentPoints.end(); )
+ for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
+ iter != avatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -3968,9 +3952,9 @@ void LLPipeline::rebuildPools()
max_count--;
}
- if (isAgentAvatarValid())
+ if (gAgent.getAvatarObject())
{
- gAgentAvatarp->rebuildHUD();
+ gAgent.getAvatarObject()->rebuildHUD();
}
}
@@ -4602,8 +4586,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV);
}
- if (isAgentAvatarValid() &&
- gAgentAvatarp->mSpecialRenderMode == 3)
+ if (gAgent.getAvatarObject() &&
+ gAgent.getAvatarObject()->mSpecialRenderMode == 3)
{
LLColor4 light_color = LLColor4::white;
light_color.mV[3] = 0.0f;
@@ -4712,13 +4696,15 @@ void LLPipeline::enableLightsDynamic()
glColor4f(0.f, 0.f, 0.f, 1.f); // no local lighting by default
}
- if (isAgentAvatarValid() && getLightingDetail() <= 0)
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+
+ if (avatarp && getLightingDetail() <= 0)
{
- if (gAgentAvatarp->mSpecialRenderMode == 0) // normal
+ if (avatarp->mSpecialRenderMode == 0) // normal
{
gPipeline.enableLightsAvatar();
}
- else if (gAgentAvatarp->mSpecialRenderMode >= 1) // anim preview
+ else if (avatarp->mSpecialRenderMode >= 1) // anim preview
{
gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f));
}
@@ -5360,7 +5346,6 @@ void LLPipeline::resetVertexBuffers()
{
sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips");
- LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO");
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -5818,6 +5803,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+
+ if (LLRenderTarget::sUseFBO)
+ { //copy depth buffer from mScreen to framebuffer
+ LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(),
+ 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
+ }
}
@@ -6896,6 +6887,24 @@ void LLPipeline::renderDeferredLighting()
mRenderTypeMask = render_mask;
}
+ {
+ //render highlights, etc.
+ renderHighlights();
+ mHighlightFaces.clear();
+
+ renderDebug();
+
+ LLVertexBuffer::unbind();
+
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ // Render debugging beacons.
+ gObjectList.renderObjectBeacons();
+ LLHUDObject::renderAll();
+ gObjectList.resetObjectBeacons();
+ }
+ }
+
mScreen.flush();
}
@@ -7101,18 +7110,18 @@ inline float sgn(float a)
}
void LLPipeline::generateWaterReflection(LLCamera& camera_in)
-{
+{
if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
{
- BOOL skip_avatar_update = FALSE;
- if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
{
- skip_avatar_update = TRUE;
+ avatarp = NULL;
}
- if (!skip_avatar_update)
+ if (avatarp)
{
- gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
+ avatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
}
LLVertexBuffer::unbind();
@@ -7197,6 +7206,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
glCullFace(GL_FRONT);
+
static LLCullResult ref_result;
U32 ref_mask = 0;
if (LLDrawPoolWater::sNeedsDistortionUpdate)
@@ -7248,6 +7258,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
ref_mask = mRenderTypeMask;
mRenderTypeMask = mask;
}
+
if (LLDrawPoolWater::sNeedsDistortionUpdate)
{
mRenderTypeMask = ref_mask;
@@ -7265,6 +7276,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
camera.setOrigin(camera_in.getOrigin());
+
//render distortion map
static BOOL last_update = TRUE;
if (last_update)
@@ -7321,6 +7333,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
glClear(GL_DEPTH_BUFFER_BIT);
}
glClearColor(0.f, 0.f, 0.f, 0.f);
+
gViewerWindow->setup3DViewport();
mRenderTypeMask = type_mask;
LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;
@@ -7332,9 +7345,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
LLGLState::checkTextureChannels();
LLGLState::checkClientArrays();
- if (!skip_avatar_update)
+ if (avatarp)
{
- gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+ avatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
}
}
}
@@ -7833,6 +7846,7 @@ void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade)
void LLPipeline::generateHighlight(LLCamera& camera)
{
//render highlighted object as white into offscreen render target
+
if (mHighlightObject.notNull())
{
mHighlightSet.insert(HighlightItem(mHighlightObject));