@ -110,17 +110,23 @@ public class Fsr2Controller : MonoBehaviour
RenderPipelineManager . endContextRendering - = OnEndContextRendering ;
}
public void UpdateInputResources ( RenderTexture s rc )
public void OnRenderGameCamera ( RenderTexture renderTarget , Vecto r2 jitterOffset )
{
// 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
_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 ) ;
_colorRT = RenderTexture . GetTemporary ( renderTarget . width , renderTarget . height , 0 , RenderTextureFormat . ARGBHalf ) ;
_depthRT = RenderTexture . GetTemporary ( renderTarget . width , renderTarget . height , 0 , RenderTextureFormat . RFloat ) ;
_motionVectorsRT = RenderTexture . GetTemporary ( renderTarget . width , renderTarget . 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 ) ;
// TODO: we can copy to all RTs at the same time using a multi-target blit, requiring only a single shader + material
Graphics . Blit ( renderTarget , _colorRT ) ;
Graphics . Blit ( renderTarget , _depthRT , CopyDepthMaterial ) ;
Graphics . Blit ( renderTarget , _motionVectorsRT , CopyMotionVectorsMaterial ) ;
_dispatchDescription . Color = _colorRT ;
_dispatchDescription . Depth = _depthRT ;
_dispatchDescription . MotionVectors = _motionVectorsRT ;
_dispatchDescription . JitterOffset = jitterOffset ;
}
// For scriptable rendering pipeline
@ -136,9 +142,6 @@ public class Fsr2Controller : MonoBehaviour
if ( _colorRT = = null | | _depthRT = = null | | _motionVectorsRT = = null )
return ;
_dispatchDescription . Color = _colorRT ;
_dispatchDescription . Depth = _depthRT ;
_dispatchDescription . MotionVectors = _motionVectorsRT ;
_dispatchDescription . Output = _outputRT ;
_dispatchDescription . Exposure = null ;
_dispatchDescription . Reactive = null ;