mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
sdl2: Fix GL3 context creation
The check to verify whether we've got the right GL context was checking that the GL version was less than 3 whenever the non-GL3 driver is used. However it looks like the driver is free to return a GL3 context that is compatible with GL2 if GL2 is requested so this was breaking the GL2 driver. This also adds the necessary SDL attributes to request a forward compatible core context like the GLX and EGL winsys's do. I haven't actually tested this because it looks like SDL will only create a GL context with GLX and I haven't got a recent enough X server to handle the glXCreateContextAttribs request. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit d46acafa3ea7ba2e6c4ac7a45f00a132df1b2872)
This commit is contained in:
parent
8039c2c779
commit
76843fc529
@ -159,7 +159,13 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
else if (display->renderer->driver == COGL_DRIVER_GLES2)
|
else if (display->renderer->driver == COGL_DRIVER_GLES2)
|
||||||
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||||
else if (display->renderer->driver == COGL_DRIVER_GL3)
|
else if (display->renderer->driver == COGL_DRIVER_GL3)
|
||||||
|
{
|
||||||
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
|
SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK,
|
||||||
|
SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
|
SDL_GL_SetAttribute (SDL_GL_CONTEXT_FLAGS,
|
||||||
|
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a dummy 1x1 window that never gets display so that we can
|
/* Create a dummy 1x1 window that never gets display so that we can
|
||||||
* create a GL context */
|
* create a GL context */
|
||||||
@ -209,20 +215,8 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_version[0] >= '3')
|
if (display->renderer->driver == COGL_DRIVER_GL3 &&
|
||||||
{
|
gl_version[0] < '3')
|
||||||
if (display->renderer->driver == COGL_DRIVER_GL)
|
|
||||||
{
|
|
||||||
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
|
||||||
COGL_WINSYS_ERROR_INIT,
|
|
||||||
"The GL driver was requested but SDL is using "
|
|
||||||
"GL %c", gl_version[0]);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (display->renderer->driver == COGL_DRIVER_GL3)
|
|
||||||
{
|
{
|
||||||
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||||
COGL_WINSYS_ERROR_INIT,
|
COGL_WINSYS_ERROR_INIT,
|
||||||
@ -230,7 +224,6 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||||||
"GL %c", gl_version[0]);
|
"GL %c", gl_version[0]);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COGL_DRIVER_GLES2:
|
case COGL_DRIVER_GLES2:
|
||||||
|
Loading…
Reference in New Issue
Block a user