Tessellation Control Shader/Defined Inputs: Difference between revisions
Jump to navigation
Jump to search
separate page for built-in inputs. |
Formatting. |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{pagelink:Tessellation Control Shader|Tessellation Control Shaders}} provide the following built-in input variables: | {{pagelink|:Tessellation Control Shader|Tessellation Control Shaders}} provide the following built-in input variables: | ||
<source lang="glsl"> | <source lang="glsl"> | ||
Line 7: | Line 7: | ||
</source> | </source> | ||
{{code|gl_PatchVerticesIn}} | ; {{code|gl_PatchVerticesIn}} | ||
: the number of vertices in the input patch. | |||
; {{code|gl_PrimitiveID}} | |||
: the index of the current patch within this rendering command. | |||
; {{code|gl_InvocationID}} | |||
: the index of the TCS invocation within this patch. A TCS invocation writes to per-vertex output variables by using this to index them. | |||
The TCS also takes the built-in variables output by the [[Vertex Shader#Outputs|vertex shader]]: | The TCS also takes the built-in variables output by the [[Vertex Shader#Outputs|vertex shader]]: | ||
Line 20: | Line 25: | ||
</source> | </source> | ||
Note that just because {{code|gl_in}} is defined to have {{code|gl_MaxPatchVertices}} entries does not mean that you can access beyond {{code|gl_PatchVerticesIn}} and get reasonable values. | Note that just because {{code|gl_in}} is defined to have {{code|gl_MaxPatchVertices}} entries does not mean that you can access beyond {{code|gl_PatchVerticesIn}} and get reasonable values. These variables have only the meaning the vertex shader that passed them gave them. | ||
Latest revision as of 07:05, 26 July 2013
Tessellation Control Shaders provide the following built-in input variables:
in int gl_PatchVerticesIn;
in int gl_PrimitiveID;
in int gl_InvocationID;
- gl_PatchVerticesIn
- the number of vertices in the input patch.
- gl_PrimitiveID
- the index of the current patch within this rendering command.
- gl_InvocationID
- the index of the TCS invocation within this patch. A TCS invocation writes to per-vertex output variables by using this to index them.
The TCS also takes the built-in variables output by the vertex shader:
in gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[];
} gl_in[gl_MaxPatchVertices];
Note that just because gl_in is defined to have gl_MaxPatchVertices entries does not mean that you can access beyond gl_PatchVerticesIn and get reasonable values. These variables have only the meaning the vertex shader that passed them gave them.