From f14db21745e1e149e03ad029ce9a3e96208d979d Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Sun, 17 May 2020 19:52:23 +1200 Subject: [PATCH] Make disableShadowsForStateSet a no-op when shadows are disabled Otherwise the GPU has to do useless shadow comparisons when shadows are disabled. --- components/sceneutil/shadow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/sceneutil/shadow.cpp b/components/sceneutil/shadow.cpp index a1cd1d660b..8c564f2249 100644 --- a/components/sceneutil/shadow.cpp +++ b/components/sceneutil/shadow.cpp @@ -69,6 +69,9 @@ namespace SceneUtil void ShadowManager::disableShadowsForStateSet(osg::ref_ptr stateset) { + if (!Settings::Manager::getBool("enable shadows", "Shadows")) + return; + int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows"); numberOfShadowMapsPerLight = std::max(1, std::min(numberOfShadowMapsPerLight, 8));