mirror of
https://github.com/libretro/RetroArch
synced 2025-03-17 10:21:26 +00:00
(video driver) If we can't set flag data, do it later
Currently, there is at least one instance where video_context_driver_set_flags() is called when current_video_context.set_flags is set to NULL (see #5538). To solve this, we create 2 new global variables - one to store flag data and the other to symbolize we deferred setting flag data. This way, the next time we do get_flags(), we first check if we have anything stored first. Should fix #5538
This commit is contained in:
parent
01f8e4e74f
commit
24c1ad72ce
@ -212,6 +212,18 @@ static gfx_ctx_driver_t current_video_context;
|
||||
|
||||
static void *video_context_data = NULL;
|
||||
|
||||
/**
|
||||
* dynamic.c:dynamic_request_hw_context will try to set flag data when the context
|
||||
* is in the middle of being rebuilt; in these cases we will save flag
|
||||
* data and set this to true.
|
||||
* When the context is reinit, it checks this, reads from
|
||||
* deferred_flag_data and cleans it.
|
||||
*
|
||||
* TODO - Dirty hack, fix it better
|
||||
*/
|
||||
static bool deferred_video_context_driver_set_flags = false;
|
||||
static gfx_ctx_flags_t deferred_flag_data = {0};
|
||||
|
||||
static enum gfx_ctx_api current_video_context_api = GFX_CTX_NONE;
|
||||
|
||||
shader_backend_t *current_shader = NULL;
|
||||
@ -3005,6 +3017,14 @@ bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
|
||||
return false;
|
||||
if (!current_video_context.get_flags)
|
||||
return false;
|
||||
|
||||
if (deferred_video_context_driver_set_flags)
|
||||
{
|
||||
flags->flags = deferred_flag_data.flags;
|
||||
deferred_video_context_driver_set_flags = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
flags->flags = current_video_context.get_flags(video_context_data);
|
||||
return true;
|
||||
}
|
||||
@ -3013,8 +3033,13 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
|
||||
{
|
||||
if (!flags)
|
||||
return false;
|
||||
if (!current_video_context.set_flags)
|
||||
if (!current_video_context.set_flags)
|
||||
{
|
||||
deferred_flag_data.flags = flags->flags;
|
||||
deferred_video_context_driver_set_flags = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
current_video_context.set_flags(video_context_data, flags->flags);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user