diff --git a/Assets/Scripts/Fsr2Controller.cs b/Assets/Scripts/Fsr2Controller.cs index b5c69aa..a5f4955 100644 --- a/Assets/Scripts/Fsr2Controller.cs +++ b/Assets/Scripts/Fsr2Controller.cs @@ -248,6 +248,14 @@ namespace FidelityFX _renderCamera.rect = _originalRect; _renderCamera.ResetProjectionMatrix(); + if (dest != null) + { + Debug.LogError("FSR2 is not set to output directly to the backbuffer! Please ensure that FSR2 is the final pass in the image effects chain."); + Graphics.Blit(src, dest); + enabled = false; + return; + } + _dispatchCommandBuffer.Clear(); // Update the input resource descriptions @@ -262,25 +270,14 @@ namespace FidelityFX _dispatchDescription.Reactive = Fsr2Pipeline.UavAutoReactive; } - if (dest == null) - { - // We are rendering to the backbuffer, so we need a temporary render texture for FSR2 to output to - _dispatchCommandBuffer.GetTemporaryRT(Fsr2Pipeline.UavUpscaledOutput, _displaySize.x, _displaySize.y, 0, default, DefaultFormat, default, 1, true); - } - else - { - // We have more image effects lined up after this, so FSR2 can output straight to the intermediate render texture - _dispatchCommandBuffer.SetGlobalTexture(Fsr2Pipeline.UavUpscaledOutput, dest, RenderTextureSubElement.Color); - } + // We are rendering to the backbuffer, so we need a temporary render texture for FSR2 to output to + _dispatchCommandBuffer.GetTemporaryRT(Fsr2Pipeline.UavUpscaledOutput, _displaySize.x, _displaySize.y, 0, default, DefaultFormat, default, 1, true); _context.Dispatch(_dispatchDescription, _dispatchCommandBuffer); - if (dest == null) - { - // Output the upscaled image to the backbuffer - _dispatchCommandBuffer.Blit(Fsr2Pipeline.UavUpscaledOutput, dest); - _dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavUpscaledOutput); - } + // Output the upscaled image to the backbuffer + _dispatchCommandBuffer.Blit(Fsr2Pipeline.UavUpscaledOutput, dest); + _dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavUpscaledOutput); if (autoGenerateReactiveMask) {