perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.10 / execution / glsl-gnome-shell-dim-window.shader_test
blobff1479ccee40ac853e9549dafa0a24b64bd34465
1 [require]
2 GLSL >= 1.10
4 [vertex shader]
5 varying vec4 texcoords;
7 void main()
9         gl_Position = gl_Vertex;
10         texcoords = (gl_Vertex + 1.0) / 2.0;
13 [fragment shader]
14 /* This shader came from gnome-shell, which is GPLv2+.  This copyright
15  * notice was constructed from the git logs of that file plus the
16  * top-level COPYING file, as it did not explicitly include the
17  * notice.
18  */
20     Copyright (C) 2010 Maxim Ermilov <zaspire@rambler.ru>
22     This program is free software; you can redistribute it and/or modify
23     it under the terms of the GNU General Public License as published by
24     the Free Software Foundation; either version 2 of the License, or
25     (at your option) any later version.
27     This program is distributed in the hope that it will be useful,
28     but WITHOUT ANY WARRANTY; without even the implied warranty of
29     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30     GNU General Public License for more details.
32     You should have received a copy of the GNU General Public License
33     along with this program; if not, write to the Free Software
34     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
35  */
37 #version 110
38 uniform sampler2D sampler0;
39 uniform float fraction;
40 uniform float height;
41 const float c = -0.5;
42 const float border_max_height = 60.0;
43 varying vec4 texcoords;
45 mat4 contrast = mat4(1.0 + c, 0.0, 0.0, 0.0,
46                      0.0, 1.0 + c, 0.0, 0.0,
47                      0.0, 0.0, 1.0 + c, 0.0,
48                      0.0, 0.0, 0.0, 1.0);
49 vec4 off = vec4(0.633, 0.633, 0.633, 0);
51 void main()
53     vec4 color = texture2D(sampler0, texcoords.xy);
54     float y = height * texcoords.y;
56     // To reduce contrast, blend with a mid gray
57     gl_FragColor = color * contrast - off * c;
59     // We only fully dim at a distance of BORDER_MAX_HEIGHT from the edge and
60     // when the fraction is 1.0. For other locations and fractions we linearly
61     // interpolate back to the original undimmed color.
62     gl_FragColor = color + (gl_FragColor - color) * min(y / border_max_height, 1.0);
63     gl_FragColor = color + (gl_FragColor - color) * fraction;
66 [test]
67 uniform int sampler0 0
68 uniform float fraction 1.0
69 uniform float height 60.0
70 texture rgbw 0 (8, 8)
71 draw rect -1 -1 2 2
72 relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
73 relative probe rgb (1.0, 0.0) (0.0, 1.0, 0.0)
74 relative probe rgb (0.0, 0.499) (0.90825, 0.15835, 0.15835)
75 relative probe rgb (1.0, 0.499) (0.15835, 0.90825, 0.15835)
76 relative probe rgb (0.0, 1.0) (0.3165, 0.3165, 0.8165)
77 relative probe rgb (1.0, 1.0) (0.8165, 0.8165, 0.8165)