1/* 2 * Copyright (C) 1999-2014 Brian Paul All Rights Reserved. 3 * 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: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 */ 21 22 23/** 24 * Common code shared by glxinfo and wglinfo. 25 */ 26 27#ifndef GLINFO_COMMON_H 28#define GLINFO_COMMON_H 29 30 31#ifdef _WIN32 32/* GL/glext.h is not commonly available on Windows. */ 33#include <GL/glew.h> 34#else 35#include <GL/gl.h> 36#include <GL/glext.h> 37#endif 38 39typedef void (APIENTRY * GETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); 40typedef const GLubyte *(APIENTRY * GETSTRINGIPROC) (GLenum name, GLuint index); 41typedef void (APIENTRY * GETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); 42 43 44/** 45 * Ext functions needed in common code but must be provided by 46 * glxinfo or wglinfo. 47 */ 48struct ext_functions 49{ 50 GETPROGRAMIVARBPROC GetProgramivARB; 51 GETSTRINGIPROC GetStringi; 52 GETCONVOLUTIONPARAMETERIVPROC GetConvolutionParameteriv; 53}; 54 55 56#define ELEMENTS(array) (sizeof(array) / sizeof(array[0])) 57 58 59struct bit_info 60{ 61 int bit; 62 const char *name; 63}; 64 65 66typedef enum 67{ 68 Normal, 69 Wide, 70 Verbose, 71 Brief 72} InfoMode; 73 74 75struct options 76{ 77 InfoMode mode; 78 GLboolean findBest; 79 GLboolean limits; 80 GLboolean singleLine; 81 /* GLX only */ 82 char *displayName; 83 GLboolean allowDirect; 84}; 85 86 87/** list of known OpenGL versions */ 88static const struct { int major, minor; } gl_versions[] = { 89 {4, 6}, 90 {4, 5}, 91 {4, 4}, 92 {4, 3}, 93 {4, 2}, 94 {4, 1}, 95 {4, 0}, 96 97 {3, 3}, 98 {3, 2}, 99 {3, 1}, 100 {3, 0}, 101 102 {2, 1}, 103 {2, 0}, 104 105 {1, 5}, 106 {1, 4}, 107 {1, 3}, 108 {1, 2}, 109 {1, 1}, 110 {1, 0}, 111 112 {0, 0} /* end of list */ 113}; 114 115 116void 117print_extension_list(const char *ext, GLboolean singleLine); 118 119char * 120build_core_profile_extension_list(const struct ext_functions *extfuncs); 121 122GLboolean 123extension_supported(const char *ext, const char *extensionsList); 124 125void 126print_limits(const char *extensions, const char *oglstring, int version, 127 const struct ext_functions *extfuncs); 128 129const char * 130bitmask_to_string(const struct bit_info bits[], int numBits, int mask); 131 132const char * 133profile_mask_string(int mask); 134 135const char * 136context_flags_string(int mask); 137 138 139void 140parse_args(int argc, char *argv[], struct options *options); 141 142void 143print_gpu_memory_info(const char *glExtensions); 144 145#endif /* GLINFO_COMMON_H */ 146