diff options
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 29 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 3 |
3 files changed, 36 insertions, 7 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 184ee8daff..43e554e532 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9049,6 +9049,17 @@ <key>Value</key> <real>0.5</real> </map> + <key>RenderShadowSplits</key> + <map> + <key>Comment</key> + <string>Amount of shadow map splits to render (0 - 3).</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>3</integer> + </map> <key>RenderSSAOScale</key> <map> <key>Comment</key> diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c895c8a227..d3936fabcf 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -150,6 +150,7 @@ U32 LLPipeline::RenderFSAASamples; U32 LLPipeline::RenderResolutionDivisor; bool LLPipeline::RenderUIBuffer; S32 LLPipeline::RenderShadowDetail; +S32 LLPipeline::RenderShadowSplits; bool LLPipeline::RenderDeferredSSAO; F32 LLPipeline::RenderShadowResolutionScale; bool LLPipeline::RenderLocalLights; @@ -544,6 +545,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderResolutionDivisor"); connectRefreshCachedSettingsSafe("RenderUIBuffer"); connectRefreshCachedSettingsSafe("RenderShadowDetail"); + connectRefreshCachedSettingsSafe("RenderShadowSplits"); connectRefreshCachedSettingsSafe("RenderDeferredSSAO"); connectRefreshCachedSettingsSafe("RenderShadowResolutionScale"); connectRefreshCachedSettingsSafe("RenderLocalLights"); @@ -611,6 +613,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("CameraDoFResScale"); connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit"); gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("AutoFPS")->getCommitSignal()->connect(boost::bind(&LLPipeline::onToggleAutoFPS)); } LLPipeline::~LLPipeline() @@ -1073,6 +1076,7 @@ void LLPipeline::refreshCachedSettings() RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer"); RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail"); + RenderShadowSplits = gSavedSettings.getS32("RenderShadowSplits"); RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO"); RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale"); RenderLocalLights = gSavedSettings.getBOOL("RenderLocalLights"); @@ -10270,7 +10274,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) std::vector<LLVector3> fp; - if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)) + if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir) + || j > RenderShadowSplits) { //no possible shadow receivers if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) @@ -11505,10 +11510,10 @@ void LLPipeline::autoAdjustSettings() { S32 fps_dif = fps_lower_boundary - fps; - if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0) + if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits > 0) { - S32 shadow_detail = RenderShadowDetail - 1; - gSavedSettings.setS32("RenderShadowDetail", shadow_detail); + S32 shadow_splits = llclamp(RenderShadowSplits - 1, 0, 3); + gSavedSettings.setS32("RenderShadowSplits", shadow_splits); return; } @@ -11542,10 +11547,10 @@ void LLPipeline::autoAdjustSettings() update_far_clip(fps_dif); } - if (LLPipeline::sRenderDeferred && RenderShadowDetail < 2) + if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits < 3) { - S32 shadow_detail = RenderShadowDetail + 1; - gSavedSettings.setS32("RenderShadowDetail", shadow_detail); + S32 shadow_splits = llclamp(RenderShadowSplits + 1, 0, 3); + gSavedSettings.setS32("RenderShadowSplits", shadow_splits); } } } @@ -11561,3 +11566,13 @@ void LLPipeline::setAdjustmentTimerExpiry(F32 expiration) { mUpdateTimer->setTimerExpirySec(expiration); } + +void LLPipeline::onToggleAutoFPS() +{ + if (!gSavedSettings.getBOOL("AutoFPS")) + { + //reset the number of shadow map splits rendered, when disabling auto-fps + //probably should be removed, if we'll have actual UI control for this setting + gSavedSettings.setS32("RenderShadowSplits", 3); + } +} diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 3e5899d973..b86b68b09d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -416,6 +416,8 @@ public: static void updateRenderDeferred(); static void refreshCachedSettings(); + static void onToggleAutoFPS(); + void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector<U32>& restoreList ); @@ -916,6 +918,7 @@ public: static U32 RenderResolutionDivisor; static bool RenderUIBuffer; static S32 RenderShadowDetail; + static S32 RenderShadowSplits; static bool RenderDeferredSSAO; static F32 RenderShadowResolutionScale; static bool RenderLocalLights; |