1 # Number of input CP = 1
2 # Number of output CP = 1
5 # Each patch is tessellated like a quad with a 4x4 vertex pattern.
6 # (which is 3x3 sub-quads = 18 triangles)
10 GL_ARB_tessellation_shader
19 const int num = 16; // number of patches in one direction, num*num patches in total
21 for (int i = 0; i < 16; i++) {
22 inpos[i].xy = vec2(gl_VertexID % num, gl_VertexID / num) / num + vec2(i % 4, i / 4) / (3 * num);
23 inpos[i].z = float(gl_VertexID / 64);
27 [tessellation control shader]
29 #extension GL_ARB_tessellation_shader : require
30 #extension GL_ARB_arrays_of_arrays : require
32 layout(vertices = 1) out;
34 out vec3 outpos[][16];
38 gl_TessLevelInner[0] =
39 gl_TessLevelInner[1] =
40 gl_TessLevelOuter[0] =
41 gl_TessLevelOuter[1] =
42 gl_TessLevelOuter[2] =
43 gl_TessLevelOuter[3] = 3.0;
44 outpos[gl_InvocationID] = inpos[gl_InvocationID];
47 [tessellation evaluation shader]
49 #extension GL_ARB_tessellation_shader : require
50 #extension GL_ARB_arrays_of_arrays : require
52 layout(quads, equal_spacing) in;
58 ivec2 coord = ivec2(round(gl_TessCoord.xy * 3));
59 vec3 v = outpos[0][coord.y * 4 + coord.x];
60 gl_Position = vec4(v.xy * 2 - 1, 0, 1);
61 color = v.zzz - vec3(0, 1, 2);
71 gl_FragColor = vec4(color, 1);
75 clear color 0.1 0.1 0.1 0.1
77 patch parameter vertices 1
78 draw arrays GL_PATCHES 0 256
79 relative probe rect rgba (0, 0, 1, 0.24) (0, 0, 0, 1)
80 relative probe rect rgba (0, 0.26, 1, 0.24) (1, 0, 0, 1)
81 relative probe rect rgba (0, 0.5, 1, 0.24) (1, 1, 0, 1)
82 relative probe rect rgba (0, 0.76, 1, 0.24) (1, 1, 1, 1)