Original Post
Im trying to figure out how to do multiple passes inside a hlsl shader (specifically a post process shader). So lets say for example I want to downfilter my a image, then blur it. I know how to write a technique that calls both 'shaders' one at a time, but I dont understand how the downfilter shader 'passes' info on to the blur shader. I mean when I output a color from my downfilter shader, where does it go!? Something like this... Help!
//-----------------------------------------------------------------------------
// Pixel Shader: DownFilter
// Desc: Perform a high-pass filter and on the source texture and scale down.
//-----------------------------------------------------------------------------
float4 DownFilter( in float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = 0;
for (int i = 0; i < 16; i++)
{
Color += tex2D( g_samSrcColor, Tex + TexelCoordsDownFilter.xy );
}
return Color / 16;
}
//-----------------------------------------------------------------------------
// Pixel Shader: HorizontalBlur
// Desc: Blurs the image horizontally
//-----------------------------------------------------------------------------
float4 HorizontalBlur( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = 0;
for (int i = 0; i < g_cKernelSize; i++)
{
Color += tex2D( g_samSrcColor, Tex + TexelKernel.xy ) * BlurWeights;
}
return Color;
}
//--------------------------------
// tech
//--------------------------------
technique PostProcess
{
pass p0
{
VertexShader = null;
PixelShader = compile ps_2_0 DownFilter();
ZEnable = false;
}
pass p1
{
VertexShader = null;
PixelShader = compile ps_2_0 HorizontalBlur();
ZEnable = false;
}
}