cl: Don't use device_infos if num_device_infos == 0
[piglit.git] / tests / general / glinfo.c
bloba2bc5fd5eb225e9caf09db53e7cbccd8e76e1273
1 /*
2 * Copyright © 2013 VMware, 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 * 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
13 * Software.
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
21 * DEALINGS IN THE SOFTWARE.
24 /**
25 * Simply query and print various glGetString() values.
26 * This is helpful when running a complete piglit run since the
27 * results file will have all the pertinant info for the GL driver
28 * that was tested.
30 * Note that the piglit framework tries to run glxinfo/wglinfo and
31 * put the output in the results file, but sometimes those programs
32 * aren't installed.
34 * Brian Paul
35 * April 2013
39 #include "piglit-util-gl.h"
42 PIGLIT_GL_TEST_CONFIG_BEGIN
43 config.supports_gl_compat_version = 10;
44 config.window_visual = PIGLIT_GL_VISUAL_RGB;
45 PIGLIT_GL_TEST_CONFIG_END
48 enum piglit_result
49 piglit_display(void)
51 return PIGLIT_PASS;
55 void
56 piglit_init(int argc, char **argv)
58 const char *renderer = (const char *) glGetString(GL_RENDERER);
59 const char *version = (const char *) glGetString(GL_VERSION);
60 const char *vendor = (const char *) glGetString(GL_VENDOR);
62 printf("GL_RENDERER = %s\n", renderer);
63 printf("GL_VERSION = %s\n", version);
64 printf("GL_VENDOR = %s\n", vendor);
66 if (version[0] >= '2') {
67 printf("GL_SHADING_LANGUAGE_VERSION = %s\n", (const char *)
68 glGetString(GL_SHADING_LANGUAGE_VERSION));
71 printf("Extensions:\n");
72 if (version[0] >= '3') {
73 GLint numExt, i;
74 glGetIntegerv(GL_NUM_EXTENSIONS, &numExt);
75 for (i = 0; i < numExt; i++) {
76 printf("%s\n", (const char *)
77 glGetStringi(GL_EXTENSIONS, i));
80 else {
81 const char *ext = (const char *) glGetString(GL_EXTENSIONS);
82 const char *c = ext;
83 for (c = ext; *c; c++) {
84 if (*c == ' ')
85 putchar('\n');
86 else
87 putchar(*c);
91 piglit_report_result(PIGLIT_PASS);