diff --git a/FSR3UnityPlugin.cpp b/FSR3UnityPlugin.cpp index 1c01061..77c5c83 100644 --- a/FSR3UnityPlugin.cpp +++ b/FSR3UnityPlugin.cpp @@ -27,7 +27,7 @@ #include "FSR3UnityTypes.h" -static const int32_t BaseEventId = 0; +static const int32_t BaseEventId = 313; static IUnityInterfaces* s_UnityInterfaces = nullptr; static IUnityLog* s_Log = nullptr; @@ -119,6 +119,12 @@ static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType ev UNITY_LOG_ERROR(s_Log, "Could not obtain D3D12 Graphics interface!"); return; } + + UnityD3D12PluginEventConfig eventConfig; + eventConfig.graphicsQueueAccess = kUnityD3D12GraphicsQueueAccess_DontCare; + eventConfig.flags = kUnityD3D12EventConfigFlag_EnsurePreviousFrameSubmission | kUnityD3D12EventConfigFlag_FlushCommandBuffers | kUnityD3D12EventConfigFlag_SyncWorkerThreads | kUnityD3D12EventConfigFlag_ModifiesCommandBuffersState; + eventConfig.ensureActiveRenderTextureIsBound = false; + s_GraphicsD3D12->ConfigureEvent(BaseEventId + FSR3PluginEvent::eExecute, &eventConfig); break; } case kUnityGfxRendererVulkan: @@ -129,6 +135,12 @@ static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType ev UNITY_LOG_ERROR(s_Log, "Could not obtain Vulkan Graphics interface!"); return; } + + UnityVulkanPluginEventConfig eventConfig; + eventConfig.graphicsQueueAccess = kUnityVulkanGraphicsQueueAccess_DontCare; + eventConfig.flags = kUnityVulkanEventConfigFlag_EnsurePreviousFrameSubmission | kUnityVulkanEventConfigFlag_FlushCommandBuffers | kUnityVulkanEventConfigFlag_SyncWorkerThreads | kUnityVulkanEventConfigFlag_ModifiesCommandBuffersState; + eventConfig.renderPassPrecondition = kUnityVulkanRenderPass_EnsureInside; + s_GraphicsVulkan->ConfigureEvent(BaseEventId + FSR3PluginEvent::eExecute, &eventConfig); break; } }