Browse Source

Configure render event for DX12 and Vulkan, to ensure the upscaler gets called without any synchronization errors. Fixes graphical glitching on Nvidia cards, as well as subtle bugs in the FSR3 pipeline on AMD.

master
Nico de Poel 11 months ago
parent
commit
2db0aed932
  1. 14
      FSR3UnityPlugin.cpp

14
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;
}
}

Loading…
Cancel
Save