Tessellation Control Shader/Defined Inputs: Difference between revisions
separate page for built-in inputs. |
m typo |
||
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"> |
Revision as of 23:26, 25 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 is the number of vertices in the input patch. gl_PrimitiveID is the index of the current patch within this rendering command. gl_InvocationID is 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.
Note that every TCS invocation for an input patch has access to the same data (except for gl_InvocationID, which will be different for each). So a TCS invocation can look at the input vertex data for the entire input patch