Difference between revisions of "Tessellation Control Shader/Defined Outputs"

From OpenGL Wiki
Jump to navigation Jump to search
(Clarification on writing tessellation levels.)
m (Clearing up the text.)
Line 8: Line 8:
 
These define the outer and inner tessellation levels used by the [[Tessellation#Tessellation primitive generator|tessellation primitive generator]]. They define how much tessellation to apply to the patch. Their exact meaning depends on the type of patch (and other settings) defined in the [[Tessellation Evaluation Shader]].
 
These define the outer and inner tessellation levels used by the [[Tessellation#Tessellation primitive generator|tessellation primitive generator]]. They define how much tessellation to apply to the patch. Their exact meaning depends on the type of patch (and other settings) defined in the [[Tessellation Evaluation Shader]].
  
As with any other {{code|patch}} variable, multiple TCS invocations can write to the same patch variable, so long as they are all computing and writing the exact same value.
+
As with any other {{code|patch}} variable, multiple TCS invocations for the same patch can write to the same tessellation level variable, so long as they are all computing and writing the exact same value.
  
 
TCS's also provide the following optional per-vertex output variables:
 
TCS's also provide the following optional per-vertex output variables:

Revision as of 13:35, 11 August 2016

Tessellation Control Shaders have the following built-in patch output variables:

patch out float gl_TessLevelOuter[4];
patch out float gl_TessLevelInner[2];

These define the outer and inner tessellation levels used by the tessellation primitive generator. They define how much tessellation to apply to the patch. Their exact meaning depends on the type of patch (and other settings) defined in the Tessellation Evaluation Shader.

As with any other patch variable, multiple TCS invocations for the same patch can write to the same tessellation level variable, so long as they are all computing and writing the exact same value.

TCS's also provide the following optional per-vertex output variables:

out gl_PerVertex
{
  vec4 gl_Position;
  float gl_PointSize;
  float gl_ClipDistance[];
} gl_out[];

The use of any of these in a TCS is completely optional. Indeed, their semantics will generally be of no practical value to the TCS. They have the same general meaning as for vertex shaders, but since a TCS must always be followed by an evaluation shader, the TCS never has to write to any of them.