I spent the day looking and only found a thread from 6 years ago. Is the below still the best practice for accessing the previous frame?
texture2D currTex : COLOR;
texture2D prevTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
sampler2D currColor { Texture = currTex; };
sampler2D prevColor { Texture = prevTex; };
float4 PS_PostProcess(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 curr = tex2D(currColor, texcoord);
float4 prev = tex2D(prevColor, texcoord);
....
return curr;
}
float4 PS_CopyFrame(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
return tex2D(currColor, texcoord);
}
technique MyTechnique
{
pass DoPostProcessing
{
VertexShader = ...;
PixelShader = PS_PostProcess;
}
pass DoCopyFrameForPrevAccess
{
VertexShader = ...;
PixelShader = PS_CopyFrame;
RenderTarget = prevTex;
}
}