diff options
author | Dave Parks <davep@lindenlab.com> | 2023-02-27 10:42:53 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-02-27 10:42:53 -0600 |
commit | 4ec8844f012f27ddd0ab9aa6a3098273c7bb0ac1 (patch) | |
tree | 2c92393df0209ba5203d0d5d9da105834ecf5820 | |
parent | 61a6054e3ae4a9e63b6d96901ed8b4720205c3ed (diff) |
DRTVWR-559 Fix for occlusion culling going off the rails when settings change -- remove LLPipeline::resetVertexBuffers and add a sanity check to how long we wait for a query to be "available".
-rw-r--r-- | indra/newview/llagent.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 3 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 84 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 4 |
11 files changed, 10 insertions, 152 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index af4c68e41f..6113c30a84 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3960,8 +3960,6 @@ bool LLAgent::teleportCore(bool is_local) LL_INFOS("Teleport") << "Non-local, setting teleport state to TELEPORT_START" << LL_ENDL; gAgent.setTeleportState( LLAgent::TELEPORT_START ); - //release geometry from old location - gPipeline.resetVertexBuffers(); LLSpatialPartition::sTeleportRequested = TRUE; } make_ui_sound("UISndTeleportOut"); @@ -4305,7 +4303,6 @@ void LLAgent::teleportCancel() } clearTeleportRequest(); gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); - gPipeline.resetVertexBuffers(); } void LLAgent::restoreCanceledTeleportRequest() diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 764131ab79..35e11b8991 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3234,6 +3234,7 @@ public: renderAgentTarget(avatar); } +#if 0 if (gDebugGL) { for (U32 i = 0; i < drawable->getNumFaces(); ++i) @@ -3259,6 +3260,7 @@ public: } } } +#endif } for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index ea53012b7a..59b566efb6 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -149,14 +149,7 @@ static bool handleSetShaderChanged(const LLSD& newvalue) if (gPipeline.isInit()) { // ALM depends onto atmospheric shaders, state might have changed - bool old_state = LLPipeline::sRenderDeferred; LLPipeline::refreshCachedSettings(); - if (old_state != LLPipeline::sRenderDeferred) - { - gPipeline.releaseGLBuffers(); - gPipeline.createGLBuffers(); - gPipeline.resetVertexBuffers(); - } } // else, leave terrain detail as is @@ -206,7 +199,6 @@ bool handleRenderTransparentWaterChanged(const LLSD& newvalue) gPipeline.updateRenderTransparentWater(); gPipeline.releaseGLBuffers(); gPipeline.createGLBuffers(); - gPipeline.resetVertexBuffers(); LLViewerShaderMgr::instance()->setShaders(); } LLWorld::getInstance()->updateWaterObjects(); @@ -397,15 +389,6 @@ static bool handleWLSkyDetailChanged(const LLSD&) return true; } -static bool handleResetVertexBuffersChanged(const LLSD&) -{ - if (gPipeline.isInit()) - { - gPipeline.resetVertexBuffers(); - } - return true; -} - static bool handleRepartition(const LLSD&) { if (gPipeline.isInit()) @@ -436,7 +419,6 @@ static bool handleReflectionProbeDetailChanged(const LLSD& newvalue) LLPipeline::refreshCachedSettings(); gPipeline.releaseGLBuffers(); gPipeline.createGLBuffers(); - gPipeline.resetVertexBuffers(); LLViewerShaderMgr::instance()->setShaders(); } return true; @@ -654,7 +636,6 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderGlow", handleReleaseGLBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderGlow", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderGlowResolutionPow", handleReleaseGLBufferChanged); - // DEPRECATED -- setting_setup_signal_listener(gSavedSettings, "WindLightUseAtmosShaders", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderGammaFull", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderVolumeLODFactor", handleVolumeLODChanged); setting_setup_signal_listener(gSavedSettings, "RenderAvatarLODFactor", handleAvatarLODChanged); @@ -667,17 +648,11 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderMaxPartCount", handleMaxPartCountChanged); setting_setup_signal_listener(gSavedSettings, "RenderDynamicLOD", handleRenderDynamicLODChanged); setting_setup_signal_listener(gSavedSettings, "RenderLocalLights", handleRenderLocalLightsChanged); - setting_setup_signal_listener(gSavedSettings, "RenderDebugTextureBind", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderAutoMaskAlphaDeferred", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderAutoMaskAlphaNonDeferred", handleResetVertexBuffersChanged); - // DEPRECATED - setting_setup_signal_listener(gSavedSettings, "RenderObjectBump", handleRenderBumpChanged); - setting_setup_signal_listener(gSavedSettings, "RenderMaxVBOSize", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderVSyncEnable", handleVSyncChanged); + setting_setup_signal_listener(gSavedSettings, "RenderVSyncEnable", handleVSyncChanged); setting_setup_signal_listener(gSavedSettings, "RenderDeferredNoise", handleReleaseGLBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderDebugPipeline", handleRenderDebugPipelineChanged); setting_setup_signal_listener(gSavedSettings, "RenderResolutionDivisor", handleRenderResolutionDivisorChanged); - // DEPRECATED - setting_setup_signal_listener(gSavedSettings, "RenderDeferred", handleRenderDeferredChanged); - setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeDetail", handleReflectionProbeDetailChanged); + setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeDetail", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderReflectionsEnabled", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderScreenSpaceReflections", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderShadowDetail", handleSetShaderChanged); @@ -705,11 +680,6 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "MuteVoice", handleAudioVolumeChanged); setting_setup_signal_listener(gSavedSettings, "MuteAmbient", handleAudioVolumeChanged); setting_setup_signal_listener(gSavedSettings, "MuteUI", handleAudioVolumeChanged); - setting_setup_signal_listener(gSavedSettings, "RenderVBOEnable", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderUseVAO", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderVBOMappingDisable", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderUseStreamVBO", handleResetVertexBuffersChanged); - setting_setup_signal_listener(gSavedSettings, "RenderPreferStreamDraw", handleResetVertexBuffersChanged); setting_setup_signal_listener(gSavedSettings, "WLSkyDetail", handleWLSkyDetailChanged); setting_setup_signal_listener(gSavedSettings, "JoystickAxis0", handleJoystickChanged); setting_setup_signal_listener(gSavedSettings, "JoystickAxis1", handleJoystickChanged); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 62144b2d31..59333b6cee 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -279,14 +279,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkStates(); - stop_glerror(); - gPipeline.disableLights(); - - //reset vertex buffers if needed - gPipeline.doResetVertexBuffers(); - - stop_glerror(); // Don't draw if the window is hidden or minimized. // In fact, must explicitly check the minimized state before drawing. diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 5a3f2f22b8..3a8206ad26 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8540,7 +8540,6 @@ BOOL get_visibility(void* user_data) return viewp->getVisible(); } -// TomY TODO: Get rid of these? class LLViewShowHoverTips : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8559,13 +8558,11 @@ class LLViewCheckShowHoverTips : public view_listener_t } }; -// TomY TODO: Get rid of these? class LLViewHighlightTransparent : public view_listener_t { bool handleEvent(const LLSD& userdata) { LLDrawPoolAlpha::sShowDebugAlpha = !LLDrawPoolAlpha::sShowDebugAlpha; - gPipeline.resetVertexBuffers(); return true; } }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e96047df14..4ecb54aa0f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2938,8 +2938,6 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Teleport is finished; it can't be cancelled now. gViewerWindow->setProgressCancelButtonVisible(FALSE); - gPipeline.doResetVertexBuffers(true); - // Do teleport effect for where you're leaving // VEFFECT: TeleportStart LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 7d6c18ae67..d1d23cfb8e 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -870,6 +870,7 @@ LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctre for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) { mOcclusionQuery[i] = 0; + mOcclusionCheckCount[i] = 0; mOcclusionIssued[i] = 0; mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0; mVisible[i] = 0; @@ -1127,10 +1128,12 @@ void LLOcclusionCullingGroup::checkOcclusion() { LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query available"); glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE, &available); + mOcclusionCheckCount[LLViewerCamera::sCurCameraID]++; } - if (available) + if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > 4) { + mOcclusionCheckCount[LLViewerCamera::sCurCameraID] = 0; GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint) { LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query result"); @@ -1140,20 +1143,6 @@ void LLOcclusionCullingGroup::checkOcclusion() sPendingQueries.erase(mOcclusionQuery[LLViewerCamera::sCurCameraID]); #endif -#if 0 // (12/2021) occasional false-negative occlusion tests produce water reflection errors, SL-16461 - // If/when water occlusion queries become 100% reliable, re-enable this optimization - - if (LLPipeline::RENDER_TYPE_WATER == mSpatialPartition->mDrawableType) - { - // Note any unoccluded water, for deciding on reflection/distortion passes - // (If occlusion is disabled, these are set within LLDrawPoolWater::render) - if (query_result > 0) - { - LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; - LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; - } - } -#endif if (query_result > 0) { clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF); diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7666062f99..353429d254 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -336,6 +336,7 @@ protected: LLViewerOctreePartition* mSpatialPartition; U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS]; + U32 mOcclusionCheckCount[LLViewerCamera::NUM_CAMERAS]; public: static std::set<U32> sPendingQueries; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 859df1277c..f4f20ee7a6 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -378,9 +378,6 @@ void LLViewerShaderMgr::setShaders() LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow"); - //hack to reset buffers that change behavior with shaders - gPipeline.resetVertexBuffers(); - if (gViewerWindow) { gViewerWindow->setCursor(UI_CURSOR_WAIT); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9522f804d6..b5b5d9ef7f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -681,8 +681,6 @@ void LLPipeline::destroyGL() resetDrawOrders(); - resetVertexBuffers(); - releaseGLBuffers(); if (mMeshDirtyQueryObject) @@ -6753,88 +6751,6 @@ void LLPipeline::resetVertexBuffers(LLDrawable* drawable) } } -void LLPipeline::resetVertexBuffers() -{ - mResetVertexBuffers = true; -} - -void LLPipeline::doResetVertexBuffers(bool forced) -{ - if (!mResetVertexBuffers) - { - return; - } - if(!forced && LLSpatialPartition::sTeleportRequested) - { - if(gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) - { - return; //wait for teleporting to finish - } - else - { - //teleporting aborted - LLSpatialPartition::sTeleportRequested = FALSE; - mResetVertexBuffers = false; - return; - } - } - - LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - mResetVertexBuffers = false; - - mCubeVB = NULL; - mDeferredVB = NULL; - - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) - { - LLViewerRegion* region = *iter; - for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) - { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - part->resetVertexBuffers(); - } - } - } - if(LLSpatialPartition::sTeleportRequested) - { - LLSpatialPartition::sTeleportRequested = FALSE; - - LLWorld::getInstance()->clearAllVisibleObjects(); - clearRebuildDrawables(); - } - - resetDrawOrders(); - - gSky.resetVertexBuffers(); - - LLVOPartGroup::destroyGL(); - - if ( LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->cleanupVBOManager(); - } - LLVOPartGroup::destroyGL(); - gGL.resetVertexBuffer(); - - LLVertexBuffer::unbind(); - - updateRenderBump(); - - sBakeSunlight = gSavedSettings.getBOOL("RenderBakeSunlight"); - sNoAlpha = gSavedSettings.getBOOL("RenderNoAlpha"); - LLPipeline::sTextureBindTest = gSavedSettings.getBOOL("RenderDebugTextureBind"); - - gGL.initVertexBuffer(); - - mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK); - mDeferredVB->allocateBuffer(8, 0); - - LLVOPartGroup::restoreGL(); -} - void LLPipeline::renderObjects(U32 type, bool texture, bool batch_texture, bool rigged) { assertInitialized(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 29dd42e4ec..483fe08559 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -97,9 +97,7 @@ public: void destroyGL(); void restoreGL(); - void resetVertexBuffers(); - void doResetVertexBuffers(bool forced = false); - void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks... + void requestResizeScreenTexture(); // set flag only, no work, safer for callbacks... void requestResizeShadowTexture(); // set flag only, no work, safer for callbacks... void resizeScreenTexture(); |