diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-07 13:25:40 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-07 13:25:40 -0500 |
commit | 4a4b0f8ee8834de01e52d32aecdb0479ed5fb7a9 (patch) | |
tree | 30bc350ef6fca729e50466b2ca72ff147db357a1 /indra/newview/llviewerdisplay.cpp | |
parent | 26f99409d247a0c872239d73ac05451ef8531ff4 (diff) |
SL-18190 Rearrange render order so 3D UI has access to the depth buffer.
Diffstat (limited to 'indra/newview/llviewerdisplay.cpp')
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 5ae7f522f2..112d669740 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1374,10 +1374,10 @@ void render_ui(F32 zoom_factor, int subfield) gGL.popMatrix(); } - // Finalize scene - gPipeline.renderFinalize(); - { + // draw hud and 3D ui elements into screen render target so they'll be able to use + // the depth buffer (avoids extra copy of depth buffer per frame) + gPipeline.mRT->screen.bindTarget(); // SL-15709 // NOTE: Tracy only allows one ZoneScoped per function. // Solutions are: @@ -1394,41 +1394,46 @@ void render_ui(F32 zoom_factor, int subfield) gPipeline.disableLights(); } - { - gGL.color4f(1,1,1,1); - if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) - { - if (!gDisconnected) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 3D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_3D); - render_ui_3d(); - LLGLState::checkStates(); - } - else - { - render_disconnected_background(); - } + gGL.color4f(1,1,1,1); - LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 2D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_2D); - render_ui_2d(); - LLGLState::checkStates(); - } - gGL.flush(); + bool render_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); + if (render_ui) + { + if (!gDisconnected) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 3D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_3D); + render_ui_3d(); + LLGLState::checkStates(); + } + else + { + render_disconnected_background(); + } + } - gViewerWindow->setup2DRender(); - gViewerWindow->updateDebugText(); - gViewerWindow->drawDebugText(); + gPipeline.mRT->screen.flush(); - LLVertexBuffer::unbind(); - } + // apply gamma correction and post effects before rendering 2D UI + gPipeline.renderFinalize(); - if (!gSnapshot) - { - set_current_modelview(saved_view); - gGL.popMatrix(); - } + if (render_ui) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 2D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_2D); + render_ui_2d(); + LLGLState::checkStates(); + gGL.flush(); + } - } // Tracy integration + gViewerWindow->setup2DRender(); + gViewerWindow->updateDebugText(); + gViewerWindow->drawDebugText(); + } + + if (!gSnapshot) + { + set_current_modelview(saved_view); + gGL.popMatrix(); + } } static LLTrace::BlockTimerStatHandle FTM_SWAP("Swap"); |