ext_gpu_shader4: add compiler tests for everything
[piglit.git] / generated_tests / templates / gen_shader_bit_encoding_tests / template.shader_test.mako
bloba7f49d9c4c78892ce2fcfc5ee717fd1a96914d7d
1 <%! import six %>
2 [require]
3 GLSL >= ${version}
4 % for extension in extensions:
5 ${extension}
6 % endfor
8 [vertex shader]
9 % if execution_stage == 'vs':
10 % for extension in extensions:
11 #extension ${extension}: enable
12 % endfor
14 uniform ${input_type} given;
15 uniform ${output_type} expected;
16 out vec4 color;
17 % endif
19 in vec4 vertex;
21 void main() {
22     gl_Position = vertex;
24     % if execution_stage == 'vs':
25     color = vec4(0.0, 1.0, 0.0, 1.0);
27     if (expected.x != ${func}(${in_modifier_func}(given.x)))
28             color.r = 1.0;
29     if (expected.xy != ${func}(${in_modifier_func}(given.xy)))
30             color.r = 1.0;
31     if (expected.xyz != ${func}(${in_modifier_func}(given.xyz)))
32             color.r = 1.0;
33     if (expected != ${func}(${in_modifier_func}(given)))
34             color.r = 1.0;
35     % endif
38 [fragment shader]
39 % if execution_stage == 'fs':
40 % for extension in extensions:
41 #extension ${extension}: enable
42 % endfor
44 uniform ${input_type} given;
45 uniform ${output_type} expected;
46 % else:
47 in vec4 color;
48 % endif
50 out vec4 frag_color;
52 void main() {
53     % if execution_stage == 'fs':
54     frag_color = vec4(0.0, 1.0, 0.0, 1.0);
56     if (expected.x != ${func}(${in_modifier_func}(given.x)))
57             frag_color.r = 1.0;
58     if (expected.xy != ${func}(${in_modifier_func}(given.xy)))
59             frag_color.r = 1.0;
60     if (expected.xyz != ${func}(${in_modifier_func}(given.xyz)))
61             frag_color.r = 1.0;
62     if (expected != ${func}(${in_modifier_func}(given)))
63             frag_color.r = 1.0;
64     % else:
65     frag_color = color;
66     % endif
69 [vertex data]
70 vertex/float/2
71 -1.0 -1.0
72  1.0 -1.0
73  1.0  1.0
74 -1.0  1.0
76 [test]
77 % for name, data in sorted(six.iteritems(test_data)):
78 % if name == '-0.0' and in_modifier_func != '' and func == 'intBitsToFloat':
79 # ${in_modifier_func}(INT_MIN) doesn't fit in a 32-bit int. Cannot test.
80 % else:
81 # ${name}
82 uniform ${input_type} given ${' '.join(str(in_func(d)) for d in data)}
83 uniform ${output_type} expected ${' '.join(str(out_func(modifier_func(in_func(d)))) for d in data)}
84 draw arrays GL_TRIANGLE_FAN 0 4
85 probe all rgba 0.0 1.0 0.0 1.0
86 % endif
88 % endfor