From 1d86dcd846ed5ea7734df507d15adf057cb2ebd0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 8 Jul 2019 10:10:22 -0700 Subject: SL-10625 another shot across the bow Move dynamic texture update (which does local back readback work) to just before swap which may keep the Intel driver from tripping on its own shoelaces and is also subjectively faster for bakes. --- indra/newview/lldrawpool.cpp | 9 +++++++-- indra/newview/lldrawpool.h | 2 +- indra/newview/lldynamictexture.cpp | 6 ++++-- indra/newview/llviewerdisplay.cpp | 38 +++++++++++++++++--------------------- 4 files changed, 29 insertions(+), 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 9c072bb0aa..b110a6a810 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -406,9 +406,9 @@ void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL t } } -void LLRenderPass::renderTexture(U32 type, U32 mask) +void LLRenderPass::renderTexture(U32 type, U32 mask, BOOL batch_textures) { - pushBatches(type, mask, TRUE); + pushBatches(type, mask, batch_textures); } void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) @@ -461,6 +461,11 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params) void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures) { + if (!params.mCount) + { + return; + } + applyModelMatrix(params); bool tex_setup = false; diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index df86d78a89..4eb9a4151d 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -174,7 +174,7 @@ public: virtual void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE); virtual void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE); virtual void renderGroups(U32 type, U32 mask, BOOL texture = TRUE); - virtual void renderTexture(U32 type, U32 mask); + virtual void renderTexture(U32 type, U32 mask, BOOL batch_textures = TRUE); }; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index fa9a0712fa..5e283f7cd0 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -213,7 +213,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() sNumRenders = 0; if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled) { - return TRUE; + return FALSE; } bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI; @@ -248,7 +248,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances() result = TRUE; sNumRenders++; } - gGL.flush(); + //gGL.flush(); LLVertexBuffer::unbind(); dynamicTexture->postRender(result); @@ -261,6 +261,8 @@ BOOL LLViewerDynamicTexture::updateAllInstances() gPipeline.mWaterDis.flush(); } + gGL.flush(); + return ret; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 736626debd..7101f6fbb0 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -130,9 +130,6 @@ void display_startup() gPipeline.updateGL(); - // Update images? - //gImageList.updateImages(0.01f); - // Written as branch to appease GCC which doesn't like different // pointer types across ternary ops // @@ -149,11 +146,6 @@ void display_startup() LLGLState::checkStates(); LLGLState::checkTextureChannels(); - if (frame_count++ > 1) // make sure we have rendered a frame first - { - LLViewerDynamicTexture::updateAllInstances(); - } - LLGLState::checkStates(); LLGLState::checkTextureChannels(); @@ -595,18 +587,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Actually push all of our triangles to the screen. // - // do render-to-texture stuff here - if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES)) - { - LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures"); - LL_RECORD_BLOCK_TIME(FTM_UPDATE_DYNAMIC_TEXTURES); - if (LLViewerDynamicTexture::updateAllInstances()) - { - gGL.setColorMask(true, true); - glClear(GL_DEPTH_BUFFER_BIT); - } - } - gViewerWindow->setup3DViewport(); gPipeline.resetFrameStats(); // Reset per-frame statistics. @@ -1037,10 +1017,26 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!for_snapshot) { render_ui(); + } + + // do render-to-texture stuff here + if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES)) + { + LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures"); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_DYNAMIC_TEXTURES); + if (LLViewerDynamicTexture::updateAllInstances()) + { + gGL.setColorMask(true, true); + glClear(GL_DEPTH_BUFFER_BIT); + } + } + + LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); + if (!for_snapshot) + { swap(); } - LLSpatialGroup::sNoDelete = FALSE; gPipeline.clearReferences(); -- cgit v1.2.3