From a2b09df2db69ba8a2e6b587d839d509fbe5abebb Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 14 Oct 2022 15:52:44 -0500 Subject: SL-18293 Fix for broken wireframe mode. --- indra/newview/llappviewer.cpp | 3 --- indra/newview/llappviewer.h | 1 - indra/newview/llviewerdisplay.cpp | 21 ++++++++++++++++++--- indra/newview/llviewermenu.cpp | 22 ++-------------------- indra/newview/llviewertexture.cpp | 3 +-- indra/newview/pipeline.cpp | 24 +++++++++++++++++++----- 6 files changed, 40 insertions(+), 34 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8e5a796498..130de92ade 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -338,9 +338,6 @@ LLFrameTimer gRestoreGLTimer; BOOL gRestoreGL = FALSE; bool gUseWireframe = FALSE; -//use for remember deferred mode in wireframe switch -bool gInitialDeferredModeForWireframe = FALSE; - LLMemoryInfo gSysMemory; U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index f28a90c703..3888fa8ae3 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -392,7 +392,6 @@ extern BOOL gDisconnected; extern LLFrameTimer gRestoreGLTimer; extern BOOL gRestoreGL; extern bool gUseWireframe; -extern bool gInitialDeferredModeForWireframe; extern LLMemoryInfo gSysMemory; extern U64Bytes gMemoryAllocated; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index a617bdb2cb..46e25b18b7 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -860,7 +860,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { glClearColor(0.5f, 0.5f, 0.5f, 0.f); glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart"); @@ -913,7 +912,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (LLPipeline::sRenderDeferred) { gPipeline.mRT->deferredScreen.bindTarget(); - glClearColor(1, 0, 1, 1); + if (gUseWireframe) + { + F32 g = 0.5f; + glClearColor(g, g, g, 1.f); + } + else + { + glClearColor(1, 0, 1, 1); + } gPipeline.mRT->deferredScreen.clear(); } else @@ -1102,6 +1109,7 @@ void display_cube_face() gPipeline.updateCull(*LLViewerCamera::getInstance(), result); gGL.setColorMask(true, true); + glClearColor(0, 0, 0, 0); gPipeline.generateSunShadow(*LLViewerCamera::getInstance()); @@ -1132,7 +1140,14 @@ void display_cube_face() gGL.setColorMask(true, true); gPipeline.mRT->deferredScreen.bindTarget(); - glClearColor(1, 0, 1, 1); + if (gUseWireframe) + { + glClearColor(0.5f, 0.5f, 0.5f, 1.f); + } + else + { + glClearColor(1, 0, 1, 1); + } gPipeline.mRT->deferredScreen.clear(); gGL.setColorMask(true, false); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 1842c434e7..31c629fae8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1210,6 +1210,7 @@ class LLAdvancedCheckFrameTest : public view_listener_t /////////////////////////// // SELECTED TEXTURE INFO // +// /////////////////////////// @@ -1231,24 +1232,6 @@ class LLAdvancedToggleWireframe : public view_listener_t bool handleEvent(const LLSD& userdata) { gUseWireframe = !(gUseWireframe); - gWindowResized = TRUE; - - LLPipeline::updateRenderDeferred(); - - if (gUseWireframe) - { - gInitialDeferredModeForWireframe = LLPipeline::sRenderDeferred; - } - - gPipeline.resetVertexBuffers(); - - if (!gUseWireframe && !gInitialDeferredModeForWireframe && LLPipeline::sRenderDeferred != bool(gInitialDeferredModeForWireframe) && gPipeline.isInit()) - { - LLPipeline::refreshCachedSettings(); - gPipeline.releaseGLBuffers(); - gPipeline.createGLBuffers(); - LLViewerShaderMgr::instance()->setShaders(); - } return true; } @@ -1258,8 +1241,7 @@ class LLAdvancedCheckWireframe : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = gUseWireframe; - return new_value; + return gUseWireframe; } }; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 6cf9665e3e..590f24d359 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1913,8 +1913,7 @@ bool LLViewerFetchedTexture::updateFetch() static LLCachedControl textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled", false); static LLCachedControl sCameraMotionThreshold(gSavedSettings,"TextureCameraMotionThreshold", 0.2); static LLCachedControl sCameraMotionBoost(gSavedSettings,"TextureCameraMotionBoost", 3); - if(textures_decode_disabled || - (gUseWireframe && mBoostLevel < LLGLTexture::BOOST_AVATAR_BAKED_SELF)) // don't fetch the surface textures in wireframe mode + if(textures_decode_disabled) // don't fetch the surface textures in wireframe mode { return false; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ef7ebda834..0c27296440 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4541,6 +4541,11 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY); LL_PROFILE_GPU_ZONE("renderGeomDeferred"); + if (gUseWireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } + bool occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion; { @@ -4647,6 +4652,11 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) gGL.setColorMask(true, false); } // Tracy ZoneScoped + + if (gUseWireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } } void LLPipeline::renderGeomPostDeferred(LLCamera& camera) @@ -4654,6 +4664,11 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLS); LL_PROFILE_GPU_ZONE("renderGeomPostDeferred"); + if (gUseWireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } + U32 cur_type = 0; LLGLEnable cull(GL_CULL_FACE); @@ -4733,6 +4748,10 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) renderDebug(); } + if (gUseWireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } } void LLPipeline::renderGeomShadow(LLCamera& camera) @@ -7528,11 +7547,6 @@ void LLPipeline::renderFinalize() assertInitialized(); - if (gUseWireframe) - { - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } - LLVector2 tc1(0, 0); LLVector2 tc2((F32) mRT->screen.getWidth() * 2, (F32) mRT->screen.getHeight() * 2); -- cgit v1.2.3