Add support for WGL_ARB_create_context errors

This commit is contained in:
Camilla Berglund 2016-08-01 20:44:02 +02:00
parent 2c32503b10
commit 923568a279
3 changed files with 42 additions and 2 deletions

View File

@ -101,6 +101,7 @@ information on what to include when reporting a bug.
`linmath.h` (#785) `linmath.h` (#785)
- [Win32] Bugfix: The first shown window ignored the `GLFW_MAXIMIZED` hint - [Win32] Bugfix: The first shown window ignored the `GLFW_MAXIMIZED` hint
when the process was provided a `STARTUPINFO` (#780) when the process was provided a `STARTUPINFO` (#780)
- [WGL] Added reporting of errors from `WGL_ARB_create_context` extension
- [GLX] Bugfix: Dynamically loaded entry points were not verified - [GLX] Bugfix: Dynamically loaded entry points were not verified
- [EGL] Added `lib` prefix matching between EGL and OpenGL ES library binaries - [EGL] Added `lib` prefix matching between EGL and OpenGL ES library binaries
- [EGL] Bugfix: Dynamically loaded entry points were not verified - [EGL] Bugfix: Dynamically loaded entry points were not verified

View File

@ -622,9 +622,45 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
_glfw.wgl.CreateContextAttribsARB(window->context.wgl.dc, _glfw.wgl.CreateContextAttribsARB(window->context.wgl.dc,
share, attribs); share, attribs);
if (!window->context.wgl.handle) if (!window->context.wgl.handle)
{
const DWORD error = GetLastError();
if (error == (0xc0070000 | ERROR_INVALID_VERSION_ARB))
{
if (ctxconfig->client == GLFW_OPENGL_API)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Driver does not support OpenGL version %i.%i",
ctxconfig->major,
ctxconfig->minor);
}
else
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Driver does not support OpenGL ES version %i.%i",
ctxconfig->major,
ctxconfig->minor);
}
}
else if (error == (0xc0070000 | ERROR_INVALID_PROFILE_ARB))
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Driver does not support the requested OpenGL profile");
}
else
{
if (ctxconfig->client == GLFW_OPENGL_API)
{ {
_glfwInputError(GLFW_VERSION_UNAVAILABLE, _glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Failed to create OpenGL context"); "WGL: Failed to create OpenGL context");
}
else
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Failed to create OpenGL ES context");
}
}
return GLFW_FALSE; return GLFW_FALSE;
} }
} }

View File

@ -73,6 +73,9 @@
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#define ERROR_INVALID_VERSION_ARB 0x2095
#define ERROR_INVALID_PROFILE_ARB 0x2096
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int); typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);