Is there one output control patch for each input control patch?

Jun 5, 2012 at 5:26 PM


    tessellation include three stages: hull shader stage, tessellator stage and domain shader stage,

Q1: the relationship btw input control patch and output control patch? one on one?

Q2: in domain shader, how the vertice from tessellator can get corresponding control patch to generate the final vertice?

Q3:  vertices from tessellator in the same input control patch will share the same output control patch from hull shader?

Jun 7, 2012 at 1:27 AM


I'll try to answer your questions as best as I can:

1. I assume you mean the input and output of the hull shader stage.  In this case, yes it is one to one - although the size of the control patch can be changed (i.e. either producing a larger control patch or a smaller one in the hull shader).

2. The output control patch from the hull shader is declared as an input to each invocation of the domain shader.  The domain shader is invoked once for each point produced by the tessellator, and it uses the control patch plus the barycentric coordinates from the tessellator to produce the end result vertex.

3. Yes, this is correct - but to the domain shader it is transparent as it only processes one tessellator point at a time.

I hope this helps your understanding!

Jun 7, 2012 at 2:10 AM

thanks Jzink, and one more question, how the vertices from tessellator in the same input control patch(hull shader) to find the output control patch?

following is my understanding, correct me if any incorrect.

e.g. there 4 primitives(triangles)/input control patches into hull shader, and we will get 4 output control patches and the control point number in these 4 control patches can be different from each other(output control patch1 contains 4 control points, while control patch2 contains 6 control points...)

the next step, tesselator will tessellate each primitives(triangles)/input control patches, and generate more points for each primitives(triangles)/input control patches

the last step, the vertices from primitive1/input control path1 will calculate the final vertices according to the output control path1 right?

Jun 7, 2012 at 10:25 AM

That is mostly correct.  Keep in mind that within one draw call that the output size of the hull shader stage can't be changed.  So for example, if your input patch size is 16 points, and you output patch size is 4 points, then you have to stick to that size for the duration of a draw call.  So all subsequent patches will have the same number of control points.

Also keep in mind that the tessellator more or less only takes your primitive type specification, plus the tessellation factors, and produces a set of barycentric coordinates.  This happens more or less with no contact to the control patch output of the hull shader.  That is in fact the job of the domain shader - to take the control patch output of the hull shader and the output coordinates from the tessellator and produce vertices.

Jun 7, 2012 at 2:34 PM

thanks a lot for your patient to answer my question.

I am clear about that.