ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_texture_buffer_object / formats.c
blobf2960cda05f81db277b9c3b4ec86ccca9d8dca25
1 /* Copyright © 2012 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
23 /** @file minmax.c
25 * Test for the minimum maximum value in the GL_ARB_texture_buffer_object spec.
28 #include "piglit-util-gl.h"
30 enum channels {
33 LA,
36 RG,
37 RGB,
38 RGBA,
41 static const struct format {
42 GLenum format;
43 GLenum type;
44 int components;
45 bool norm;
46 enum channels channels;
47 } formats[] = {
48 { GL_ALPHA8, GL_UNSIGNED_BYTE, 1, true, A },
49 { GL_ALPHA16, GL_UNSIGNED_SHORT, 1, true, A },
50 { GL_ALPHA16F_ARB, GL_HALF_FLOAT, 1, false, A },
51 { GL_ALPHA32F_ARB, GL_FLOAT, 1, false, A },
52 { GL_ALPHA8I_EXT, GL_BYTE, 1, false, A },
53 { GL_ALPHA16I_EXT, GL_SHORT, 1, false, A },
54 { GL_ALPHA32I_EXT, GL_INT, 1, false, A },
55 { GL_ALPHA8UI_EXT, GL_UNSIGNED_BYTE, 1, false, A },
56 { GL_ALPHA16UI_EXT, GL_UNSIGNED_SHORT, 1, false, A },
57 { GL_ALPHA32UI_EXT, GL_UNSIGNED_INT, 1, false, A },
59 { GL_LUMINANCE8, GL_UNSIGNED_BYTE, 1, true, L },
60 { GL_LUMINANCE16, GL_UNSIGNED_SHORT, 1, true, L },
61 { GL_LUMINANCE16F_ARB, GL_HALF_FLOAT, 1, false, L },
62 { GL_LUMINANCE32F_ARB, GL_FLOAT, 1, false, L },
63 { GL_LUMINANCE8I_EXT, GL_BYTE , 1, false, L },
64 { GL_LUMINANCE16I_EXT, GL_SHORT, 1, false, L },
65 { GL_LUMINANCE32I_EXT, GL_INT , 1, false, L },
66 { GL_LUMINANCE8UI_EXT, GL_UNSIGNED_BYTE, 1, false, L },
67 { GL_LUMINANCE16UI_EXT, GL_UNSIGNED_SHORT, 1, false, L },
68 { GL_LUMINANCE32UI_EXT, GL_UNSIGNED_INT, 1, false, L },
70 { GL_LUMINANCE8_ALPHA8, GL_UNSIGNED_BYTE, 2, true, LA },
71 { GL_LUMINANCE16_ALPHA16, GL_UNSIGNED_SHORT, 2, true, LA },
72 { GL_LUMINANCE_ALPHA16F_ARB, GL_HALF_FLOAT, 2, false, LA },
73 { GL_LUMINANCE_ALPHA32F_ARB, GL_FLOAT, 2, false, LA },
74 { GL_LUMINANCE_ALPHA8I_EXT, GL_BYTE, 2, false, LA },
75 { GL_LUMINANCE_ALPHA16I_EXT, GL_SHORT, 2, false, LA },
76 { GL_LUMINANCE_ALPHA32I_EXT, GL_INT, 2, false, LA },
77 { GL_LUMINANCE_ALPHA8UI_EXT, GL_UNSIGNED_BYTE, 2, false, LA },
78 { GL_LUMINANCE_ALPHA16UI_EXT, GL_UNSIGNED_SHORT, 2, false, LA },
79 { GL_LUMINANCE_ALPHA32UI_EXT, GL_UNSIGNED_INT, 2, false, LA },
81 { GL_INTENSITY8, GL_UNSIGNED_BYTE, 1, true, I },
82 { GL_INTENSITY16, GL_UNSIGNED_SHORT, 1, true, I },
83 { GL_INTENSITY16F_ARB, GL_HALF_FLOAT, 1, false, I },
84 { GL_INTENSITY32F_ARB, GL_FLOAT, 1, false, I },
85 { GL_INTENSITY8I_EXT, GL_BYTE, 1, false, I },
86 { GL_INTENSITY16I_EXT, GL_SHORT, 1, false, I },
87 { GL_INTENSITY32I_EXT, GL_INT, 1, false, I },
88 { GL_INTENSITY8UI_EXT, GL_UNSIGNED_BYTE, 1, false, I },
89 { GL_INTENSITY16UI_EXT, GL_UNSIGNED_SHORT, 1, false, I },
90 { GL_INTENSITY32UI_EXT, GL_UNSIGNED_INT, 1, false, I },
92 { GL_RGBA8, GL_UNSIGNED_BYTE, 4, true, RGBA },
93 { GL_RGBA16, GL_UNSIGNED_SHORT, 4, true, RGBA },
94 { GL_RGBA16F, GL_HALF_FLOAT, 4, false, RGBA },
95 { GL_RGBA32F, GL_FLOAT, 4, false, RGBA },
96 { GL_RGBA8I_EXT, GL_BYTE, 4, false, RGBA },
97 { GL_RGBA16I_EXT, GL_SHORT, 4, false, RGBA },
98 { GL_RGBA32I_EXT, GL_INT, 4, false, RGBA },
99 { GL_RGBA8UI_EXT, GL_UNSIGNED_BYTE, 4, false, RGBA },
100 { GL_RGBA16UI_EXT, GL_UNSIGNED_SHORT, 4, false, RGBA },
101 { GL_RGBA32UI_EXT, GL_UNSIGNED_INT, 4, false, RGBA },
103 /* These don't appear in the GL_ARB_texture_buffer_object or
104 * GL_ARB_texture_rg specs, but they do appear in the GL 3.1
105 * specification's table for buffer texture formats. We
106 * assume that the intent was for RG to be included even in
107 * ARB_tbo + ARB_texture_rg
109 { GL_R8, GL_UNSIGNED_BYTE, 1, true, R },
110 { GL_R16, GL_UNSIGNED_SHORT, 1, true, R },
111 { GL_R16F, GL_HALF_FLOAT, 1, false, R },
112 { GL_R32F, GL_FLOAT, 1, false, R },
113 { GL_R8I, GL_BYTE, 1, false, R },
114 { GL_R16I, GL_SHORT, 1, false, R },
115 { GL_R32I, GL_INT, 1, false, R },
116 { GL_R8UI, GL_UNSIGNED_BYTE, 1, false, R },
117 { GL_R16UI, GL_UNSIGNED_SHORT, 1, false, R },
118 { GL_R32UI, GL_UNSIGNED_INT, 1, false, R },
120 { GL_RG8, GL_UNSIGNED_BYTE, 2, true, RG },
121 { GL_RG16, GL_UNSIGNED_SHORT, 2, true, RG },
122 { GL_RG16F, GL_HALF_FLOAT, 2, false, RG },
123 { GL_RG32F, GL_FLOAT, 2, false, RG },
124 { GL_RG8I, GL_BYTE, 2, false, RG },
125 { GL_RG16I, GL_SHORT, 2, false, RG },
126 { GL_RG32I, GL_INT, 2, false, RG },
127 { GL_RG8UI, GL_UNSIGNED_BYTE, 2, false, RG },
128 { GL_RG16UI, GL_UNSIGNED_SHORT, 2, false, RG },
129 { GL_RG32UI, GL_UNSIGNED_INT, 2, false, RG },
131 { GL_RGB32F, GL_FLOAT, 3, false, RGB },
132 { GL_RGB32I, GL_INT, 3, false, RGB },
133 { GL_RGB32UI, GL_UNSIGNED_INT, 3, false, RGB },
136 bool test_vs;
137 bool test_arb;
138 bool test_rgb32;
139 struct program {
140 GLuint prog;
141 int pos_location;
142 int expected_location;
145 struct program prog_f;
146 struct program prog_i;
147 struct program prog_u;
148 static int vertex_location;
150 static int y_index;
152 static uint8_t uint8_data[] = {
153 0x00, 0x01, 0x02, 0x03,
154 0x10, 0x20, 0x30, 0x40,
155 0x60, 0x90, 0xa0, 0xff,
158 static uint16_t uint16_data[] = {
159 0x0000, 0x0001, 0x0002, 0x0003,
160 0x4000, 0x8000, 0xc000, 0xffff,
163 static uint32_t uint32_data[] = {
164 0x00000000, 0x00000001, 0x00000002, 0x00000003,
165 0x40000000, 0x80000000, 0xc0000000, 0xffffffff,
168 static float float_data[] = {
169 0.0, 0.25, 0.5, 0.75,
170 1.0, 2.0, 3.0, 4.0,
171 -1.0, -2.0, -3.0, -4.0,
174 static float
175 transform_x(float x)
177 return -1.0 + 2.0 * x / piglit_width;
180 static float
181 transform_y(float y)
183 return -1.0 + 2.0 * y / piglit_height;
186 static bool
187 get_expected_f(const struct format *format, int sample, float *expected)
189 float chans[4] = { 0 };
190 int i;
192 for (i = 0; i < format->components; i++) {
193 int comp = sample * format->components + i;
195 switch (format->type) {
196 case GL_FLOAT:
197 chans[i] = float_data[comp];
198 break;
199 case GL_HALF_FLOAT:
200 chans[i] = float_data[comp];
201 break;
202 case GL_UNSIGNED_BYTE:
203 chans[i] = uint8_data[comp] / 255.0;
204 break;
205 case GL_UNSIGNED_SHORT:
206 chans[i] = uint16_data[comp] / 65535.0;
207 break;
208 default:
209 printf("line %d, bad type: %s\n", __LINE__,
210 piglit_get_gl_enum_name(format->type));
211 memset(expected, 0, 16);
212 return false;
216 switch (format->channels) {
217 case RGBA:
218 expected[0] = chans[0];
219 expected[1] = chans[1];
220 expected[2] = chans[2];
221 expected[3] = chans[3];
222 break;
223 case RGB:
224 expected[0] = chans[0];
225 expected[1] = chans[1];
226 expected[2] = chans[2];
227 expected[3] = 1.0;
228 break;
229 case RG:
230 expected[0] = chans[0];
231 expected[1] = chans[1];
232 expected[2] = 0.0;
233 expected[3] = 1.0;
234 break;
236 case R:
237 expected[0] = chans[0];
238 expected[1] = 0.0;
239 expected[2] = 0.0;
240 expected[3] = 1.0;
241 break;
243 case A:
244 expected[0] = 0.0;
245 expected[1] = 0.0;
246 expected[2] = 0.0;
247 expected[3] = chans[0];
248 break;
250 case L:
251 expected[0] = chans[0];
252 expected[1] = chans[0];
253 expected[2] = chans[0];
254 expected[3] = 1.0;
255 break;
257 case LA:
258 expected[0] = chans[0];
259 expected[1] = chans[0];
260 expected[2] = chans[0];
261 expected[3] = chans[1];
262 break;
264 case I:
265 expected[0] = chans[0];
266 expected[1] = chans[0];
267 expected[2] = chans[0];
268 expected[3] = chans[0];
269 break;
272 return true;
275 static bool
276 get_expected_i(const struct format *format, int sample, uint32_t *expected)
278 uint32_t chans[4] = { 0 };
279 int i;
281 for (i = 0; i < format->components; i++) {
282 int comp = sample * format->components + i;
284 switch (format->type) {
285 case GL_BYTE:
286 chans[i] = ((int8_t *)uint8_data)[comp];
287 break;
288 case GL_UNSIGNED_BYTE:
289 chans[i] = uint8_data[comp];
290 break;
291 case GL_SHORT:
292 chans[i] = ((int16_t *)uint16_data)[comp];
293 break;
294 case GL_UNSIGNED_SHORT:
295 chans[i] = uint16_data[comp];
296 break;
297 case GL_INT:
298 case GL_UNSIGNED_INT:
299 chans[i] = uint32_data[comp];
300 break;
301 default:
302 printf("line %d, bad type: %s\n", __LINE__,
303 piglit_get_gl_enum_name(format->type));
304 memset(expected, 0, 16);
305 return false;
309 switch (format->channels) {
310 case RGBA:
311 expected[0] = chans[0];
312 expected[1] = chans[1];
313 expected[2] = chans[2];
314 expected[3] = chans[3];
315 break;
316 case RGB:
317 expected[0] = chans[0];
318 expected[1] = chans[1];
319 expected[2] = chans[2];
320 expected[3] = 1.0;
321 break;
322 case RG:
323 expected[0] = chans[0];
324 expected[1] = chans[1];
325 expected[2] = 0.0;
326 expected[3] = 1.0;
327 break;
329 case R:
330 expected[0] = chans[0];
331 expected[1] = 0.0;
332 expected[2] = 0.0;
333 expected[3] = 1.0;
334 break;
336 case A:
337 expected[0] = 0.0;
338 expected[1] = 0.0;
339 expected[2] = 0.0;
340 expected[3] = chans[0];
341 break;
343 case L:
344 expected[0] = chans[0];
345 expected[1] = chans[0];
346 expected[2] = chans[0];
347 expected[3] = 1.0;
348 break;
350 case LA:
351 expected[0] = chans[0];
352 expected[1] = chans[0];
353 expected[2] = chans[0];
354 expected[3] = chans[1];
355 break;
357 case I:
358 expected[0] = chans[0];
359 expected[1] = chans[0];
360 expected[2] = chans[0];
361 expected[3] = chans[0];
362 break;
365 return true;
368 enum piglit_result
369 test_format(int format_index)
371 const struct format *format = &formats[format_index];
372 GLuint tex, bo;
373 bool is_rg = (format->channels == R ||
374 format->channels == RG);
375 bool is_arb = (format->channels == I ||
376 format->channels == L ||
377 format->channels == LA ||
378 format->channels == A);
379 bool is_rgb32 = (format->channels == RGB);
380 bool pass = true;
381 int data_components, num_samples;
382 int i;
383 bool returns_float = (format->norm ||
384 format->type == GL_FLOAT ||
385 format->type == GL_HALF_FLOAT);
386 bool returns_int = (!format->norm &&
387 (format->type == GL_BYTE ||
388 format->type == GL_SHORT ||
389 format->type == GL_INT));
390 bool returns_uint = (!format->norm &&
391 (format->type == GL_UNSIGNED_BYTE ||
392 format->type == GL_UNSIGNED_SHORT ||
393 format->type == GL_UNSIGNED_INT));
394 struct program *prog;
396 if (returns_float)
397 prog = &prog_f;
398 else if (returns_int)
399 prog = &prog_i;
400 else
401 prog = &prog_u;
403 glUseProgram(prog->prog);
405 if (test_arb != is_arb)
406 return PIGLIT_SKIP;
408 if (is_rgb32 && !test_rgb32)
409 return PIGLIT_SKIP;
411 /* These didn't exist in the extension before being promoted to
412 * GL 3.1.
414 if (is_rg && piglit_get_gl_version() < 31)
415 return PIGLIT_SKIP;
417 printf("Testing %s\n", piglit_get_gl_enum_name(format->format));
419 glGenBuffers(1, &bo);
420 glBindBuffer(GL_TEXTURE_BUFFER, bo);
422 glGenTextures(1, &tex);
423 glBindTexture(GL_TEXTURE_BUFFER, tex);
425 glTexBuffer(GL_TEXTURE_BUFFER, format->format, bo);
427 switch (format->type) {
428 case GL_BYTE:
429 case GL_UNSIGNED_BYTE:
430 glBufferData(GL_TEXTURE_BUFFER, sizeof(uint8_data), uint8_data,
431 GL_STATIC_READ);
432 data_components = ARRAY_SIZE(uint8_data);
433 break;
435 case GL_SHORT:
436 case GL_UNSIGNED_SHORT:
437 glBufferData(GL_TEXTURE_BUFFER, sizeof(uint16_data),
438 uint16_data, GL_STATIC_READ);
439 data_components = ARRAY_SIZE(uint16_data);
440 break;
442 case GL_INT:
443 case GL_UNSIGNED_INT:
444 glBufferData(GL_TEXTURE_BUFFER, sizeof(uint32_data),
445 uint32_data, GL_STATIC_READ);
446 data_components = ARRAY_SIZE(uint32_data);
447 break;
449 case GL_FLOAT:
450 glBufferData(GL_TEXTURE_BUFFER, sizeof(float_data), float_data,
451 GL_STATIC_READ);
452 data_components = ARRAY_SIZE(float_data);
453 break;
455 case GL_HALF_FLOAT: {
456 unsigned short hf_data[ARRAY_SIZE(float_data)];
457 for (i = 0; i < ARRAY_SIZE(float_data); i++) {
458 hf_data[i] = piglit_half_from_float(float_data[i]);
460 glBufferData(GL_TEXTURE_BUFFER, sizeof(hf_data), hf_data,
461 GL_STATIC_READ);
462 data_components = ARRAY_SIZE(float_data);
464 break;
467 default:
468 printf("line %d, bad type: %s\n", __LINE__,
469 piglit_get_gl_enum_name(format->type));
470 return PIGLIT_SKIP;
473 num_samples = data_components / format->components;
475 for (i = 0; i < num_samples; i++) {
476 float x1 = 5 + i * 10;
477 float x2 = 10 + i * 10;
478 float y1 = piglit_height - (5 + y_index * 10);
479 float y2 = piglit_height - (10 + y_index * 10);
480 GLfloat verts[8] = {
481 transform_x(x1), transform_y(y1),
482 transform_x(x2), transform_y(y1),
483 transform_x(x2), transform_y(y2),
484 transform_x(x1), transform_y(y2),
486 float expected_f[4];
487 uint32_t expected_i[4];
488 const float green[4] = {0, 1, 0, 0};
490 if (returns_float) {
491 if (!get_expected_f(format, i, expected_f))
492 return PIGLIT_SKIP;
493 glUniform4fv(prog->expected_location, 1, expected_f);
494 } else {
495 if (!get_expected_i(format, i, expected_i))
496 return PIGLIT_SKIP;
497 if (returns_uint) {
498 glUniform4uiv(prog->expected_location, 1,
499 expected_i);
500 } else {
501 glUniform4iv(prog->expected_location, 1,
502 (int *)expected_i);
506 glUniform1i(prog->pos_location, i);
508 glBufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
509 GL_STREAM_DRAW);
510 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
512 if (pass &&
513 !piglit_probe_rect_rgba(x1, y2,
514 x2 - x1, y1 - y2, green)) {
515 if (returns_int) {
516 printf(" Texel: %d %d %d %d\n",
517 expected_i[0], expected_i[1],
518 expected_i[2], expected_i[3]);
519 } else if (returns_uint) {
520 printf(" Texel: %u %u %u %u\n",
521 expected_i[0], expected_i[1],
522 expected_i[2], expected_i[3]);
523 } else {
524 printf(" Texel: %f %f %f %f\n",
525 expected_f[0], expected_f[1],
526 expected_f[2], expected_f[3]);
528 pass = false;
532 glDeleteBuffers(1, &bo);
533 glDeleteTextures(1, &tex);
535 glUseProgram(0);
536 y_index++;
538 piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
539 "%s", piglit_get_gl_enum_name(format->format));
540 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
543 enum piglit_result
544 piglit_display(void)
546 enum piglit_result result = PIGLIT_SKIP;
547 int i;
548 GLuint vao, vbo;
550 glClearColor(0.5, 0.5, 0.5, 0.5);
551 glClear(GL_COLOR_BUFFER_BIT);
553 y_index = 0;
555 /* For GL core, we need to have a vertex array object bound.
556 * Otherwise, we don't particularly have to. Always use a
557 * vertex buffer object, though.
559 glGenBuffers(1, &vbo);
560 glBindBuffer(GL_ARRAY_BUFFER_ARB, vbo);
561 if (piglit_get_gl_version() >= 31) {
562 GLuint vao;
563 glGenVertexArrays(1, &vao);
564 glBindVertexArray(vao);
566 glVertexAttribPointer(vertex_location, 2, GL_FLOAT, GL_FALSE, 0, 0);
567 glEnableVertexAttribArray(vertex_location);
569 for (i = 0; i < ARRAY_SIZE(formats); i++) {
570 piglit_merge_result(&result, test_format(i));
573 glDeleteBuffers(1, &vbo);
574 glDeleteVertexArrays(1, &vao);
576 piglit_present_results();
578 return result;
581 static char *vs_vert_source =
582 "#version 140\n"
583 "in vec4 vertex;\n"
584 "out vec4 color;\n"
585 "uniform %ssamplerBuffer s;\n"
586 "uniform int pos;\n"
587 "uniform %svec4 expected;"
588 "void main()\n"
589 "{\n"
590 " gl_Position = vertex;\n"
591 "\n"
592 " %svec4 result = texelFetch(s, pos);\n"
593 " %svec4 delta = result - expected;\n"
594 " bvec4 fail = greaterThanEqual(abs(delta), %s);\n"
595 " if (any(fail)) {\n"
596 " color = 0.25 + 0.5 * vec4(fail);\n"
597 " } else {\n"
598 " color = vec4(0.0, 1.0, 0.0, 0.0);\n"
599 " }\n"
600 "}\n";
602 static char *fs_vert_source =
603 "#version 140\n"
604 "in vec4 color;\n"
605 "void main()\n"
606 "{\n"
607 " gl_FragColor = color;\n"
608 "}\n";
611 static char *vs_frag_source =
612 "#version 140\n"
613 "in vec4 vertex;\n"
614 "void main()\n"
615 "{\n"
616 " gl_Position = vertex;\n"
617 "}\n";
619 static char *fs_frag_source =
620 "#version 140\n"
621 "uniform %ssamplerBuffer s;\n"
622 "uniform int pos;\n"
623 "uniform %svec4 expected;"
624 "void main()\n"
625 "{\n"
626 " %svec4 result = texelFetch(s, pos);\n"
627 " %svec4 delta = result - expected;\n"
628 " bvec4 fail = greaterThanEqual(abs(delta), %s);\n"
629 " if (any(fail)) {\n"
630 " gl_FragColor = 0.25 + 0.5 * vec4(fail);\n"
631 " } else {\n"
632 " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
633 " }\n"
634 "}\n";
636 static void
637 create_program(struct program *program, const char *type)
639 char *fs_source, *vs_source;
640 GLuint prog;
641 char *threshold;
643 if (strcmp(type, "") == 0)
644 threshold = "vec4(0.02)";
645 else
646 threshold = "ivec4(1)";
648 if (test_vs) {
649 (void)!asprintf(&vs_source, vs_vert_source, type, type, type, type,
650 threshold);
651 fs_source = fs_vert_source;
652 } else {
653 vs_source = vs_frag_source;
654 (void)!asprintf(&fs_source, fs_frag_source, type, type, type, type,
655 threshold);
658 prog = piglit_build_simple_program(vs_source, fs_source);
660 program->prog = prog;
661 program->pos_location = glGetUniformLocation(prog, "pos");
662 program->expected_location = glGetUniformLocation(prog,
663 "expected");
664 vertex_location = glGetAttribLocation(prog, "vertex");
665 assert(vertex_location == 0);
668 static void
669 init_programs()
671 create_program(&prog_f, "");
672 create_program(&prog_i, "i");
673 create_program(&prog_u, "u");
676 static void
677 usage(const char *name)
679 printf("usage: %s <fs | vs> <core | arb>\n", name);
680 piglit_report_result(PIGLIT_FAIL);
683 void
684 piglit_init(int argc, char **argv)
686 piglit_require_GLSL_version(140);
688 piglit_require_extension("GL_EXT_texture_integer");
689 piglit_require_extension("GL_ARB_texture_rg");
691 if (test_arb) {
692 piglit_require_extension("GL_ARB_texture_buffer_object");
693 } else {
694 if (piglit_get_gl_version() < 31)
695 piglit_require_extension("GL_ARB_texture_buffer_object");
697 if (piglit_is_extension_supported("GL_ARB_texture_buffer_object_rgb32"))
698 test_rgb32 = true;
702 init_programs();
705 PIGLIT_GL_TEST_CONFIG_BEGIN
706 test_vs = PIGLIT_STRIP_ARG("vs");
707 if (!test_vs && !PIGLIT_STRIP_ARG("fs"))
708 usage(argv[0]);
710 test_arb = PIGLIT_STRIP_ARG("arb");
711 if (!test_arb && !PIGLIT_STRIP_ARG("core"))
712 usage(argv[0]);
714 if (test_arb)
715 config.supports_gl_compat_version = 10;
716 else
717 config.supports_gl_core_version = 31;
719 config.window_width = 200;
720 config.window_height = 500;
721 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
722 config.khr_no_error_support = PIGLIT_NO_ERRORS;
723 PIGLIT_GL_TEST_CONFIG_END