Remove unnecessary video_driver_is_cache_context

This commit is contained in:
LibretroAdmin 2022-10-28 19:36:56 +02:00
parent 2ec2f4719f
commit 174b01f7d9
7 changed files with 32 additions and 28 deletions

View File

@ -2523,6 +2523,7 @@ void vulkan_present(gfx_ctx_vulkan_data_t *vk, unsigned index)
void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
bool destroy_surface)
{
uint32_t video_st_flags = 0;
if (!vk->context.instance)
return;
@ -2543,7 +2544,9 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
vkDestroyDebugUtilsMessengerEXT(vk->context.instance, vk->context.debug_callback, NULL);
#endif
if (video_driver_is_video_cache_context())
video_st_flags = video_driver_get_st_flags();
if (video_st_flags & VIDEO_FLAG_CACHE_CONTEXT)
{
cached_device_vk = vk->context.device;
cached_instance_vk = vk->context.instance;

View File

@ -554,7 +554,10 @@ error:
static void d3d10_gfx_free(void* data)
{
unsigned i;
int i;
#if 0
uint32_t video_st_flags;
#endif
d3d10_video_t* d3d10 = (d3d10_video_t*)data;
if (!d3d10)
@ -601,10 +604,11 @@ static void d3d10_gfx_free(void* data)
font_driver_free_osd();
#if 0
if (video_driver_is_video_cache_context())
video_st_flags = video_driver_get_st_flags();
if (video_st_flags & VIDEO_FLAG_CACHE_CONTEXT)
{
cached_device_d3d10 = d3d10->device;
cached_context = d3d10->context;
cached_context = d3d10->context;
}
else
#endif

View File

@ -751,7 +751,8 @@ error:
static void d3d11_gfx_free(void* data)
{
unsigned i;
int i;
uint32_t video_st_flags;
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
if (!d3d11)
@ -805,7 +806,8 @@ static void d3d11_gfx_free(void* data)
font_driver_free_osd();
if (video_driver_is_video_cache_context())
video_st_flags = video_driver_get_st_flags();
if (video_st_flags & VIDEO_FLAG_CACHE_CONTEXT)
{
cached_device_d3d11 = d3d11->device;
cached_context_d3d11 = d3d11->context;

View File

@ -544,10 +544,12 @@ static void gfx_ctx_wgl_destroy(void *data)
#if (defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)) && !defined(HAVE_OPENGLES)
if (win32_hrc)
{
uint32_t video_st_flags;
gl_finish();
wglMakeCurrent(NULL, NULL);
if (!video_driver_is_video_cache_context())
video_st_flags = video_driver_get_st_flags();
if (!(video_st_flags & VIDEO_FLAG_CACHE_CONTEXT))
{
if (win32_hw_hrc)
wglDeleteContext(win32_hw_hrc);

View File

@ -174,11 +174,13 @@ static void gfx_ctx_x_destroy_resources(gfx_ctx_x_data_t *x)
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)
if (x->ctx)
{
uint32_t video_st_flags;
glXSwapBuffers(g_x11_dpy, x->glx_win);
gl_finish();
glXMakeContextCurrent(g_x11_dpy, None, None, NULL);
if (!video_driver_is_video_cache_context())
video_st_flags = video_driver_get_st_flags();
if (!(video_st->flags & VIDEO_FLAG_CACHE_CONTEXT))
{
if (x->hw_ctx)
glXDestroyContext(g_x11_dpy, x->hw_ctx);

View File

@ -1510,7 +1510,7 @@ VIDEO_DRIVER_IS_THREADED_INTERNAL(video_st);
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
if (!video_driver_is_video_cache_context())
if (!(video_st->flags & VIDEO_FLAG_CACHE_CONTEXT))
video_driver_free_hw_context();
if (!(input_st->current_data == video_st->data))
@ -2457,12 +2457,6 @@ const struct retro_hw_render_context_negotiation_interface *
return video_st->hw_render_context_negotiation;
}
bool video_driver_is_video_cache_context(void)
{
video_driver_state_t *video_st = &video_driver_st;
return ((video_st->flags & VIDEO_FLAG_CACHE_CONTEXT) > 0);
}
void video_driver_set_video_cache_context_ack(void)
{
video_driver_state_t *video_st = &video_driver_st;
@ -3042,14 +3036,7 @@ bool video_context_driver_get_refresh_rate(float *refresh_rate)
if (!video_st->context_data)
return false;
if (!(video_st->flags & VIDEO_FLAG_CRT_SWITCHING_ACTIVE))
{
if (refresh_rate)
*refresh_rate =
video_st->current_video_context.get_refresh_rate(
video_st->context_data);
}
else
if (video_st->flags & VIDEO_FLAG_CRT_SWITCHING_ACTIVE)
{
float refresh_holder = 0;
if (refresh_rate)
@ -3062,6 +3049,13 @@ bool video_context_driver_get_refresh_rate(float *refresh_rate)
if (refresh_holder != video_st->core_hz)
*refresh_rate = video_st->core_hz;
}
else
{
if (refresh_rate)
*refresh_rate =
video_st->current_video_context.get_refresh_rate(
video_st->context_data);
}
return true;
}
@ -3083,8 +3077,7 @@ bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
if (video_st->flags & VIDEO_FLAG_DEFERRED_VIDEO_CTX_DRIVER_SET_FLAGS)
{
flags->flags =
video_st->deferred_flag_data.flags;
flags->flags = video_st->deferred_flag_data.flags;
video_st->flags &= ~VIDEO_FLAG_DEFERRED_VIDEO_CTX_DRIVER_SET_FLAGS;
return true;
}
@ -3149,7 +3142,7 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
return true;
}
video_st->deferred_flag_data.flags = flags->flags;
video_st->deferred_flag_data.flags = flags->flags;
video_st->flags |= VIDEO_FLAG_DEFERRED_VIDEO_CTX_DRIVER_SET_FLAGS;
return false;
}

View File

@ -1028,8 +1028,6 @@ struct retro_hw_render_callback *video_driver_get_hw_context(void);
const struct retro_hw_render_context_negotiation_interface
*video_driver_get_context_negotiation_interface(void);
bool video_driver_is_video_cache_context(void);
void video_driver_set_video_cache_context_ack(void);
bool video_driver_get_viewport_info(struct video_viewport *viewport);