Hello!
I wrote a small shader test program and I have a problem. I wrote a 2 pass blur effect, my technique looks like:
| 1 |
technique blur |
| 2 |
{ |
| 3 |
pass p0 |
| 4 |
{ |
| 5 |
vertexshader = compile vs_1_1 VertexShader(); |
| 6 |
pixelshader = compile ps_2_0 PS_HorBlur(); |
| 7 |
} |
| 8 |
pass p1 |
| 9 |
{ |
| 10 |
PixelShader = compile ps_2_0 PS_VerBlur(); |
| 11 |
} |
| 12 |
} |
And here is one of my blur pixel units:
| 1 |
// horizontal blur |
| 2 |
void PS_HorBlur( in VertexToPixel IN, out PixelToScreen OUT ) |
| 3 |
{ |
| 4 |
OUT.color = 0; |
| 5 |
for (int i=0; i<8; i++) |
| 6 |
{ |
| 7 |
|
| 8 |
float4 posColor = tex2D(texSampler, IN.textCoord + float2(pos[i], 0) * blurSize); |
| 9 |
float4 negColor = tex2D(texSampler, IN.textCoord - float2(pos[i], 0) * blurSize); |
| 10 |
|
| 11 |
OUT.color += (posColor + negColor)*weights[i]; |
| 12 |
} |
| 13 |
} |
The problem is in line 4 of the second code snipped. If I run it without this line I get an error:
Error 1 Errors compiling C:\...\Content\effects\postProcessingEffects.fx:
(107): error X4000: variable 'OUT' used without having been completely initialized
(188): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed
For the seond pass I need the color value from the frame buffer. How can I access it?