summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerdisplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerdisplay.cpp')
-rw-r--r--indra/newview/llviewerdisplay.cpp119
1 files changed, 97 insertions, 22 deletions
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 9099ddc896..54c6f0a71f 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -108,7 +108,7 @@ LLFrameTimer gRecentMemoryTime;
// Rendering stuff
void pre_show_depth_buffer();
void post_show_depth_buffer();
-void render_ui();
+void render_ui(F32 zoom_factor = 1.f, int subfield = 0);
void render_hud_attachments();
void render_ui_3d();
void render_ui_2d();
@@ -161,9 +161,9 @@ void display_startup()
glClear(GL_DEPTH_BUFFER_BIT);
}
-
void display_update_camera()
{
+ llpushcallstacks ;
// TODO: cut draw distance down if customizing avatar?
// TODO: cut draw distance on per-parcel basis?
@@ -500,12 +500,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
if (LLDynamicTexture::updateAllInstances())
{
gGL.setColorMask(true, true);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT);
}
}
gViewerWindow->setupViewport();
-
+
+ gPipeline.resetFrameStats(); // Reset per-frame statistics.
if (!gDisconnected)
{
LLAppViewer::instance()->pingMainloopTimeout("Display:Update");
@@ -528,6 +529,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gFrameStats.start(LLFrameStats::UPDATE_GEOM);
const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time
+ gPipeline.createObjects(max_geom_update_time);
gPipeline.updateGeom(max_geom_update_time);
stop_glerror();
@@ -557,10 +559,17 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
&& gSavedSettings.getBOOL("UseOcclusion")
&& gGLManager.mHasOcclusionQuery) ? 2 : 0;
+
+ if (LLPipeline::sUseOcclusion && LLPipeline::sRenderDeferred)
+ { //force occlusion on for all render types if doing deferred render
+ LLPipeline::sUseOcclusion = 3;
+ }
+
LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha");
LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip");
LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible");
-
+ LLPipeline::sDelayVBUpdate = gSavedSettings.getBOOL("RenderDelayVBUpdate");
+
S32 occlusion = LLPipeline::sUseOcclusion;
if (gDepthDirty)
{ //depth buffer is invalid, don't overwrite occlusion state
@@ -568,18 +577,25 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
}
gDepthDirty = FALSE;
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
+ LLGLState::checkClientArrays();
+
static LLCullResult result;
gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip);
stop_glerror();
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
+ LLGLState::checkClientArrays();
+
BOOL to_texture = !for_snapshot &&
gPipeline.canUseVertexShaders() &&
LLPipeline::sRenderGlow;
LLAppViewer::instance()->pingMainloopTimeout("Display:Swap");
- // now do the swap buffer (just before rendering to framebuffer)
- { //swap and flush state from previous frame
+ {
{
LLFastTimer ftm(LLFastTimer::FTM_CLIENT_COPY);
LLVertexBuffer::clientCopy(0.016);
@@ -593,14 +609,29 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gGL.setColorMask(true, true);
glClearColor(0,0,0,0);
-
+
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
+ LLGLState::checkClientArrays();
+
if (!for_snapshot)
{
+ if (gFrameCount > 1)
+ { //for some reason, ATI 4800 series will error out if you
+ //try to generate a shadow before the first frame is through
+ gPipeline.generateSunShadow(*LLViewerCamera::getInstance());
+ }
+
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
+ LLGLState::checkClientArrays();
+
glh::matrix4f proj = glh_get_current_projection();
glh::matrix4f mod = glh_get_current_modelview();
glViewport(0,0,512,512);
LLVOAvatar::updateFreezeCounter() ;
LLVOAvatar::updateImpostors();
+
glh_set_current_projection(proj);
glh_set_current_modelview(mod);
glMatrixMode(GL_PROJECTION);
@@ -608,8 +639,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(mod.m);
gViewerWindow->setupViewport();
+
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
+ LLGLState::checkClientArrays();
+
}
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
if (!for_snapshot)
@@ -626,6 +662,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
//
// Doing this here gives hardware occlusion queries extra time to complete
LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages");
+ LLError::LLCallStacks::clear() ;
+ llpushcallstacks ;
gFrameStats.start(LLFrameStats::IMAGE_UPDATE);
{
@@ -640,7 +678,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gImageList.updateImages(max_image_decode_time);
stop_glerror();
}
-
+ llpushcallstacks ;
///////////////////////////////////
//
// StateSort
@@ -722,11 +760,25 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
// glPopMatrix();
//}
+ LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
+ LLPipeline::updateRenderDeferred();
+
+ stop_glerror();
+
if (to_texture)
{
gGL.setColorMask(true, true);
- gPipeline.mScreen.bindTarget();
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
+ {
+ gPipeline.mDeferredScreen.bindTarget();
+ gPipeline.mDeferredScreen.clear();
+ }
+ else
+ {
+ gPipeline.mScreen.bindTarget();
+ gPipeline.mScreen.clear();
+ }
+
gGL.setColorMask(true, false);
}
@@ -737,9 +789,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
{
gGL.setColorMask(true, false);
- LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
- gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE);
- LLPipeline::sUnderWaterRender = FALSE;
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
+ {
+ gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance());
+ }
+ else
+ {
+ gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE);
+ }
+
gGL.setColorMask(true, true);
//store this frame's modelview matrix for use
@@ -755,8 +813,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
if (to_texture)
{
-
- gPipeline.mScreen.flush();
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
+ {
+ gPipeline.mDeferredScreen.flush();
+ }
+ else
+ {
+ gPipeline.mScreen.flush();
+ }
}
/// We copy the frame buffer straight into a texture here,
@@ -765,8 +829,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
/// grasp of their full display stack just yet.
// gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
+ {
+ gPipeline.renderDeferredLighting();
+ }
+
+ LLPipeline::sUnderWaterRender = FALSE;
+
LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI");
-
if (!for_snapshot)
{
gFrameStats.start(LLFrameStats::RENDER_UI);
@@ -818,7 +888,10 @@ void render_hud_attachments()
//only render hud objects
U32 mask = gPipeline.getRenderTypeMask();
gPipeline.setRenderTypeMask(0);
- gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
+ if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
+ {
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
+ }
BOOL has_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
if (has_ui)
@@ -829,16 +902,18 @@ void render_hud_attachments()
S32 use_occlusion = LLPipeline::sUseOcclusion;
LLPipeline::sUseOcclusion = 0;
LLPipeline::sDisableShaders = TRUE;
-
+
//cull, sort, and render hud objects
static LLCullResult result;
LLSpatialGroup::sNoDelete = TRUE;
+
gPipeline.updateCull(hud_cam, result);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME);
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA);
+ gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT);
gPipeline.stateSort(hud_cam, result);
@@ -935,7 +1010,7 @@ BOOL setup_hud_matrices(const LLRect& screen_region)
}
-void render_ui()
+void render_ui(F32 zoom_factor, int subfield)
{
LLGLState::checkStates();
@@ -950,7 +1025,7 @@ void render_ui()
if (to_texture)
{
- gPipeline.renderBloom(gSnapshot);
+ gPipeline.renderBloom(gSnapshot, zoom_factor, subfield);
}
render_hud_elements();