diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2022-02-14 18:59:55 +0200 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2022-02-14 18:59:55 +0200 |
commit | 95f7b552adf179b47cb74a4e39581e8d9c58dddc (patch) | |
tree | 6c1bf5ab05d68132595d9df2b787786b0c37a691 | |
parent | 7af2d51f57416cb68b435cecfd4eacf5d1a4c9fc (diff) |
SL-16841 Skip rendering shadows when decreasing shadow detail setting to avoid stalls
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 8 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 33 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 2 |
3 files changed, 34 insertions, 9 deletions
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index e53f988c6e..4d86da5f78 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -166,6 +166,12 @@ static bool handleSetShaderChanged(const LLSD& newvalue) return true; } +static bool handleShadowDetailChanged(const LLSD& newvalue) +{ + gPipeline.handleShadowDetailChanged(); + return true; +} + static bool handleRenderPerfTestChanged(const LLSD& newvalue) { bool status = !newvalue.asBoolean(); @@ -695,7 +701,7 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2)); gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2)); gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2)); - gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleShadowDetailChanged, _2)); gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2)); gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2)); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 96dd0b895d..c895c8a227 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -10215,14 +10215,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) if (mSunDiffuse == LLColor4::black) { //sun diffuse is totally black, shadows don't matter - LLGLDepthTest depth(GL_TRUE); - - for (S32 j = 0; j < 4; j++) - { - mShadow[j].bindTarget(); - mShadow[j].clear(); - mShadow[j].flush(); - } + skipRenderingShadows(); } else { @@ -11430,6 +11423,30 @@ void LLPipeline::restoreHiddenObject( const LLUUID& id ) } } +void LLPipeline::skipRenderingShadows() +{ + LLGLDepthTest depth(GL_TRUE); + + for (S32 j = 0; j < 4; j++) + { + mShadow[j].bindTarget(); + mShadow[j].clear(); + mShadow[j].flush(); + } +} + +void LLPipeline::handleShadowDetailChanged() +{ + if (RenderShadowDetail > gSavedSettings.getS32("RenderShadowDetail")) + { + skipRenderingShadows(); + } + else + { + LLViewerShaderMgr::instance()->setShaders(); + } +} + const F32 MIN_DRAW_DISTANCE = 64; const F32 MAX_DRAW_DISTANCE = 256; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 7eff573a34..3e5899d973 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -423,6 +423,7 @@ public: void skipRenderingOfTerrain( bool flag ); void hideObject( const LLUUID& id ); void restoreHiddenObject( const LLUUID& id ); + void handleShadowDetailChanged(); void autoAdjustSettings(); void setAdjustmentTimerExpiry(F32 expiration); @@ -437,6 +438,7 @@ private: void connectRefreshCachedSettingsSafe(const std::string name); void hideDrawable( LLDrawable *pDrawable ); void unhideDrawable( LLDrawable *pDrawable ); + void skipRenderingShadows(); public: enum {GPU_CLASS_MAX = 3 }; |