Original post by BMKane
I have to admit to being somewhat confused here. Considering I know the render target is an 800x600 Texture2D, and no transformations occur anywhere between my application and the return command in the pixel shader, why isn't this behaving as I'd expected? Does DirectX silently apply some transformation to a pixel's position before drawing it to the render target? Or am I missing something completely obvious?
I'm assuming you were drawing your vertices as non-pretransformed vertices, which is where the issue arrises from.
DirectX does apply a silent transformation at the end of the Vertex Shader. The output from the vertex shader is a 4 element vector, that after dividing the vector by its w element has x and y values in the range of [-1,1] for the visible area of the sreen. This is done so that your Vertex Shader can output positions that are the same no matter what resolution you're using.
You'll notice non of the standard transformations used knows what the rendertarget height or width are, and that's because they don't really care.
If you want to use a resolution dependent method for drawing a fullscreen quad, you can pass the vertices as Pre-Transformed vertices (by using the FVF of XYZW or using the vertex declaration type of POSITIONT). Doing this will tell DX that these vertices are the way you want them to be output from the Vertex Shader, so DX will completely skip that phase, including all size conversions.
Hope this helps.