From 39f537d9b0f2e998d522a69ade7e86fd694d5945 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Thu, 3 Apr 2025 00:38:34 +0200 Subject: [PATCH] Avoid double initialization of the upscaler singleton. The graphics initialization event might get called multiple times. --- src/FSR3UnityPlugin.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/FSR3UnityPlugin.cpp b/src/FSR3UnityPlugin.cpp index de5124b..fe8ae1b 100644 --- a/src/FSR3UnityPlugin.cpp +++ b/src/FSR3UnityPlugin.cpp @@ -48,6 +48,12 @@ static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType ev { case kUnityGfxDeviceEventInitialize: { + if (s_Upscaler != nullptr) + { + // Avoid double initialization + break; + } + s_RendererType = s_Graphics->GetRenderer(); switch (s_RendererType) {