Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Nov 2002
Offline Last Active Jan 21 2015 05:52 PM

#4342796 Rendering full-screen quads

Posted by on 31 October 2008 - 10:40 PM

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.

#3613596 Vertex cache

Posted by on 22 May 2006 - 10:12 PM

The Vertex Cache is on whenever you draw Indexed Primitives. You don't need to enable it or do anything else.

The process you describe would only increase it's effectiveness, not turn it on.

As for a way to get better Cache results, ID3DXMesh has an optimize method that can take a flag to perform Vertex Cache optimizations, which is esentially what you're looking for. You should probably be able to run any mesh you have through that once to get better Cache hits.

Hope this helps.