From def684e23c4a4c13496f05fba98fb087cd7a2253 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 24 Jul 2024 11:50:50 +0200 Subject: [PATCH] Load upscaler plugin upon first access of the main class. Makes the whole Load/IsLoaded situation a lot simpler. --- .../RenderPass/Upscalers/UpscalerPlugin.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/UpscalerPlugin.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/UpscalerPlugin.cs index 9d5f50d7..0f920b76 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/UpscalerPlugin.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/UpscalerPlugin.cs @@ -19,10 +19,14 @@ namespace UnityEngine.Rendering.HighDefinition.AMD private static UpscalerPlugin _activePlugin = AvailablePlugins[0]; public static UpscalerPlugin ActivePlugin => _activePlugin; - public static bool Load() => ActivePlugin.Load(); + static AMDUnityPlugin() + { + _ = Load(); + } - // HDRP never calls Load() on startup, so we reinterpret IsLoaded() here to mean: is loaded, or possible to be loaded lazily. - public static bool IsLoaded() => ActivePlugin.IsLoaded() || ActivePlugin.isSupported; + public static bool Load() => ActivePlugin.Load(); + + public static bool IsLoaded() => ActivePlugin.IsLoaded(); /// /// Get the list of available upscaler plugins, as a read-only list.