From a4a422b8dcf71c7a2e6df5da1e893f8a19f6def3 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 13 Nov 2024 10:29:04 +0100 Subject: [PATCH] Fixed a subtle bug where pointers to two structs that were out of scope were being passed to the MFSR initialization. This only went wrong when the native plugin was compiled with optimizations enabled. --- Tools/PSSRPlugin/pssrplugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tools/PSSRPlugin/pssrplugin.cpp b/Tools/PSSRPlugin/pssrplugin.cpp index 5afe984..e7cfcf9 100644 --- a/Tools/PSSRPlugin/pssrplugin.cpp +++ b/Tools/PSSRPlugin/pssrplugin.cpp @@ -274,17 +274,16 @@ extern "C" int32_t UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API CreatePssrContext( initParams.m_outputColorHeight = params->displayHeight; initParams.m_sharedResources = s_mfsrSharedResources; + MfsrKeepCopyTextureSpec depthCopySpec = {}, mvCopySpec = {}; if (params->autoKeepCopies) { // Keep a copy of the previous depth internally - MfsrKeepCopyTextureSpec depthCopySpec = {}; depthCopySpec.m_width = params->maxRenderWidth; depthCopySpec.m_height = params->maxRenderHeight; depthCopySpec.m_bytesPerPixel = 4; // R32_SFloat initParams.m_maxSizeDepthForKeepCopy = &depthCopySpec; // Keep a copy of the previous motion vectors internally - MfsrKeepCopyTextureSpec mvCopySpec = {}; mvCopySpec.m_width = params->maxRenderWidth; mvCopySpec.m_height = params->maxRenderHeight; mvCopySpec.m_bytesPerPixel = 4; // R16G16_SFloat