gsdx egl: report an error if we fail to bind the openGL API

It seems Nvidia added openGL support in 355 (whereas I have 352 on debian).

I don't know the status on AMD.
This commit is contained in:
Gregory Hainaut 2016-10-21 17:32:56 +02:00
parent d4a163e9cc
commit 99c43881df
2 changed files with 14 additions and 3 deletions

View File

@ -56,7 +56,7 @@ void GSWndEGL::CreateContext(int major, int minor)
EGL_NONE
};
eglBindAPI(EGL_OPENGL_API);
BindAPI();
eglChooseConfig(m_eglDisplay, attrList, &eglConfig, 1, &numConfigs);
if ( numConfigs == 0 )
@ -97,9 +97,9 @@ void GSWndEGL::CreateContext(int major, int minor)
void GSWndEGL::AttachContext()
{
if (!IsContextAttached()) {
// The setting of the API is local to a thread. This function
// The setting of the API is local to a thread. This function
// can be called from 2 threads.
eglBindAPI(EGL_OPENGL_API);
BindAPI();
//fprintf(stderr, "Attach the context\n");
eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
@ -122,6 +122,16 @@ void GSWndEGL::CheckContext()
fprintf(stderr,"EGL: extensions supported: %s\n", eglQueryString(m_eglDisplay, EGL_EXTENSIONS));
}
void GSWndEGL::BindAPI()
{
eglBindAPI(EGL_OPENGL_API);
EGLenum api = eglQueryAPI();
if (api != EGL_OPENGL_API) {
fprintf(stderr,"EGL: Failed to bind the OpenGL API got 0x%x instead\n", api);
throw GSDXRecoverableError();
}
}
bool GSWndEGL::Attach(void* handle, bool managed)
{
m_NativeWindow = *(Window*)handle;

View File

@ -37,6 +37,7 @@ class GSWndEGL : public GSWndGL
void CreateContext(int major, int minor);
void CheckContext();
void BindAPI();
void OpenEGLDisplay();
void CloseEGLDisplay();