26 #define VK_NO_PROTOTYPES 28 #include <glad/glad.h> 38 #define strcasecmp(x, y) _stricmp(x, y) 41 #define API_NAME_OPENGL "gl" 42 #define API_NAME_OPENGL_ES "es" 44 #define API_NAME_NATIVE "native" 45 #define API_NAME_EGL "egl" 46 #define API_NAME_OSMESA "osmesa" 48 #define PROFILE_NAME_CORE "core" 49 #define PROFILE_NAME_COMPAT "compat" 51 #define STRATEGY_NAME_NONE "none" 52 #define STRATEGY_NAME_LOSE "lose" 54 #define BEHAVIOR_NAME_NONE "none" 55 #define BEHAVIOR_NAME_FLUSH "flush" 59 printf(
"Usage: glfwinfo [OPTION]...\n");
61 printf(
" -a, --client-api=API the client API to use (" 64 printf(
" -b, --behavior=BEHAVIOR the release behavior to use (" 67 printf(
" -c, --context-api=API the context creation API to use (" 71 printf(
" -d, --debug request a debug context\n");
72 printf(
" -f, --forward require a forward-compatible context\n");
73 printf(
" -h, --help show this help\n");
74 printf(
" -l, --list-extensions list all Vulkan and client API extensions\n");
75 printf(
" --list-layers list all Vulkan layers\n");
76 printf(
" -m, --major=MAJOR the major number of the required " 77 "client API version\n");
78 printf(
" -n, --minor=MINOR the minor number of the required " 79 "client API version\n");
80 printf(
" -p, --profile=PROFILE the OpenGL profile to use (" 83 printf(
" -s, --robustness=STRATEGY the robustness strategy to use (" 86 printf(
" -v, --version print version information\n");
87 printf(
" --red-bits=N the number of red bits to request\n");
88 printf(
" --green-bits=N the number of green bits to request\n");
89 printf(
" --blue-bits=N the number of blue bits to request\n");
90 printf(
" --alpha-bits=N the number of alpha bits to request\n");
91 printf(
" --depth-bits=N the number of depth bits to request\n");
92 printf(
" --stencil-bits=N the number of stencil bits to request\n");
93 printf(
" --accum-red-bits=N the number of red bits to request\n");
94 printf(
" --accum-green-bits=N the number of green bits to request\n");
95 printf(
" --accum-blue-bits=N the number of blue bits to request\n");
96 printf(
" --accum-alpha-bits=N the number of alpha bits to request\n");
97 printf(
" --aux-buffers=N the number of aux buffers to request\n");
98 printf(
" --samples=N the number of MSAA samples to request\n");
99 printf(
" --stereo request stereo rendering\n");
100 printf(
" --srgb request an sRGB capable framebuffer\n");
101 printf(
" --singlebuffer request single-buffering\n");
102 printf(
" --no-error request a context that does not emit errors\n");
107 fprintf(stderr,
"Error: %s\n", description);
115 return "integrated GPU";
117 return "discrete GPU";
119 return "virtual GPU";
133 return "Unknown API";
182 printf(
"%s context extensions:\n",
get_api_name(client));
188 for (i = 0; i <
count; i++)
194 while (*extensions !=
'\0')
198 while (*extensions !=
'\0' && *extensions !=
' ')
200 putchar(*extensions);
204 while (*extensions ==
' ')
220 printf(
"Vulkan instance extensions:\n");
233 for (i = 0; i < ep_count; i++)
234 printf(
" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
247 printf(
"Vulkan instance layers:\n");
260 for (i = 0; i < lp_count; i++)
262 printf(
" %s (v%u) \"%s\"\n",
264 lp[i].specVersion >> 22,
279 printf(
"Vulkan device extensions:\n");
292 for (i = 0; i < ep_count; i++)
293 printf(
" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
306 printf(
"Vulkan device layers:\n");
319 for (i = 0; i < lp_count; i++)
321 printf(
" %s (v%u) \"%s\"\n",
323 lp[i].specVersion >> 22,
337 printf(
"*** ERROR: GLFW major version mismatch! ***\n");
342 printf(
"*** WARNING: GLFW version mismatch! ***\n");
352 printf(
"GLFW header version: %u.%u.%u\n",
356 printf(
"GLFW library version: %u.%u.%u\n", major, minor, revision);
360 int main(
int argc,
char** argv)
363 GLint redbits, greenbits, bluebits, alphabits, depthbits, stencilbits;
368 enum { CLIENT, CONTEXT, BEHAVIOR,
DEBUG, FORWARD, HELP, EXTENSIONS, LAYERS,
369 MAJOR, MINOR, PROFILE, ROBUSTNESS,
VERSION,
370 REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS,
371 ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS,
372 AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY };
373 const struct option options[] =
375 {
"behavior", 1,
NULL, BEHAVIOR },
376 {
"client-api", 1,
NULL, CLIENT },
377 {
"context-api", 1,
NULL, CONTEXT },
379 {
"forward", 0,
NULL, FORWARD },
380 {
"help", 0,
NULL, HELP },
381 {
"list-extensions", 0,
NULL, EXTENSIONS },
382 {
"list-layers", 0,
NULL, LAYERS },
383 {
"major", 1,
NULL, MAJOR },
384 {
"minor", 1,
NULL, MINOR },
385 {
"profile", 1,
NULL, PROFILE },
386 {
"robustness", 1,
NULL, ROBUSTNESS },
388 {
"red-bits", 1,
NULL, REDBITS },
389 {
"green-bits", 1,
NULL, GREENBITS },
390 {
"blue-bits", 1,
NULL, BLUEBITS },
391 {
"alpha-bits", 1,
NULL, ALPHABITS },
392 {
"depth-bits", 1,
NULL, DEPTHBITS },
393 {
"stencil-bits", 1,
NULL, STENCILBITS },
394 {
"accum-red-bits", 1,
NULL, ACCUMREDBITS },
395 {
"accum-green-bits", 1,
NULL, ACCUMGREENBITS },
396 {
"accum-blue-bits", 1,
NULL, ACCUMBLUEBITS },
397 {
"accum-alpha-bits", 1,
NULL, ACCUMALPHABITS },
398 {
"aux-buffers", 1,
NULL, AUXBUFFERS },
399 {
"samples", 1,
NULL, SAMPLES },
400 {
"stereo", 0,
NULL, STEREO },
401 {
"srgb", 0,
NULL, SRGB },
402 {
"singlebuffer", 0,
NULL, SINGLEBUFFER },
403 {
"no-error", 0,
NULL, NOERROR_SRSLY },
419 while ((ch =
getopt_long(argc, argv,
"a:b:c:dfhlm:n:p:s:v", options,
NULL)) != -1)
535 if (strcmp(
optarg,
"-") == 0)
541 if (strcmp(
optarg,
"-") == 0)
547 if (strcmp(
optarg,
"-") == 0)
553 if (strcmp(
optarg,
"-") == 0)
559 if (strcmp(
optarg,
"-") == 0)
565 if (strcmp(
optarg,
"-") == 0)
571 if (strcmp(
optarg,
"-") == 0)
577 if (strcmp(
optarg,
"-") == 0)
583 if (strcmp(
optarg,
"-") == 0)
589 if (strcmp(
optarg,
"-") == 0)
595 if (strcmp(
optarg,
"-") == 0)
601 if (strcmp(
optarg,
"-") == 0)
640 printf(
"*** OpenGL error after make current: 0x%08x ***\n", error);
650 printf(
"%s context version string: \"%s\"\n",
654 printf(
"%s context version parsed by GLFW: %u.%u.%u\n",
656 major, minor, revision);
667 printf(
"%s context flags (0x%08x):",
get_api_name(client), flags);
670 printf(
" forward-compatible");
674 printf(
" robustness");
679 printf(
"%s context flags parsed by GLFW:",
get_api_name(client));
682 printf(
" forward-compatible");
686 printf(
" robustness");
692 if (major >= 4 || (major == 3 && minor >= 2))
697 printf(
"%s profile mask (0x%08x): %s\n",
702 printf(
"%s profile mask parsed by GLFW: %s\n",
713 printf(
"%s robustness strategy (0x%08x): %s\n",
718 printf(
"%s robustness strategy parsed by GLFW: %s\n",
724 printf(
"%s context renderer string: \"%s\"\n",
727 printf(
"%s context vendor string: \"%s\"\n",
733 printf(
"%s context shading language version: \"%s\"\n",
777 printf(
" red: %u green: %u blue: %u alpha: %u depth: %u stencil: %u\n",
778 redbits, greenbits, bluebits, alphabits, depthbits, stencilbits);
782 major > 1 || minor >= 3)
788 printf(
" samples: %u sample buffers: %u\n", samples, samplebuffers);
793 GLint accumredbits, accumgreenbits, accumbluebits, accumalphabits;
802 printf(
" accum red: %u accum green: %u accum blue: %u accum alpha: %u aux buffers: %u\n",
803 accumredbits, accumgreenbits, accumbluebits, accumalphabits, auxbuffers);
809 printf(
"Vulkan loader: %s\n",
828 printf(
"Vulkan required instance extensions:");
831 for (i = 0; i < re_count; i++)
832 printf(
" %s", re[i]);
836 printf(
" missing\n");
886 for (i = 0; i < pd_count; i++)
892 printf(
"Vulkan %s device: \"%s\"\n",
#define GLFW_CONTEXT_RELEASE_BEHAVIOR
Context flush-on-release hint and attribute.
#define GL_CONTEXT_PROFILE_MASK
static void error_callback(int error, const char *description)
#define GLFW_OPENGL_ES_API
static const char * get_strategy_name_glfw(int strategy)
#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE
VkResult(VKAPI_PTR * PFN_vkCreateInstance)(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance)
#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE
VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance)
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
#define VK_API_VERSION_1_0
uint32_t applicationVersion
#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE
VkPhysicalDeviceType deviceType
GLFWAPI int glfwGetWindowAttrib(GLFWwindow *window, int attrib)
Returns an attribute of the specified window.
GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char *procname)
The header of the GLFW 3 API.
#define GLFW_CONTEXT_ROBUSTNESS
Context robustness hint and attribute.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
#define BEHAVIOR_NAME_NONE
#define GLFW_OPENGL_COMPAT_PROFILE
void *(* GLADloadproc)(const char *name)
static GLFWwindow * window
#define GLFW_OPENGL_FORWARD_COMPAT
OpenGL forward-compatibility hint and attribute.
GLFWAPI int glfwVulkanSupported(void)
Returns whether the Vulkan loader and an ICD have been found.
static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device)
#define GLFW_ACCUM_GREEN_BITS
Framebuffer bit depth hint.
#define GLFW_CONTEXT_VERSION_MAJOR
Context client API major version hint and attribute.
static const char * get_profile_name_gl(GLint mask)
#define GLFW_COCOA_MENUBAR
macOS specific init hint.
static const char * get_device_type_name(VkPhysicalDeviceType type)
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
GLAPI int GLAD_GL_ARB_multisample
void(VKAPI_PTR * PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks *pAllocator)
#define GL_ACCUM_BLUE_BITS
#define GLFW_LOSE_CONTEXT_ON_RESET
#define GLFW_EGL_CONTEXT_API
#define GLFW_OPENGL_PROFILE
OpenGL profile hint and attribute.
#define glGetFramebufferAttachmentParameteriv
#define GLFW_RELEASE_BEHAVIOR_NONE
VkResult(VKAPI_PTR * PFN_vkEnumerateInstanceLayerProperties)(uint32_t *pPropertyCount, VkLayerProperties *pProperties)
VkResult(VKAPI_PTR * PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
#define BEHAVIOR_NAME_FLUSH
#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB
#define API_NAME_OPENGL_ES
#define GLFW_CONTEXT_CREATION_API
Context creation API hint and attribute.
#define GL_SAMPLE_BUFFERS
#define GLFW_OPENGL_DEBUG_CONTEXT
OpenGL debug context hint and attribute.
#define GL_ACCUM_ALPHA_BITS
const char *const * ppEnabledExtensionNames
#define GL_ACCUM_GREEN_BITS
static const std::string VERSION
static void list_context_extensions(int client, int major, int minor)
uint32_t enabledExtensionCount
static const char * get_profile_name_glfw(int profile)
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
#define GL_SHADING_LANGUAGE_VERSION
#define GLFW_RED_BITS
Framebuffer bit depth hint.
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]
static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice device)
#define GLFW_ALPHA_BITS
Framebuffer bit depth hint.
#define STRATEGY_NAME_NONE
#define GL_LOSE_CONTEXT_ON_RESET_ARB
#define GLFW_NATIVE_CONTEXT_API
#define GLFW_CONTEXT_NO_ERROR
Context error suppression hint and attribute.
#define GLFW_STENCIL_BITS
Framebuffer bit depth hint.
VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices)
static void print_version(void)
#define PROFILE_NAME_COMPAT
GLFWAPI const char * glfwGetVersionString(void)
Returns a string describing the compile-time configuration.
#define GL_CONTEXT_CORE_PROFILE_BIT
#define GLFW_ACCUM_ALPHA_BITS
Framebuffer bit depth hint.
GLFWAPI void glfwGetVersion(int *major, int *minor, int *rev)
Retrieves the version of the GLFW library.
const VkApplicationInfo * pApplicationInfo
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties)
#define PROFILE_NAME_CORE
#define GL_NO_RESET_NOTIFICATION_ARB
VkResult(VKAPI_PTR * PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices)
static void list_vulkan_instance_extensions(void)
#define GLFW_OSMESA_CONTEXT_API
#define GLFW_AUX_BUFFERS
Framebuffer auxiliary buffer hint.
#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE
#define GLFW_ACCUM_RED_BITS
Framebuffer bit depth hint.
#define GLFW_GREEN_BITS
Framebuffer bit depth hint.
VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties)
void(VKAPI_PTR * PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
GLAPI int gladLoadGLLoader(GLADloadproc)
#define GLFW_RELEASE_BEHAVIOR_FLUSH
static const textual_icon exit
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
static void list_vulkan_instance_layers(void)
#define STRATEGY_NAME_LOSE
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define GLFW_STEREO
OpenGL stereoscopic rendering hint.
const char * pApplicationName
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE
#define GLFW_DOUBLEBUFFER
Framebuffer double buffering hint.
#define GLFW_SRGB_CAPABLE
Framebuffer sRGB hint.
int main(int argc, char **argv)
static const char * get_strategy_name_gl(GLint strategy)
VkResult(VKAPI_PTR * PFN_vkEnumerateInstanceExtensionProperties)(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
#define GLFW_VERSION_REVISION
The revision number of the GLFW library.
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT
#define GLFW_CONTEXT_REVISION
Context client API revision number hint and attribute.
#define GLFW_OPENGL_CORE_PROFILE
#define GLFW_VERSION_MINOR
The minor version number of the GLFW library.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
VkResult(VKAPI_PTR * PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties)
#define GL_ACCUM_RED_BITS
#define GLFW_VISIBLE
Window visibility window hint and attribute.
#define GLFW_SAMPLES
Framebuffer MSAA samples hint.
#define GL_RESET_NOTIFICATION_STRATEGY_ARB
GLAPI int GLAD_GL_ARB_robustness
#define GLFW_VERSION_MAJOR
The major version number of the GLFW library.
#define GLFW_ACCUM_BLUE_BITS
Framebuffer bit depth hint.
#define GLFW_BLUE_BITS
Framebuffer bit depth hint.
VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)
GLFWAPI const char ** glfwGetRequiredInstanceExtensions(uint32_t *count)
Returns the Vulkan instance extensions required by GLFW.
static int valid_version(void)
#define GLFW_CONTEXT_VERSION_MINOR
Context client API minor version hint and attribute.
#define GL_NUM_EXTENSIONS
#define GLFW_NO_RESET_NOTIFICATION
static const char * get_api_name(int api)
struct GLFWwindow GLFWwindow
GLFWAPI void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
#define GLFW_CLIENT_API
Context client API hint and attribute.
#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE
#define GLFW_DEPTH_BITS
Framebuffer bit depth hint.
GLFWAPI void glfwInitHint(int hint, int value)
Sets the specified init hint to the desired value.