Graphics Reference
In-Depth Information
patch out float gl_TessLevelInner[2] , an array containing up to two
levels of tessellation at the inner edges.
The outer and inner tessellation levels define the number of subdivisions for
the perimeter and the interior of the input primitive, respectively, and also
control the output of the TES. A TCS can also access the output data for its
processing. You can also have other output variables from a TCS. User-defined
variables defined per-vertex are qualified as “out,” while user-defined vari-
ables defined per-patch are qualified as “patch out.”
TCS instances run mostly independently, with undefined relative execu-
tion order. The built-in barrier( ) function provides some control over TCS
relative execution order by causing all instances of TCSs to wait. This allows
synchronization points where no TCS shader invocation will continue until all
TCS shader invocations have reached the barrier. This is important because an
instance of a TCS can read variables from other TCS instances that might not
yet have been writen. The barrier( ) function may only be called inside the
main entry point of the TCS and may not be called in potentially divergent
flow control. In particular, barrier( ) may not be called inside a switch state-
ment, in either sub-statement of an if statement, inside a do, for, or while loop,
or at any point after a return statement in the function main( ) .
The tessellation patch generator (TPG) is not a user-programmable shader
stage, but a new fixed-function pipeline stage; you can't change its operation
except by seting parameters. It is invoked one time per patch. It looks at the
tessellation levels set by the TCS and creates the right number of tessellated tri-
angles, quads, or lines, and outputs their positions as parametric coordinates
in semi-regular barycentric ( u , v , w ) coordinates.
The second tessellation shader type is the tessellation evaluation shader
(TES). It reads the ( u , v , w ) coordinates from the TPG and the output vertex coor-
dinates from the TCS, and then determines output ( x , y , z ) coordinates, interpo-
lates any atributes, and applies any displacements. There is one instance of a
TES invoked per output vertex being generated. If you are using the TES but
no TCS, your main program needs to set up some of the data that the TCS
would normally provide. This is done with the functions
glPatchParameterfv( GL_DEFAULT_OUTER_LEVEL, float [4] );
glPatchParameterfv( GL_DEFAULT_INNER_LEVEL, float [2] );
that define the outer and inner levels of divisions for the interpolations, as we
saw in the discussion of the TCS. The outer and inner levels define the number
of subdivisions for the perimeter and the interior of the input polygon, respec-
tively.
Search WWH ::




Custom Search