@ -47,7 +47,7 @@ public class Fsr2Controller : MonoBehaviour
{
if ( _copyDepthMat = = null )
{
var copyDepthShader = Fsr2 . GlobalCallbacks . LoadShader ( "Shaders/FSR2CopyDepth" ) ;
var copyDepthShader = Fsr2 . GlobalCallbacks . LoadShader ( "Shaders/FSR2_ CopyDepth" ) ;
_copyDepthMat = new Material ( copyDepthShader ) ;
}
@ -62,7 +62,7 @@ public class Fsr2Controller : MonoBehaviour
{
if ( _copyMotionMat = = null )
{
var copyMotionShader = Fsr2 . GlobalCallbacks . LoadShader ( "Shaders/FSR2CopyMotionVectors" ) ;
var copyMotionShader = Fsr2 . GlobalCallbacks . LoadShader ( "Shaders/FSR2_ CopyMotionVectors" ) ;
_copyMotionMat = new Material ( copyMotionShader ) ;
}
@ -88,6 +88,7 @@ public class Fsr2Controller : MonoBehaviour
// TODO: enable motion vector jitter cancellation or not?
_context = Fsr2 . CreateContext ( DisplaySize , RenderSize ) ;
// TODO: do we need a depth buffer for the output? We will need depth & motion vectors for subsequent post-FX. How should FSR2 output these?
_outputRT = new RenderTexture ( DisplaySize . x , DisplaySize . y , 2 4 , RenderTextureFormat . ARGBHalf ) { enableRandomWrite = true } ;
_outputRT . Create ( ) ;
@ -122,11 +123,11 @@ public class Fsr2Controller : MonoBehaviour
public void UpdateInputResources ( RenderTexture src )
{
// I hate having to allocate extra RTs just to duplicate already existing Unity render buffers, but AFAIK there is no way to directly address these buffers individually from code
var renderSize = RenderSize ;
_colorRT = RenderTexture . GetTemporary ( renderSize . x , renderSize . y , 0 , RenderTextureFormat . ARGBHalf ) ;
_depthRT = RenderTexture . GetTemporary ( renderSize . x , renderSize . y , 0 , RenderTextureFormat . RFloat ) ;
_motionVectorsRT = RenderTexture . GetTemporary ( renderSize . x , renderSize . y , 0 , RenderTextureFormat . RGHalf ) ;
_colorRT = RenderTexture . GetTemporary ( src . width , src . height , 0 , RenderTextureFormat . ARGBHalf ) ;
_depthRT = RenderTexture . GetTemporary ( src . width , src . height , 0 , RenderTextureFormat . RFloat ) ;
_motionVectorsRT = RenderTexture . GetTemporary ( src . width , src . height , 0 , RenderTextureFormat . RGHalf ) ;
// TODO: might be able to combine color + depth into a single RT and separate them out using RenderTextureSubElement
Graphics . Blit ( src , _colorRT ) ;
Graphics . Blit ( src , _depthRT , CopyDepthMaterial ) ;
Graphics . Blit ( src , _motionVectorsRT , CopyMotionVectorsMaterial ) ;