mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
Fix potential bug when HW render is used.
If e.g. D3D9 driver was used find_video_driver() would override GL driver on reinit. Avoid this by doing this logic in find_video_driver() instead.
This commit is contained in:
parent
32ac80c8e7
commit
d215ec4ea8
11
driver.c
11
driver.c
@ -196,6 +196,15 @@ static void find_audio_driver(void)
|
||||
|
||||
static void find_video_driver(void)
|
||||
{
|
||||
#if defined(HAVE_OPENGL) && defined(HAVE_FBO)
|
||||
if (g_extern.system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_LOG("Using HW render, OpenGL driver forced.\n");
|
||||
driver.video = &video_gl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(video_drivers); i++)
|
||||
{
|
||||
if (strcasecmp(g_settings.video.driver, video_drivers[i]->ident) == 0)
|
||||
@ -990,8 +999,8 @@ void init_video_input(void)
|
||||
video.rgb32 = g_extern.filter.active || (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
|
||||
|
||||
const input_driver_t *tmp = driver.input;
|
||||
#ifdef HAVE_THREADS
|
||||
find_video_driver(); // Need to grab the "real" video driver interface on a reinit.
|
||||
#ifdef HAVE_THREADS
|
||||
if (g_settings.video.threaded && !g_extern.system.hw_render_callback.context_type) // Can't do hardware rendering with threaded driver currently.
|
||||
{
|
||||
RARCH_LOG("Starting threaded video driver ...\n");
|
||||
|
@ -665,7 +665,6 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
#if defined(HAVE_OPENGLES2)
|
||||
case RETRO_HW_CONTEXT_OPENGLES2:
|
||||
RARCH_LOG("Requesting OpenGLES2 context.\n");
|
||||
driver.video = &video_gl;
|
||||
break;
|
||||
|
||||
case RETRO_HW_CONTEXT_OPENGL:
|
||||
@ -679,12 +678,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
case RETRO_HW_CONTEXT_OPENGL:
|
||||
RARCH_LOG("Requesting OpenGL context.\n");
|
||||
driver.video = &video_gl;
|
||||
break;
|
||||
|
||||
case RETRO_HW_CONTEXT_OPENGL_CORE:
|
||||
RARCH_LOG("Requesting core OpenGL context (%u.%u).\n", cb->version_major, cb->version_minor);
|
||||
driver.video = &video_gl;
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user