ext_gpu_shader4: add compiler tests for everything
[piglit.git] / generated_tests / templates / gen_builtin_packing_tests / vs_unpack.shader_test.mako
blob5f2a3912505817a85410a3a0d7c022904e47259b
1 <%! from six.moves import range %>
2 ## Test execution of unpack2x16 functions in the vertex shader.
3 [require]
4 ${func.requirements}
6 [vertex shader]
7 #ifndef GL_ES
8 #extension GL_ARB_shading_language_packing : require
9 #endif
11 const vec4 red = vec4(1, 0, 0, 1);
12 const vec4 green = vec4(0, 1, 0, 1);
14 uniform highp uint func_input;
16 uniform bool exact;
18 % for j in range(func.num_valid_outputs):
19 uniform ${func.result_precision} ${func.vector_type} expect${j};
20 % endfor
22 in vec4 vertex;
23 out vec4 vert_color;
25 void main()
27     gl_Position = vertex;
29     ${func.result_precision} ${func.vector_type} actual = ${func.name}(func_input);
31     if (false
32         % for i in range(func.num_valid_outputs):
33         || (exact ? actual == expect${i} : distance(actual, expect${i}) < 0.00001)
34         % endfor
35        ) {
36         vert_color = green;
37     } else {
38         vert_color = red;
39     }
42 [fragment shader]
43 #ifdef GL_ES
44 precision highp float;
45 #endif
47 in vec4 vert_color;
48 out vec4 frag_color;
50 void main()
52     frag_color = vert_color;
55 [vertex data]
56 vertex/float/2
57 -1.0 -1.0
58  1.0 -1.0
59  1.0  1.0
60 -1.0  1.0
62 [test]
63 % for io in func.inout_seq:
64 uniform uint func_input ${io.input}
65 % if func.exact:
66 uniform int exact 1
67 % else:
68 uniform int exact ${int(int(io.input[:-1]) in (0x0, 0xffffffff, 0x80808080,
69                                                0x81818181))}
70 % endif
71 % for j in range(func.num_valid_outputs):
72 uniform ${func.vector_type} expect${j} ${" ".join(io.valid_outputs[j])}
73 % endfor
74 draw arrays GL_TRIANGLE_FAN 0 4
75 probe all rgba 0.0 1.0 0.0 1.0
77 % endfor