From 9b83409c71e13e3c3c9e88d42f07f7ca0456d1b4 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sat, 4 Mar 2023 12:15:37 +0100 Subject: [PATCH] Added debug checks for input and output resources, either through direct assignment or through existing global texture bindings. --- Assets/Scripts/Fsr2Context.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Assets/Scripts/Fsr2Context.cs b/Assets/Scripts/Fsr2Context.cs index 8bba114..399443e 100644 --- a/Assets/Scripts/Fsr2Context.cs +++ b/Assets/Scripts/Fsr2Context.cs @@ -367,6 +367,30 @@ namespace FidelityFX private void DebugCheckDispatch(Fsr2.DispatchDescription dispatchParams) { + // Global texture binding may happen as part of the command list, which is why we check these after running the process at least once + if (!_firstExecution) + { + if (!dispatchParams.Color.HasValue && Shader.GetGlobalTexture(Fsr2Pipeline.SrvInputColor) == null) + { + Debug.LogError("Color resource is null"); + } + + if (!dispatchParams.Depth.HasValue && Shader.GetGlobalTexture(Fsr2Pipeline.SrvInputDepth) == null) + { + Debug.LogError("Depth resource is null"); + } + + if (!dispatchParams.MotionVectors.HasValue && Shader.GetGlobalTexture(Fsr2Pipeline.SrvInputMotionVectors) == null) + { + Debug.LogError("MotionVectors resource is null"); + } + + if (!dispatchParams.Output.HasValue && Shader.GetGlobalTexture(Fsr2Pipeline.UavUpscaledOutput) == null) + { + Debug.LogError("Output resource is null"); + } + } + if (dispatchParams.Exposure.HasValue && (_contextDescription.Flags & Fsr2.InitializationFlags.EnableAutoExposure) != 0) { Debug.LogWarning("Exposure resource provided, however auto exposure flag is present");