ui/sdl: get the GL context from the window
There is no guarantee to have a current GL context here. The current code seems to rely on the renderer using a GL backend, and to set a current GL context. But this is not always the case, for example if the renderer backend is DirectX. This change is enough to fix using virgl with sdl2 on win32, on my setup. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
6effaa16ac
commit
6f2688f776
|
@ -101,7 +101,7 @@ void sdl2_window_create(struct sdl2_console *scon)
|
||||||
flags);
|
flags);
|
||||||
scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);
|
scon->real_renderer = SDL_CreateRenderer(scon->real_window, -1, 0);
|
||||||
if (scon->opengl) {
|
if (scon->opengl) {
|
||||||
scon->winctx = SDL_GL_GetCurrentContext();
|
scon->winctx = SDL_GL_CreateContext(scon->real_window);
|
||||||
}
|
}
|
||||||
sdl_update_caption(scon);
|
sdl_update_caption(scon);
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,8 @@ void sdl2_window_destroy(struct sdl2_console *scon)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_GL_DeleteContext(scon->winctx);
|
||||||
|
scon->winctx = NULL;
|
||||||
SDL_DestroyRenderer(scon->real_renderer);
|
SDL_DestroyRenderer(scon->real_renderer);
|
||||||
scon->real_renderer = NULL;
|
scon->real_renderer = NULL;
|
||||||
SDL_DestroyWindow(scon->real_window);
|
SDL_DestroyWindow(scon->real_window);
|
||||||
|
|
Loading…
Reference in New Issue