From 0548c6380083f0277d055c4d6e8f64e7db34ba14 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Thu, 9 Mar 2023 10:47:37 +0100 Subject: [PATCH] Revert "Reintroduced the ability for FSR2 to output to a render texture again. Very basic for now." This reverts commit bb24ed970bdca99e0da434541fca6ca85884062a. --- Assets/Scripts/Fsr2Controller.cs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) 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) {