Browse Source

Reintroduced the ability for FSR2 to output to a render texture again. Very basic for now.

mac-autoexp
Nico de Poel 3 years ago
parent
commit
bb24ed970b
  1. 29
      Assets/Scripts/Fsr2Controller.cs

29
Assets/Scripts/Fsr2Controller.cs

@ -247,14 +247,6 @@ namespace FidelityFX
_renderCamera.rect = _originalRect;
_renderCamera.ResetProjectionMatrix();
if (dest != null)
{
Debug.LogError("FSR2 is not set to output directly to the backbuffer");
Graphics.Blit(src, dest);
enabled = false;
return;
}
_dispatchCommandBuffer.Clear();
// Update the input resource descriptions
@ -269,14 +261,25 @@ namespace FidelityFX
_dispatchDescription.Reactive = Fsr2Pipeline.UavAutoReactive;
}
// 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);
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);
}
_context.Dispatch(_dispatchDescription, _dispatchCommandBuffer);
// Output the upscaled image to the backbuffer
_dispatchCommandBuffer.Blit(Fsr2Pipeline.UavUpscaledOutput, dest);
_dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavUpscaledOutput);
if (dest == null)
{
// Output the upscaled image to the backbuffer
_dispatchCommandBuffer.Blit(Fsr2Pipeline.UavUpscaledOutput, dest);
_dispatchCommandBuffer.ReleaseTemporaryRT(Fsr2Pipeline.UavUpscaledOutput);
}
if (autoGenerateReactiveMask)
{

Loading…
Cancel
Save