Fix reinitialization of the threaded gl drivers

This commit is contained in:
Viačasłaŭ Chalikin 2024-05-26 12:47:29 +03:00 committed by LibretroAdmin
parent c4f84094c2
commit 1e9db89154
2 changed files with 10 additions and 8 deletions

View File

@ -5185,11 +5185,13 @@ static int video_texture_unload_wrap_gl2(void *data)
{
GLuint glid;
uintptr_t id = (uintptr_t)data;
#if 0
/*FIXME: crash on reinit*/
gl2_t *gl = (gl2_t*)video_driver_get_ptr();
if (gl && gl->ctx_driver->make_current)
gl->ctx_driver->make_current(false);
#endif
glid = (GLuint)id;
glDeleteTextures(1, &glid);
return 0;

View File

@ -363,7 +363,7 @@ static bool video_thread_handle_packet(
/* Never reply on no command. Possible deadlock if
* thread sends command right after frame update. */
break;
case CMD_POKE_SET_HDR_MAX_NITS:
if (thr->driver_data && thr->poke && thr->poke->set_hdr_max_nits)
thr->poke->set_hdr_max_nits(
@ -372,7 +372,7 @@ static bool video_thread_handle_packet(
);
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_SET_HDR_PAPER_WHITE_NITS:
if (thr->driver_data &&
thr->poke && thr->poke->set_hdr_paper_white_nits)
@ -382,7 +382,7 @@ static bool video_thread_handle_packet(
);
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_SET_HDR_CONTRAST:
if (thr->driver_data && thr->poke && thr->poke->set_hdr_contrast)
thr->poke->set_hdr_contrast(
@ -391,7 +391,7 @@ static bool video_thread_handle_packet(
);
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_SET_HDR_EXPAND_GAMUT:
if (thr->driver_data && thr->poke && thr->poke->set_hdr_expand_gamut)
thr->poke->set_hdr_expand_gamut(
@ -457,7 +457,7 @@ static void video_thread_loop(void *data)
video_frame_info_t video_info;
bool ret;
/* TODO/FIXME - not thread-safe - should get
/* TODO/FIXME - not thread-safe - should get
* rid of this */
video_driver_build_info(&video_info);
@ -508,7 +508,7 @@ static bool video_thread_alive(void *data)
if (!thr)
return false;
runloop_flags = runloop_get_flags();
if (runloop_flags & RUNLOOP_FLAG_PAUSED)
@ -1434,7 +1434,7 @@ unsigned video_thread_texture_handle(void *data, custom_command_method_t func)
/* if we're already on the video thread, just call the function, otherwise
* we may deadlock with ourself waiting for the packet to be processed. */
if (sthread_get_thread_id(thr->thread) == sthread_get_current_thread_id())
if (sthread_get_thread_id(thr->thread) == sthread_get_current_thread_id() || !thr->alive)
return func(data);
pkt.type = CMD_CUSTOM_COMMAND;