2 * Copyright © 2009 Intel Corporation
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * 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, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * Simple test case framework.
27 * \author Ian Romanick <ian.d.romanick@intel.com>
35 #include "piglit-util.h"
36 #include "piglit-framework.h"
38 #include "piglit-glx-util.h"
42 #include "GL/freeglut_ext.h"
45 int piglit_automatic
= 0;
46 static int piglit_window
;
47 static enum piglit_result result
;
52 result
= piglit_display();
54 if (piglit_automatic
) {
55 glutDestroyWindow(piglit_window
);
57 /* Tell GLUT to clean up and exit, so that we can
58 * reasonably valgrind our testcases for memory
61 glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE
,
62 GLUT_ACTION_GLUTMAINLOOP_RETURNS
);
65 piglit_report_result(result
);
76 glViewport(0, 0, w
, h
);
79 int main(int argc
, char *argv
[])
83 glutInit(&argc
, argv
);
85 /* Find/remove "-auto" from the argument vector.
87 for (j
= 1; j
< argc
; j
++) {
88 if (!strcmp(argv
[j
], "-auto")) {
93 for (i
= j
+ 1; i
< argc
; i
++) {
94 argv
[i
- 1] = argv
[i
];
100 glutInitWindowPosition(0, 0);
101 glutInitWindowSize(piglit_width
, piglit_height
);
102 glutInitDisplayMode(piglit_window_mode
);
103 piglit_window
= glutCreateWindow(argv
[0]);
106 if (piglit_automatic
)
107 piglit_glx_set_no_input();
110 glutDisplayFunc(display
);
111 glutReshapeFunc(reshape
);
112 glutKeyboardFunc(piglit_escape_exit_key
);
116 piglit_init(argc
, argv
);
120 piglit_report_result(result
);