Sign in to follow this  

How does the pipeline know the index what it need when it draws a quad using the vertices generated by the Geometry Shader?

Recommended Posts

   Hi! I am learning how the Geometry Shader works in D3D11. I am studying a sample which inputs one point into the Geometry Shader and outputs a quad each time. As shown in the figure below, the sample specifies the vertices generated by the Geometry Shader.(Sorry. I don't know how to upload a image. Hope you can understand the figure.)



v1               v2


|                 |

|                 |

|                 |

|                 |


v0                v3

  With general method,if we want to draw a quad, we pass four vertices to the VertexBuffer, then create a IndexBuffer, binding them to the pipeline. Then the pipeline uses the data in the IndexBuffer and the VertexBuffer to draw two triangles what make up a quad. But in the sample I am studying, there is no IndexBuffer. The sample just generates these four vertices and append them to a TriangleStream object in the order: v0,v1,v2,v3, at the end of the Geometry Shader. Since D3D11 uses counter-clockwise culling state by default, visible triangles must be drawn in clockwise order. But how does the pipeline determine which three vertices of these four vertices to choose and their order to draw a visible triangle. There is no IndexBuffer in the sample. Maybe the Geometry Shader's output is drawn using a fixed index?Can anybody help me figure it out?


PS: The sample works well.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this