perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.30 / execution / fs-textureLod-miplevels.shader_test
blobe5938bf3c2729017f68214156dda2f294317fb8b
2 # A basic mipmap test:
4 # Create an 8x8 texture with four miplevels, colored red, green, blue, and
5 # white, respectively.  Draw the following:
8 # (integer LODs)     (fractional w/ linear)       (fractional w/ nearest)
10 # miplevel 3 +
11 #                    [2.2] [2.4] [2.6] [2.8]      [2.2] [2.4] [2.6] [2.8]
12 # miplevel 2 +-+
13 #            +-+
14 #                    [1.2] [1.4] [1.6] [1.8]      [1.2] [1.4] [1.6] [1.8]
15 # miplevel 1 +---+
16 #            |   |
17 #            +---+
18 #                    [0.2] [0.4] [0.6] [0.8]      [0.2] [0.4] [0.6] [0.8]
19 #            +------+
20 # miplevel 0 |      |
21 #            |      |
22 #            +------+
24 # This verifies that textureLod() selects the proper miplevel for integer
25 # LODs (left boxes) and that both linear and nearest filtering for fractional
26 # LODs work correctly.
28 # It does not verify anything regarding texture coordinates.
30 [require]
31 GLSL >= 1.30
33 [fragment shader]
34 #version 130
35 uniform sampler2D tex;
36 uniform float lod;
37 void main()
39     gl_FragColor = textureLod(tex, vec2(0.5, 0.5), lod);
42 [vertex shader]
43 #version 130
44 void main()
46     gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
49 [test]
50 ortho
51 clear color 0.4 0.4 0.4 0.4
52 clear
54 uniform int tex 0
55 texture miptree 0
57 # Draw the miptree: basic integer LODs.
59 texparameter 2D min nearest_mipmap_nearest
60 texparameter 2D mag nearest
62 uniform float lod 0
63 draw rect 10 10 32 32
65 uniform float lod 1
66 draw rect 10 52 16 16
68 uniform float lod 2
69 draw rect 10 78 8 8
71 uniform float lod 3
72 draw rect 10 96 4 4
74 # Fractional LODs: nearest filtering between miplevels
76 uniform float lod 0.2
77 draw rect 152 42 10 10
79 uniform float lod 0.4
80 draw rect 167 42 10 10
82 uniform float lod 0.6
83 draw rect 182 42 10 10
85 uniform float lod 0.8
86 draw rect 197 42 10 10
88 uniform float lod 1.2
89 draw rect 152 68 10 10
91 uniform float lod 1.4
92 draw rect 167 68 10 10
94 uniform float lod 1.6
95 draw rect 182 68 10 10
97 uniform float lod 1.8
98 draw rect 197 68 10 10
100 uniform float lod 2.2
101 draw rect 152 86 10 10
103 uniform float lod 2.4
104 draw rect 167 86 10 10
106 uniform float lod 2.6
107 draw rect 182 86 10 10
109 uniform float lod 2.8
110 draw rect 197 86 10 10
113 # Fractional LODs: linear filtering between miplevels
115 texparameter 2D min nearest_mipmap_linear
117 uniform float lod 0.2
118 draw rect 52 42 10 10
120 uniform float lod 0.4
121 draw rect 67 42 10 10
123 uniform float lod 0.6
124 draw rect 82 42 10 10
126 uniform float lod 0.8
127 draw rect 97 42 10 10
129 uniform float lod 1.2
130 draw rect 52 68 10 10
132 uniform float lod 1.4
133 draw rect 67 68 10 10
135 uniform float lod 1.6
136 draw rect 82 68 10 10
138 uniform float lod 1.8
139 draw rect 97 68 10 10
141 uniform float lod 2.2
142 draw rect 52 86 10 10
144 uniform float lod 2.4
145 draw rect 67 86 10 10
147 uniform float lod 2.6
148 draw rect 82 86 10 10
150 uniform float lod 2.8
151 draw rect 97 86 10 10
153 # Probes: integer LODs
154 probe rgb 26 15 1.0 0.0 0.0
155 probe rgb 18 57 0.0 1.0 0.0
156 probe rgb 14 83 0.0 0.0 1.0
157 probe rgb 12 98 1.0 1.0 1.0
159 # Probes: nearest filtering
160 probe rgb 157 47 1.0 0.0 0.0
161 probe rgb 172 47 1.0 0.0 0.0
162 probe rgb 189 47 0.0 1.0 0.0
163 probe rgb 202 47 0.0 1.0 0.0
165 probe rgb 157 73 0.0 1.0 0.0
166 probe rgb 172 73 0.0 1.0 0.0
167 probe rgb 189 73 0.0 0.0 1.0
168 probe rgb 202 73 0.0 0.0 1.0
170 probe rgb 157 91 0.0 0.0 1.0
171 probe rgb 172 91 0.0 0.0 1.0
172 probe rgb 189 91 1.0 1.0 1.0
173 probe rgb 202 91 1.0 1.0 1.0
175 # Probes: linear filtering (tolerance of 0.05 makes it pass on fglrx)
176 tolerance 0.05 0.05 0.05 0.05
178 probe rgb  57 47 0.8 0.2 0.0
179 probe rgb  72 47 0.6 0.4 0.0
180 probe rgb  89 47 0.4 0.6 0.0
181 probe rgb 102 47 0.2 0.8 0.0
183 probe rgb  57 73 0.0 0.8 0.2
184 probe rgb  72 73 0.0 0.6 0.4
185 probe rgb  89 73 0.0 0.4 0.6
186 probe rgb 102 73 0.0 0.2 0.8
188 probe rgb  57 91 0.2 0.2 1.0
189 probe rgb  72 91 0.4 0.4 1.0
190 probe rgb  89 91 0.6 0.6 1.0
191 probe rgb 102 91 0.8 0.8 1.0