perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.50 / execution / interface-block-interpolation-named.shader_test
bloba74b2af08490d67c9163ead7dbb4d33098685f42
1 # Verify that interpolation qualifiers (flat, smooth, noperspective)
2 # declared inside interface blocks are properly respected.
4 # This test operates by comparing varyings declared inside an
5 # interface block with varyings declared outside an interface block.
6 # We assume that interpolation qualifiers work properly when declared
7 # outside interface blocks, because that is tested by other piglit
8 # tests.
10 # In this test, we verify proper functioning of interpolation
11 # qualifiers in a named interface block.
13 [require]
14 GLSL >= 1.50
16 [vertex shader]
17 in vec4 piglit_vertex;
19 flat out float flat_var;
20 smooth out float smooth_var;
21 noperspective out float noperspective_var;
22 out float unqualified_var;
24 out Blk {
25   flat float flat_var;
26   smooth float smooth_var;
27   noperspective float noperspective_var;
28   float unqualified_var;
29 } ifc;
31 void main()
33   gl_Position = piglit_vertex;
34   float var = float(gl_VertexID);
35   flat_var = var;
36   smooth_var = var;
37   noperspective_var = var;
38   unqualified_var = var;
39   ifc.flat_var = var;
40   ifc.smooth_var = var;
41   ifc.noperspective_var = var;
42   ifc.unqualified_var = var;
45 [fragment shader]
46 flat in float flat_var;
47 smooth in float smooth_var;
48 noperspective in float noperspective_var;
49 in float unqualified_var;
51 in Blk {
52   flat float flat_var;
53   smooth float smooth_var;
54   noperspective float noperspective_var;
55   float unqualified_var;
56 } ifc;
58 void main()
60   bool ok = true;
61   if (flat_var != ifc.flat_var) ok = false;
62   if (smooth_var != ifc.smooth_var) ok = false;
63   if (noperspective_var != ifc.noperspective_var) ok = false;
64   if (unqualified_var != ifc.unqualified_var) ok = false;
65   gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
68 [vertex data]
69 piglit_vertex/float/4
70 -1.0 -1.0 0.0 1.0
71  0.0  2.0 0.0 2.0 # Note: different W's to ensure that smooth != noperspective
72  3.0 -3.0 0.0 3.0
74 [test]
76 # Clear the background to green so that parts of the triangle which
77 # aren't drawn won't cause the test to fail.
78 clear color 0.0 1.0 0.0 1.0
79 clear
80 draw arrays GL_TRIANGLES 0 3
81 probe all rgba 0.0 1.0 0.0 1.0