From 0ee08d4f8c1c1bf83d71f8d1dd3e8233ffacbcd9 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Mon, 23 Jun 2025 15:26:27 +0100 Subject: [PATCH 1/2] perf(llf): significantly improve scaling with many lights --- src/Features/LightLimitFix.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index 5f4a979162..4112f3093a 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -277,6 +277,33 @@ struct LightLimitFix : Feature static void thunk(RE::NiNode* This); static inline REL::Relocation func; }; + + struct ValidLight1 + { + static bool thunk(RE::BSShaderProperty* a_property, RE::BSLight* a_light) + { + return func(a_property, a_light) && (a_light->portalStrict || !a_light->portalGraph); + } + static inline REL::Relocation func; + }; + + struct ValidLight2 + { + static bool thunk(RE::BSShaderProperty* a_property, RE::BSLight* a_light) + { + return func(a_property, a_light) && (a_light->portalStrict || !a_light->portalGraph); + } + static inline REL::Relocation func; + }; + + struct ValidLight3 + { + static bool thunk(RE::BSShaderProperty* a_property, RE::BSLight* a_light) + { + return func(a_property, a_light) && (a_light->portalStrict || !a_light->portalGraph); + } + static inline REL::Relocation func; + }; static void Install() { @@ -290,6 +317,10 @@ struct LightLimitFix : Feature stl::detour_thunk(REL::RelocationID(68937, 70288)); + stl::write_thunk_call(REL::RelocationID(100994, 107781).address() + 0x92); + stl::write_thunk_call(REL::RelocationID(100997, 107784).address() + REL::Relocate(0x139, 0x12A)); + stl::write_thunk_call(REL::RelocationID(101296, 108283).address() + REL::Relocate(0xB7, 0x7E)); + logger::info("[LLF] Installed hooks"); } }; From f323c30914f38a98c19dc1c6f859cb3b0bf79144 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 14:31:57 +0000 Subject: [PATCH 2/2] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commit.?= =?UTF-8?q?ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Features/LightLimitFix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LightLimitFix.h b/src/Features/LightLimitFix.h index 4112f3093a..9a7d317a78 100644 --- a/src/Features/LightLimitFix.h +++ b/src/Features/LightLimitFix.h @@ -277,7 +277,7 @@ struct LightLimitFix : Feature static void thunk(RE::NiNode* This); static inline REL::Relocation func; }; - + struct ValidLight1 { static bool thunk(RE::BSShaderProperty* a_property, RE::BSLight* a_light)