perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / generated_tests / templates / gen_shader_bit_encoding_tests / template.shader_test.mako
blobadb6c9a09bb72464802f9d7c4ff55acfb1c40b78
1 [require]
2 GLSL >= ${version}
3 % for extension in extensions:
4 ${extension}
5 % endfor
7 [vertex shader]
8 % if execution_stage == 'vs':
9 % for extension in extensions:
10 #extension ${extension}: enable
11 % endfor
13 uniform ${input_type} given;
14 uniform ${output_type} expected;
15 out vec4 color;
16 % endif
18 in vec4 vertex;
20 void main() {
21     gl_Position = vertex;
23     % if execution_stage == 'vs':
24     color = vec4(0.0, 1.0, 0.0, 1.0);
26     if (expected.x != ${func}(${in_modifier_func}(given.x)))
27             color.r = 1.0;
28     if (expected.xy != ${func}(${in_modifier_func}(given.xy)))
29             color.r = 1.0;
30     if (expected.xyz != ${func}(${in_modifier_func}(given.xyz)))
31             color.r = 1.0;
32     if (expected != ${func}(${in_modifier_func}(given)))
33             color.r = 1.0;
34     % endif
37 [fragment shader]
38 % if execution_stage == 'fs':
39 % for extension in extensions:
40 #extension ${extension}: enable
41 % endfor
43 uniform ${input_type} given;
44 uniform ${output_type} expected;
45 % else:
46 in vec4 color;
47 % endif
49 out vec4 frag_color;
51 void main() {
52     % if execution_stage == 'fs':
53     frag_color = vec4(0.0, 1.0, 0.0, 1.0);
55     if (expected.x != ${func}(${in_modifier_func}(given.x)))
56             frag_color.r = 1.0;
57     if (expected.xy != ${func}(${in_modifier_func}(given.xy)))
58             frag_color.r = 1.0;
59     if (expected.xyz != ${func}(${in_modifier_func}(given.xyz)))
60             frag_color.r = 1.0;
61     if (expected != ${func}(${in_modifier_func}(given)))
62             frag_color.r = 1.0;
63     % else:
64     frag_color = color;
65     % endif
68 [vertex data]
69 vertex/float/2
70 -1.0 -1.0
71  1.0 -1.0
72  1.0  1.0
73 -1.0  1.0
75 [test]
76 % for name, data in sorted(test_data.items()):
77 % if name == '-0.0' and in_modifier_func != '' and func == 'intBitsToFloat':
78 # ${in_modifier_func}(INT_MIN) doesn't fit in a 32-bit int. Cannot test.
79 % else:
80 # ${name}
81 uniform ${input_type} given ${' '.join(str(in_func(d)) for d in data)}
82 uniform ${output_type} expected ${' '.join(str(out_func(modifier_func(in_func(d)))) for d in data)}
83 draw arrays GL_TRIANGLE_FAN 0 4
84 probe all rgba 0.0 1.0 0.0 1.0
85 % endif
87 % endfor