Access to previous frames

  • Deriest
More
11 years 9 months ago #21 by Deriest Replied by Deriest on topic Access to previous frames
I keep getting an error message when I try using a texture rendered from the previous frame.
... \shader@0x2FBE4448(26,8): error X3507: 'currprevTest': Not all control paths return a value

Here's my code hopefully someone can point out what is wrong with it.
Code:
... texture texColorBuffer : COLOR; // or SV_Target texture texCurr1 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; }; texture texPrev1 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; }; texture texPrev { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; }; sampler samplerColor { Texture = texColorBuffer; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; MipLODBias = 0.0f; MinLOD = -1000.0f; MaxLOD = 1000.0f; MaxAnisotropy = 1; SRGBTexture = FALSE; }; sampler samplerCurr1 { Texture = texCurr1; }; sampler samplerPrev1 { Texture = texPrev1; }; sampler samplerPrev { Texture = texPrev; }; float4 currprevTest(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD0, out float4 curr : SV_Target0, out float4 prev : SV_Target1) { curr = tex2D(samplerColor, texcoord.xy); prev = tex2D(samplerPrev, texcoord.xy); } float4 MainPS(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD0, out float4 color : SV_Target0, out float4 prev : SV_Target1) { color = tex2D(samplerColor, texcoord.xy); // stuff... color.w = 1; prev = color; } technique Effect < enabled = true; > { pass currprevPass { VertexShader = MainVS; PixelShader = currprevTest; RenderTarget0 = texCurr1; RenderTarget1 = texPrev1; } pass finalPass { VertexShader = MainVS; PixelShader = MainPS; RenderTarget0 = texColorBuffer; RenderTarget1 = texPrev; } }

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

  • crosire
More
11 years 9 months ago #22 by crosire Replied by crosire on topic Access to previous frames

Deriest wrote:

Code:
float4 currprevTest(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD0, out float4 curr : SV_Target0, out float4 prev : SV_Target1) { curr = tex2D(samplerColor, texcoord.xy); prev = tex2D(samplerPrev, texcoord.xy); } float4 MainPS(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD0, out float4 color : SV_Target0, out float4 prev : SV_Target1) { color = tex2D(samplerColor, texcoord.xy); // stuff... color.w = 1; prev = color; }

You are not returning something here, but those functions are specified in that they return a value. In your case you don't want to return anything here though, because that is already done via the "out" parameters. So just write "void currprevTest" and "void MainPS".
The following user(s) said Thank You: Deriest

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

  • Deriest
More
11 years 9 months ago #23 by Deriest Replied by Deriest on topic Access to previous frames
Wow, something so simple, I totally forgot to do that. Thanks.

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