• Advertisement
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?

This topic is 1755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement