Merge pull request #3031 from rg3igalia/sub-group-size-arb-flat-fix
[platform/upstream/glslang.git] / Test / spv.precise.tese
1 #version 310 es
2 #extension GL_EXT_tessellation_shader : require
3 #extension GL_EXT_gpu_shader5 : require
4
5 layout(triangles, equal_spacing) in;
6
7 layout(location = 0) in highp vec2 in_te_position[];
8
9 layout(location = 0) out mediump vec4 in_f_color;
10
11 precise gl_Position;
12
13 void main(void) {
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];
17
18   highp float f =
19       sqrt(3.0 * min(gl_TessCoord.x, min(gl_TessCoord.y, gl_TessCoord.z))) *
20           0.5 +
21       0.5;
22   in_f_color = vec4(gl_TessCoord * f, 1.0);
23
24   // Offset the position slightly, based on the parity of the bits in the float
25   // representation.
26   // This is done to detect possible small differences in edge vertex positions
27   // between patches.
28   uvec2 bits = floatBitsToUint(pos);
29   uint numBits = 0u;
30   for (uint i = 0u; i < 32u; i++)
31     numBits +=
32         ((bits[0] << i) & 1u) + ((bits[1] << i) & 1u);
33   pos += float(numBits & 1u) * 0.04;
34
35   gl_Position = vec4(pos, 0.0, 1.0);
36 }