mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
sdl: Allow OpenGL ES context creation
Signed-off-by: Elie Tournier <elie.tournier@collabora.com> Message-id: 20180413135842.21325-4-tournier.elie@gmail.com [ kraxel: fix indent ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
committed by
Gerd Hoffmann
parent
844fd50dbb
commit
4867e47cb6
19
ui/sdl2-gl.c
19
ui/sdl2-gl.c
@@ -140,12 +140,27 @@ QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl,
|
||||
SDL_GL_MakeCurrent(scon->real_window, scon->winctx);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
|
||||
SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
if (scon->opts->gl == DISPLAYGL_MODE_ON ||
|
||||
scon->opts->gl == DISPLAYGL_MODE_CORE) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
|
||||
SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
} else if (scon->opts->gl == DISPLAYGL_MODE_ES) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
|
||||
SDL_GL_CONTEXT_PROFILE_ES);
|
||||
}
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, params->major_ver);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, params->minor_ver);
|
||||
|
||||
ctx = SDL_GL_CreateContext(scon->real_window);
|
||||
|
||||
/* If SDL fail to create a GL context and we use the "on" flag,
|
||||
* then try to fallback to GLES.
|
||||
*/
|
||||
if (!ctx && scon->opts->gl == DISPLAYGL_MODE_ON) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
|
||||
SDL_GL_CONTEXT_PROFILE_ES);
|
||||
ctx = SDL_GL_CreateContext(scon->real_window);
|
||||
}
|
||||
return (QEMUGLContext)ctx;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user