Despite the simplicity of the problem I am facing, I cannot find an answer ANYWHERE on the internet. I have a source texture that I get from the RenderTarget I am using, which I then pass to my effect. My effect has a vertex shader and a pixel shader, but the pixel shader is the important one. I want the vertex shader to do absolutely nothing to the input vertices. The output should then get passed to my pixel shader, which will perform image processing (like blurring, etc.) on the image. The result of this will be drawn to the screen.
So basically, I just want a vertex shader that takes a texture in and passes it out completely unaltered. No 3D geometry here to speak of.
Here is the code I wrote to do this:
float4 VSBasic(float4 vin : POSITION) : POSITION
{
return vin;
}
And here is my pixel shader, which should turn all pixels red:
float4 PS_GaussianBlur(float2 texCoord : TEXCOORD) : COLOR0
{
float4 color = float4(0.0f, 0.0f, 0.0f, 1.0f);
//int kernelLength = min(31, kernelRadius * 2 + 1);
//for (int i = 0; i < kernelLength; i++)
//color += tex2D(colorMap, texCoord + offsets[i]) * kernel[i];
color = float4(1.0f, 0.0f, 0.0f, 1.0f);
return color;
}
Note that the blurring part is commented out for testing.
So what am I doing wrong??!
P.S. The only reason I even use a vertex shader is because XNA will complain that I am using conflicting pixel/vertex shader versions unless I specify in the effect that I should compile PS_3_0 and VS_3_0 (because I need PS_3_0, I have this working in PS_2_0 without a vertex shader). So if there is a different way to specify the vertex shader version without actually implementing a vertex shader let me know.
EDIT: To clarify, my solution works great in PS_2_0, but PS_2_0 doesn't have enough constant registers in my opinion. What I want to do is extend my shader into PS_3_0 so that I can work with a lot more registers. However, when I do this, XNA complains that PS_3_0 isn't backwards compatible with lower vertex shaders, so I had to make my own vertex shader. However, I don't want this vertex shader to DO anything, since all the work is done in my pixel shader. I hope this clears things up.