2 * Copyright (c) 2019 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NON-INFRINGEMENT. IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 #include "piglit-util-gl.h"
27 PIGLIT_GL_TEST_CONFIG_BEGIN
29 config
.window_width
= 200;
30 config
.window_height
= 200;
31 config
.supports_gl_compat_version
= 10;
33 config
.window_visual
= PIGLIT_GL_VISUAL_RGBA
| PIGLIT_GL_VISUAL_DOUBLE
| PIGLIT_GL_VISUAL_DEPTH
;
35 PIGLIT_GL_TEST_CONFIG_END
38 * GL_CURRENT_RASTER_DISTANCE
39 * GL_CURRENT_RASTER_INDEX
61 {"pos", GL_CURRENT_RASTER_POSITION
},
62 {"color0", GL_CURRENT_RASTER_COLOR
},
63 {"color1", GL_CURRENT_RASTER_SECONDARY_COLOR
},
64 {"texcoord0", GL_CURRENT_RASTER_TEXTURE_COORDS
, 0},
65 {"texcoord1", GL_CURRENT_RASTER_TEXTURE_COORDS
, 1},
66 {"texcoord2", GL_CURRENT_RASTER_TEXTURE_COORDS
, 2},
67 {"texcoord3", GL_CURRENT_RASTER_TEXTURE_COORDS
, 3},
68 {"texcoord4", GL_CURRENT_RASTER_TEXTURE_COORDS
, 4},
69 {"texcoord5", GL_CURRENT_RASTER_TEXTURE_COORDS
, 5},
70 {"texcoord6", GL_CURRENT_RASTER_TEXTURE_COORDS
, 6},
71 {"texcoord7", GL_CURRENT_RASTER_TEXTURE_COORDS
, 7},
76 float vec
[ARRAY_SIZE(map
)][4];
77 float flt
[ARRAY_SIZE(map
) * 4];
83 query_raster(struct raster_pos
*r
)
85 for (unsigned i
= 0; i
< ARRAY_SIZE(map
); i
++) {
86 glActiveTexture(GL_TEXTURE0
+ map
[i
].texunit
);
87 glGetFloatv(map
[i
].glenum
, r
->vec
[i
]);
89 glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID
, &r
->valid
);
90 piglit_check_gl_error(0);
94 print_raster(const struct raster_pos
*r
)
96 for (unsigned i
= 0; i
< ARRAY_SIZE(map
); i
++) {
97 printf("%s = %.3f, %.3f, %.3f, %.3f\n", map
[i
].name
,
98 r
->vec
[i
][0], r
->vec
[i
][1], r
->vec
[i
][2], r
->vec
[i
][3]);
100 printf("valid = %u\n", r
->valid
);
104 compare_float(const float *probed
, const float *expected
, unsigned count
,
107 for (unsigned i
= 0; i
< count
; ++i
) {
108 if (fabsf(probed
[i
] - expected
[i
]) > 0.0001) {
109 printf("Probe %s\n", name
);
110 printf(" Expected: ");
111 for (unsigned j
= 0; j
< count
; j
++) {
112 printf("%s%f%s", j
> 0 ? ", " : "",
113 expected
[j
], j
+ 1 == count
? "\n" : "");
115 printf(" Observed: ");
116 for (unsigned j
= 0; j
< count
; j
++) {
117 printf("%s%f%s", j
> 0 ? ", " : "",
118 probed
[j
], j
+ 1 == count
? "\n" : "");
127 verify_raster_pos(const struct raster_pos
*expected
)
134 for (unsigned i
= 0; i
< ARRAY_SIZE(map
); i
++) {
135 pass
&= compare_float(r
.vec
[i
], expected
->vec
[i
], 4,
138 if (r
.valid
!= expected
->valid
) {
139 printf("Probe 'valid'\n");
140 printf(" Expected: %u\n", expected
->valid
);
141 printf(" Observed: %u\n", r
.valid
);
148 init_raster_pos(struct raster_pos
*r
)
150 memset(r
, 0, sizeof(*r
));
151 for (unsigned i
= 0; i
< ARRAY_SIZE(r
->flt
); i
++)
152 r
->flt
[i
] = 0.01 * (i
+ 1);
154 r
->vec
[COLOR1
][3] = 1; /* the secondary color doesn't have W */
159 set_raster_pos(const struct raster_pos
*r
)
161 glColor4fv(r
->vec
[COLOR0
]);
162 glSecondaryColor3fv(r
->vec
[COLOR1
]);
163 for (unsigned i
= 0; i
< 8; i
++)
164 glMultiTexCoord4fv(GL_TEXTURE0
+ i
, r
->vec
[TEXCOORD0
+ i
]);
165 glRasterPos4fv(r
->vec
[POS
]);
170 set_raster_pos_fixed_func(const struct raster_pos
*r
)
176 set_raster_pos_arb_vp(const struct raster_pos
*r
)
180 snprintf(source
, sizeof(source
),
182 "MOV result.position, {%f, %f, %f, %f};\n"
183 "MOV result.color, {%f, %f, %f, %f};\n"
184 "MOV result.color.secondary, {%f, %f, %f, %f};\n"
185 "MOV result.texcoord[0], {%f, %f, %f, %f};\n"
186 "MOV result.texcoord[1], {%f, %f, %f, %f};\n"
187 "MOV result.texcoord[2], {%f, %f, %f, %f};\n"
188 "MOV result.texcoord[3], {%f, %f, %f, %f};\n"
189 "MOV result.texcoord[4], {%f, %f, %f, %f};\n"
190 "MOV result.texcoord[5], {%f, %f, %f, %f};\n"
191 "MOV result.texcoord[6], {%f, %f, %f, %f};\n"
192 "MOV result.texcoord[7], {%f, %f, %f, %f};\n"
194 r
->flt
[0], r
->flt
[1], r
->flt
[2], r
->flt
[3],
195 r
->flt
[4], r
->flt
[5], r
->flt
[6], r
->flt
[7],
196 r
->flt
[8], r
->flt
[9], r
->flt
[10], r
->flt
[11],
197 r
->flt
[12], r
->flt
[13], r
->flt
[14], r
->flt
[15],
198 r
->flt
[16], r
->flt
[17], r
->flt
[18], r
->flt
[19],
199 r
->flt
[20], r
->flt
[21], r
->flt
[22], r
->flt
[23],
200 r
->flt
[24], r
->flt
[25], r
->flt
[26], r
->flt
[27],
201 r
->flt
[28], r
->flt
[29], r
->flt
[30], r
->flt
[31],
202 r
->flt
[32], r
->flt
[33], r
->flt
[34], r
->flt
[35],
203 r
->flt
[36], r
->flt
[37], r
->flt
[38], r
->flt
[39],
204 r
->flt
[40], r
->flt
[41], r
->flt
[42], r
->flt
[43]);
206 GLuint vp
= piglit_compile_program(GL_VERTEX_PROGRAM_ARB
, source
);
208 glEnable(GL_VERTEX_PROGRAM_ARB
);
209 glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, vp
);
211 struct raster_pos dummy_input
= {0};
212 set_raster_pos(&dummy_input
);
214 glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0);
215 glDisable(GL_VERTEX_PROGRAM_ARB
);
216 glDeleteProgramsARB(1, &vp
);
220 set_raster_pos_glsl(const struct raster_pos
*r
, GLenum next_shader
, bool sso
)
222 char vs_source
[2048];
223 unsigned glsl_version
= next_shader
== GL_TESS_EVALUATION_SHADER
? 400 :
224 next_shader
== GL_GEOMETRY_SHADER
? 150 : 110;
226 snprintf(vs_source
, sizeof(vs_source
),
229 " gl_Position = vec4(%f, %f, %f, %f);\n"
230 " gl_FrontColor = vec4(%f, %f, %f, %f);\n"
231 " gl_FrontSecondaryColor = vec4(%f, %f, %f, %f);\n"
232 " gl_TexCoord[0] = vec4(%f, %f, %f, %f);\n"
233 " gl_TexCoord[1] = vec4(%f, %f, %f, %f);\n"
234 " gl_TexCoord[2] = vec4(%f, %f, %f, %f);\n"
235 " gl_TexCoord[3] = vec4(%f, %f, %f, %f);\n"
236 " gl_TexCoord[4] = vec4(%f, %f, %f, %f);\n"
237 " gl_TexCoord[5] = vec4(%f, %f, %f, %f);\n"
238 " gl_TexCoord[6] = vec4(%f, %f, %f, %f);\n"
239 " gl_TexCoord[7] = vec4(%f, %f, %f, %f);\n"
241 glsl_version
, glsl_version
>= 150 ? " compatibility" : "",
242 r
->flt
[0], r
->flt
[1], r
->flt
[2], r
->flt
[3],
243 r
->flt
[4], r
->flt
[5], r
->flt
[6], r
->flt
[7],
244 r
->flt
[8], r
->flt
[9], r
->flt
[10], r
->flt
[11],
245 r
->flt
[12], r
->flt
[13], r
->flt
[14], r
->flt
[15],
246 r
->flt
[16], r
->flt
[17], r
->flt
[18], r
->flt
[19],
247 r
->flt
[20], r
->flt
[21], r
->flt
[22], r
->flt
[23],
248 r
->flt
[24], r
->flt
[25], r
->flt
[26], r
->flt
[27],
249 r
->flt
[28], r
->flt
[29], r
->flt
[30], r
->flt
[31],
250 r
->flt
[32], r
->flt
[33], r
->flt
[34], r
->flt
[35],
251 r
->flt
[36], r
->flt
[37], r
->flt
[38], r
->flt
[39],
252 r
->flt
[40], r
->flt
[41], r
->flt
[42], r
->flt
[43]);
254 /* Tessellation shaders should not be run on the raster position. */
255 /* Emit a point that will be clipped. */
256 const char *tes_source
=
257 "#version 400 compatibility\n"
258 "layout(quads) in;\n"
259 "void main() { gl_Position = vec4(-2.0, -2.0, -2.0, 1.0); }\n";
261 /* Geometry shaders should not be run on the raster position. */
262 /* Don't emit any primitives. */
263 const char *gs_source
=
264 "#version 150 compatibility\n"
265 "layout(triangles) in;\n"
266 "layout(triangle_strip, max_vertices = 0) out;\n"
269 const char *next_source
= next_shader
== GL_TESS_EVALUATION_SHADER
? tes_source
:
270 next_shader
== GL_GEOMETRY_SHADER
? gs_source
: NULL
;
272 GLuint prog
= 0, prog2
= 0, pipeline
= 0;
274 const char *vs
= vs_source
;
275 prog
= glCreateShaderProgramv(GL_VERTEX_SHADER
, 1,
276 (const GLchar
**)&vs
);
277 prog2
= glCreateShaderProgramv(next_shader
, 1,
278 (const GLchar
**)&next_source
);
280 glGenProgramPipelines(1, &pipeline
);
281 glUseProgramStages(pipeline
, GL_VERTEX_SHADER_BIT
, prog
);
282 glUseProgramStages(pipeline
,
283 next_shader
== GL_GEOMETRY_SHADER
?
284 GL_GEOMETRY_SHADER_BIT
:
285 GL_TESS_EVALUATION_SHADER_BIT
,
287 glBindProgramPipeline(pipeline
);
290 prog
= piglit_build_simple_program_multiple_shaders(
291 GL_VERTEX_SHADER
, vs_source
,
292 next_shader
, next_source
,
295 prog
= piglit_build_simple_program(vs_source
, NULL
);
301 struct raster_pos dummy_input
= {0};
302 set_raster_pos(&dummy_input
);
305 glBindProgramPipeline(0);
306 glDeleteProgramPipelines(1, &pipeline
);
307 glDeleteProgram(prog
);
308 glDeleteProgram(prog2
);
311 glDeleteProgram(prog
);
316 set_raster_pos_glsl_vs(const struct raster_pos
*r
)
318 set_raster_pos_glsl(r
, 0, false);
322 set_raster_pos_glsl_vs_tes_linked(const struct raster_pos
*r
)
324 set_raster_pos_glsl(r
, GL_TESS_EVALUATION_SHADER
, false);
328 set_raster_pos_glsl_vs_gs_linked(const struct raster_pos
*r
)
330 set_raster_pos_glsl(r
, GL_GEOMETRY_SHADER
, false);
334 set_raster_pos_glsl_vs_tes_sso(const struct raster_pos
*r
)
336 set_raster_pos_glsl(r
, GL_TESS_EVALUATION_SHADER
, true);
340 set_raster_pos_glsl_vs_gs_sso(const struct raster_pos
*r
)
342 set_raster_pos_glsl(r
, GL_GEOMETRY_SHADER
, true);
346 set_raster_pos_glsl_vs_uniforms(const struct raster_pos
*r
)
348 char vs_source
[2048];
350 snprintf(vs_source
, sizeof(vs_source
),
352 /* Add a dummy fog uniform to test the case when drivers use
353 * the std430 packing for uniforms internally.
355 "uniform float fog;\n"
356 "uniform vec4 vec[11];\n"
358 " gl_Position = vec[0];\n"
359 " gl_FrontColor = vec[1];\n"
360 " gl_FrontSecondaryColor = vec[2];\n"
361 " gl_TexCoord[0] = vec[3];\n"
362 " gl_TexCoord[1] = vec[4];\n"
363 " gl_TexCoord[2] = vec[5];\n"
364 " gl_TexCoord[3] = vec[6];\n"
365 " gl_TexCoord[4] = vec[7];\n"
366 " gl_TexCoord[5] = vec[8];\n"
367 " gl_TexCoord[6] = vec[9];\n"
368 " gl_TexCoord[7] = vec[10];\n"
369 " gl_FogFragCoord = fog;\n"
372 GLuint prog
= piglit_build_simple_program(vs_source
, NULL
);
375 glUniform1f(glGetUniformLocation(prog
, "fog"), 0);
376 glUniform4fv(glGetUniformLocation(prog
, "vec"), 11, r
->flt
);
378 struct raster_pos dummy_input
= {0};
379 set_raster_pos(&dummy_input
);
382 glDeleteProgram(prog
);
386 set_raster_pos_from_buffer(const struct raster_pos
*r
,
387 const char *vs_source
, GLenum buffer_target
,
391 glGenBuffers(1, &bo
);
392 glBindBuffer(buffer_target
, bo
);
393 glBufferData(buffer_target
, sizeof(r
->flt
), r
->flt
, GL_STATIC_DRAW
);
395 glGenTextures(1, &tex
);
397 if (buffer_target
== GL_TEXTURE_BUFFER
) {
398 glActiveTexture(GL_TEXTURE0
);
399 glBindTexture(GL_TEXTURE_BUFFER
, tex
);
400 glTexBuffer(GL_TEXTURE_BUFFER
, GL_RGBA32F
, bo
);
402 glBindImageTexture(0, tex
, 0, false, 0, GL_READ_ONLY
,
406 glBindBufferBase(buffer_target
, 0, bo
);
409 GLuint prog
= piglit_build_simple_program(vs_source
, NULL
);
413 struct raster_pos dummy_input
= {0};
414 set_raster_pos(&dummy_input
);
417 glDeleteProgram(prog
);
418 glBindBuffer(buffer_target
, 0);
419 glDeleteBuffers(1, &bo
);
420 glDeleteTextures(1, &tex
);
424 set_raster_pos_glsl_vs_ubo(const struct raster_pos
*r
)
426 char vs_source
[2048];
428 snprintf(vs_source
, sizeof(vs_source
),
434 " gl_Position = vec[0];\n"
435 " gl_FrontColor = vec[1];\n"
436 " gl_FrontSecondaryColor = vec[2];\n"
437 " gl_TexCoord[0] = vec[3];\n"
438 " gl_TexCoord[1] = vec[4];\n"
439 " gl_TexCoord[2] = vec[5];\n"
440 " gl_TexCoord[3] = vec[6];\n"
441 " gl_TexCoord[4] = vec[7];\n"
442 " gl_TexCoord[5] = vec[8];\n"
443 " gl_TexCoord[6] = vec[9];\n"
444 " gl_TexCoord[7] = vec[10];\n"
447 set_raster_pos_from_buffer(r
, vs_source
, GL_UNIFORM_BUFFER
, false);
451 set_raster_pos_glsl_vs_ssbo(const struct raster_pos
*r
)
453 char vs_source
[2048];
455 snprintf(vs_source
, sizeof(vs_source
),
456 "#version 430 compatibility\n"
457 "layout(binding = 0) buffer ssbo {\n"
461 " gl_Position = vec[0];\n"
462 " gl_FrontColor = vec[1];\n"
463 " gl_FrontSecondaryColor = vec[2];\n"
464 " gl_TexCoord[0] = vec[3];\n"
465 " gl_TexCoord[1] = vec[4];\n"
466 " gl_TexCoord[2] = vec[5];\n"
467 " gl_TexCoord[3] = vec[6];\n"
468 " gl_TexCoord[4] = vec[7];\n"
469 " gl_TexCoord[5] = vec[8];\n"
470 " gl_TexCoord[6] = vec[9];\n"
471 " gl_TexCoord[7] = vec[10];\n"
474 set_raster_pos_from_buffer(r
, vs_source
, GL_SHADER_STORAGE_BUFFER
, false);
478 set_raster_pos_glsl_vs_tbo(const struct raster_pos
*r
)
480 char vs_source
[2048];
482 snprintf(vs_source
, sizeof(vs_source
),
484 "uniform samplerBuffer bo;\n"
486 " gl_Position = texelFetch(bo, 0);\n"
487 " gl_FrontColor = texelFetch(bo, 1);\n"
488 " gl_FrontSecondaryColor = texelFetch(bo, 2);\n"
489 " gl_TexCoord[0] = texelFetch(bo, 3);\n"
490 " gl_TexCoord[1] = texelFetch(bo, 4);\n"
491 " gl_TexCoord[2] = texelFetch(bo, 5);\n"
492 " gl_TexCoord[3] = texelFetch(bo, 6);\n"
493 " gl_TexCoord[4] = texelFetch(bo, 7);\n"
494 " gl_TexCoord[5] = texelFetch(bo, 8);\n"
495 " gl_TexCoord[6] = texelFetch(bo, 9);\n"
496 " gl_TexCoord[7] = texelFetch(bo, 10);\n"
499 set_raster_pos_from_buffer(r
, vs_source
, GL_TEXTURE_BUFFER
, false);
503 set_raster_pos_glsl_vs_image_bo(const struct raster_pos
*r
)
505 char vs_source
[2048];
507 snprintf(vs_source
, sizeof(vs_source
),
508 "#version 420 compatibility\n"
509 "layout(rgba32f) uniform imageBuffer bo;\n"
511 " gl_Position = imageLoad(bo, 0);\n"
512 " gl_FrontColor = imageLoad(bo, 1);\n"
513 " gl_FrontSecondaryColor = imageLoad(bo, 2);\n"
514 " gl_TexCoord[0] = imageLoad(bo, 3);\n"
515 " gl_TexCoord[1] = imageLoad(bo, 4);\n"
516 " gl_TexCoord[2] = imageLoad(bo, 5);\n"
517 " gl_TexCoord[3] = imageLoad(bo, 6);\n"
518 " gl_TexCoord[4] = imageLoad(bo, 7);\n"
519 " gl_TexCoord[5] = imageLoad(bo, 8);\n"
520 " gl_TexCoord[6] = imageLoad(bo, 9);\n"
521 " gl_TexCoord[7] = imageLoad(bo, 10);\n"
524 set_raster_pos_from_buffer(r
, vs_source
, GL_TEXTURE_BUFFER
, true);
528 set_raster_pos_glsl_vs_tex(const struct raster_pos
*r
, const char *vs_source
,
532 glGenTextures(1, &tex
);
533 glActiveTexture(GL_TEXTURE0
);
534 glBindTexture(GL_TEXTURE_1D
, tex
);
535 glTexParameteri(GL_TEXTURE_1D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
536 glTexParameteri(GL_TEXTURE_1D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
537 static char zeros
[22 * sizeof(float) * 4];
538 /* The shader reads level 1, so initialize all other levels to zeros. */
539 glTexImage1D(GL_TEXTURE_1D
, 0, GL_RGBA32F
, 22, 0, GL_RGBA
, GL_FLOAT
,
541 glTexImage1D(GL_TEXTURE_1D
, 1, GL_RGBA32F
, 11, 0, GL_RGBA
, GL_FLOAT
,
543 glTexImage1D(GL_TEXTURE_1D
, 2, GL_RGBA32F
, 5, 0, GL_RGBA
, GL_FLOAT
,
545 glTexImage1D(GL_TEXTURE_1D
, 3, GL_RGBA32F
, 2, 0, GL_RGBA
, GL_FLOAT
,
547 glTexImage1D(GL_TEXTURE_1D
, 4, GL_RGBA32F
, 1, 0, GL_RGBA
, GL_FLOAT
,
550 glBindImageTexture(0, tex
, 1, false, 0, GL_READ_ONLY
,
554 GLuint prog
= piglit_build_simple_program(vs_source
, NULL
);
558 struct raster_pos dummy_input
= {0};
559 set_raster_pos(&dummy_input
);
562 glDeleteProgram(prog
);
563 glBindTexture(GL_TEXTURE_1D
, 0);
564 glDeleteTextures(1, &tex
);
568 set_raster_pos_glsl_vs_image1D(const struct raster_pos
*r
)
570 char vs_source
[2048];
572 snprintf(vs_source
, sizeof(vs_source
),
573 "#version 420 compatibility\n"
574 "layout(rgba32f) uniform image1D tex;\n"
576 " gl_Position = imageLoad(tex, 0);\n"
577 " gl_FrontColor = imageLoad(tex, 1);\n"
578 " gl_FrontSecondaryColor = imageLoad(tex, 2);\n"
579 " gl_TexCoord[0] = imageLoad(tex, 3);\n"
580 " gl_TexCoord[1] = imageLoad(tex, 4);\n"
581 " gl_TexCoord[2] = imageLoad(tex, 5);\n"
582 " gl_TexCoord[3] = imageLoad(tex, 6);\n"
583 " gl_TexCoord[4] = imageLoad(tex, 7);\n"
584 " gl_TexCoord[5] = imageLoad(tex, 8);\n"
585 " gl_TexCoord[6] = imageLoad(tex, 9);\n"
586 " gl_TexCoord[7] = imageLoad(tex, 10);\n"
589 set_raster_pos_glsl_vs_tex(r
, vs_source
, true);
593 set_raster_pos_glsl_vs_tex1D(const struct raster_pos
*r
)
595 char vs_source
[2048];
597 snprintf(vs_source
, sizeof(vs_source
),
599 "uniform sampler1D tex;\n"
601 " gl_Position = texelFetch(tex, 0, 1);\n"
602 " gl_FrontColor = texelFetch(tex, 1, 1);\n"
603 " gl_FrontSecondaryColor = texelFetch(tex, 2, 1);\n"
604 " gl_TexCoord[0] = texelFetch(tex, 3, 1);\n"
605 " gl_TexCoord[1] = texelFetch(tex, 4, 1);\n"
606 " gl_TexCoord[2] = texelFetch(tex, 5, 1);\n"
607 " gl_TexCoord[3] = texelFetch(tex, 6, 1);\n"
608 " gl_TexCoord[4] = texelFetch(tex, 7, 1);\n"
609 " gl_TexCoord[5] = texelFetch(tex, 8, 1);\n"
610 " gl_TexCoord[6] = texelFetch(tex, 9, 1);\n"
611 " gl_TexCoord[7] = texelFetch(tex, 10, 1);\n"
614 set_raster_pos_glsl_vs_tex(r
, vs_source
, false);
617 #define T(n) #n, set_raster_pos_##n
621 void (*set_raster_pos
)(const struct raster_pos
*);
628 {T(glsl_vs_uniforms
), 20},
629 {T(glsl_vs_tex1D
), 30},
630 {T(glsl_vs_ubo
), 31},
631 {T(glsl_vs_tbo
), 31},
632 {T(glsl_vs_image_bo
), 42},
633 {T(glsl_vs_image1D
), 42},
634 {T(glsl_vs_ssbo
), 43},
636 {T(glsl_vs_gs_linked
), 32},
637 {T(glsl_vs_tes_linked
), 40},
638 {T(glsl_vs_gs_sso
), 41},
639 {T(glsl_vs_tes_sso
), 41},
643 piglit_init(int argc
, char **argv
)
645 enum piglit_result result
= PIGLIT_PASS
;
646 piglit_require_gl_version(20);
650 for (unsigned i
= 0; i
< ARRAY_SIZE(tests
); i
++) {
651 if (piglit_get_gl_version() < tests
[i
].gl_version
) {
652 piglit_report_subtest_result(PIGLIT_SKIP
, "%s", tests
[i
].name
);
653 piglit_merge_result(&result
, PIGLIT_SKIP
);
657 struct raster_pos input
;
658 init_raster_pos(&input
);
659 tests
[i
].set_raster_pos(&input
);
661 /* Transform the raster position to match the expected output. */
662 input
.vec
[POS
][0] = (input
.vec
[POS
][0] * 0.5 + 0.5) * piglit_width
;
663 input
.vec
[POS
][1] = (input
.vec
[POS
][1] * 0.5 + 0.5) * piglit_height
;
664 input
.vec
[POS
][2] = input
.vec
[POS
][2] * 0.5 + 0.5;
666 enum piglit_result r
= verify_raster_pos(&input
) ? PIGLIT_PASS
:
668 piglit_report_subtest_result(r
, "%s", tests
[i
].name
);
669 piglit_merge_result(&result
, r
);
672 piglit_report_result(result
);