Access Previous Frame

  • JohnnyFlash
  • Topic Author
More
2 years 7 months ago - 2 years 7 months ago #1 by JohnnyFlash Access Previous Frame was created by JohnnyFlash
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;
	}
}
Last edit: 2 years 7 months ago by JohnnyFlash.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.