2 #extension GL_EXT_tessellation_shader : require
3 #extension GL_EXT_gpu_shader5 : require
5 layout(triangles, equal_spacing) in;
7 layout(location = 0) in highp vec2 in_te_position[];
9 layout(location = 0) out mediump vec4 in_f_color;
14 highp vec2 pos = gl_TessCoord.x * in_te_position[0] +
15 gl_TessCoord.y * in_te_position[1] +
16 gl_TessCoord.z * in_te_position[2];
19 sqrt(3.0 * min(gl_TessCoord.x, min(gl_TessCoord.y, gl_TessCoord.z))) *
22 in_f_color = vec4(gl_TessCoord * f, 1.0);
24 // Offset the position slightly, based on the parity of the bits in the float
26 // This is done to detect possible small differences in edge vertex positions
28 uvec2 bits = floatBitsToUint(pos);
30 for (uint i = 0u; i < 32u; i++)
32 ((bits[0] << i) & 1u) + ((bits[1] << i) & 1u);
33 pos += float(numBits & 1u) * 0.04;
35 gl_Position = vec4(pos, 0.0, 1.0);