Skip to content

Commit 1e9db89

Browse files
viachaslavicLibretroAdmin
authored andcommitted
Fix reinitialization of the threaded gl drivers
1 parent c4f8409 commit 1e9db89

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

gfx/drivers/gl2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5185,11 +5185,13 @@ static int video_texture_unload_wrap_gl2(void *data)
51855185
{
51865186
GLuint glid;
51875187
uintptr_t id = (uintptr_t)data;
5188+
#if 0
5189+
/*FIXME: crash on reinit*/
51885190
gl2_t *gl = (gl2_t*)video_driver_get_ptr();
51895191

51905192
if (gl && gl->ctx_driver->make_current)
51915193
gl->ctx_driver->make_current(false);
5192-
5194+
#endif
51935195
glid = (GLuint)id;
51945196
glDeleteTextures(1, &glid);
51955197
return 0;

gfx/video_thread_wrapper.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static bool video_thread_handle_packet(
363363
/* Never reply on no command. Possible deadlock if
364364
* thread sends command right after frame update. */
365365
break;
366-
366+
367367
case CMD_POKE_SET_HDR_MAX_NITS:
368368
if (thr->driver_data && thr->poke && thr->poke->set_hdr_max_nits)
369369
thr->poke->set_hdr_max_nits(
@@ -372,7 +372,7 @@ static bool video_thread_handle_packet(
372372
);
373373
video_thread_reply(thr, &pkt);
374374
break;
375-
375+
376376
case CMD_POKE_SET_HDR_PAPER_WHITE_NITS:
377377
if (thr->driver_data &&
378378
thr->poke && thr->poke->set_hdr_paper_white_nits)
@@ -382,7 +382,7 @@ static bool video_thread_handle_packet(
382382
);
383383
video_thread_reply(thr, &pkt);
384384
break;
385-
385+
386386
case CMD_POKE_SET_HDR_CONTRAST:
387387
if (thr->driver_data && thr->poke && thr->poke->set_hdr_contrast)
388388
thr->poke->set_hdr_contrast(
@@ -391,7 +391,7 @@ static bool video_thread_handle_packet(
391391
);
392392
video_thread_reply(thr, &pkt);
393393
break;
394-
394+
395395
case CMD_POKE_SET_HDR_EXPAND_GAMUT:
396396
if (thr->driver_data && thr->poke && thr->poke->set_hdr_expand_gamut)
397397
thr->poke->set_hdr_expand_gamut(
@@ -457,7 +457,7 @@ static void video_thread_loop(void *data)
457457
video_frame_info_t video_info;
458458
bool ret;
459459

460-
/* TODO/FIXME - not thread-safe - should get
460+
/* TODO/FIXME - not thread-safe - should get
461461
* rid of this */
462462
video_driver_build_info(&video_info);
463463

@@ -508,7 +508,7 @@ static bool video_thread_alive(void *data)
508508

509509
if (!thr)
510510
return false;
511-
511+
512512
runloop_flags = runloop_get_flags();
513513

514514
if (runloop_flags & RUNLOOP_FLAG_PAUSED)
@@ -1434,7 +1434,7 @@ unsigned video_thread_texture_handle(void *data, custom_command_method_t func)
14341434

14351435
/* if we're already on the video thread, just call the function, otherwise
14361436
* we may deadlock with ourself waiting for the packet to be processed. */
1437-
if (sthread_get_thread_id(thr->thread) == sthread_get_current_thread_id())
1437+
if (sthread_get_thread_id(thr->thread) == sthread_get_current_thread_id() || !thr->alive)
14381438
return func(data);
14391439

14401440
pkt.type = CMD_CUSTOM_COMMAND;

0 commit comments

Comments
 (0)