From 416363e9fdb1de82ff5588d8c23708c13a6ec1b2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 2 Aug 2020 18:49:31 +0200 Subject: [PATCH] Cleanups --- gfx/drivers/gl1.c | 6 ++++-- gfx/drivers/gl_core.c | 6 ++++-- gfx/drivers/vg.c | 3 ++- gfx/drivers/vulkan.c | 6 ++++-- retroarch.c | 12 ++---------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 0548148392..ad588852e1 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -897,12 +897,14 @@ static bool gl1_gfx_frame(void *data, const void *frame, && !video_info->runloop_is_slowmotion && !video_info->runloop_is_paused) { - gl1->ctx_driver->swap_buffers(gl1->ctx_data); + if (gl1->ctx_driver->swap_buffers) + gl1->ctx_driver->swap_buffers(gl1->ctx_data); glClear(GL_COLOR_BUFFER_BIT); } #endif - gl1->ctx_driver->swap_buffers(gl1->ctx_data); + if (gl1->ctx_driver->swap_buffers) + gl1->ctx_driver->swap_buffers(gl1->ctx_data); /* check if we are fast forwarding or in menu, if we are ignore hard sync */ if (video_info->hard_sync diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index 16535b08b8..a2aa2756ae 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -1982,11 +1982,13 @@ static bool gl_core_frame(void *data, const void *frame, && !runloop_is_slowmotion && !runloop_is_paused) { - gl->ctx_driver->swap_buffers(gl->ctx_data); + if (gl->ctx_driver->swap_buffers) + gl->ctx_driver->swap_buffers(gl->ctx_data); glClear(GL_COLOR_BUFFER_BIT); } - gl->ctx_driver->swap_buffers(gl->ctx_data); + if (gl->ctx_driver->swap_buffers) + gl->ctx_driver->swap_buffers(gl->ctx_data); if (video_info->hard_sync && !input_driver_nonblock_state && diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 6d8625772a..689bd36e6c 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -451,7 +451,8 @@ static bool vg_frame(void *data, const void *frame, if (vg->ctx_driver->update_window_title) vg->ctx_driver->update_window_title(vg->ctx_data); - vg->ctx_driver->swap_buffers(vg->ctx_data); + if (vg->ctx_driver->swap_buffers) + vg->ctx_driver->swap_buffers(vg->ctx_data); return true; } diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 6a6939d724..07ac8238f9 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1695,7 +1695,8 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info, slock_unlock(vk->context->queue_lock); #endif - vk->ctx_driver->swap_buffers(context_data); + if (vk->ctx_driver->swap_buffers) + vk->ctx_driver->swap_buffers(context_data); } static bool vulkan_frame(void *data, const void *frame, @@ -2221,7 +2222,8 @@ static bool vulkan_frame(void *data, const void *frame, slock_unlock(vk->context->queue_lock); #endif - vk->ctx_driver->swap_buffers(vk->ctx_data); + if (vk->ctx_driver->swap_buffers) + vk->ctx_driver->swap_buffers(vk->ctx_data); if (!vk->context->swap_interval_emulation_lock) { diff --git a/retroarch.c b/retroarch.c index 89d12acca6..d71f98752d 100644 --- a/retroarch.c +++ b/retroarch.c @@ -30784,8 +30784,6 @@ bool video_driver_started_fullscreen(void) /* Stub functions */ -static void update_window_title_null(void *data) { } -static void swap_buffers_null(void *data) { } static bool get_metrics_null(void *data, enum display_metric_types type, float *value) { return false; } static bool set_resize_null(void *a, unsigned b, unsigned c) { return false; } @@ -30894,14 +30892,8 @@ static void video_context_driver_reset(void) if (!p_rarch->current_video_context.get_metrics) p_rarch->current_video_context.get_metrics = get_metrics_null; - if (!p_rarch->current_video_context.update_window_title) - p_rarch->current_video_context.update_window_title = update_window_title_null; - if (!p_rarch->current_video_context.set_resize) p_rarch->current_video_context.set_resize = set_resize_null; - - if (!p_rarch->current_video_context.swap_buffers) - p_rarch->current_video_context.swap_buffers = swap_buffers_null; } bool video_context_driver_set(const gfx_ctx_driver_t *data) @@ -30929,11 +30921,11 @@ void video_context_driver_destroy(void) p_rarch->current_video_context.get_video_output_next = NULL; p_rarch->current_video_context.get_metrics = get_metrics_null; p_rarch->current_video_context.translate_aspect = NULL; - p_rarch->current_video_context.update_window_title = update_window_title_null; + p_rarch->current_video_context.update_window_title = NULL; p_rarch->current_video_context.check_window = NULL; p_rarch->current_video_context.set_resize = set_resize_null; p_rarch->current_video_context.suppress_screensaver = NULL; - p_rarch->current_video_context.swap_buffers = swap_buffers_null; + p_rarch->current_video_context.swap_buffers = NULL; p_rarch->current_video_context.input_driver = NULL; p_rarch->current_video_context.get_proc_address = NULL; p_rarch->current_video_context.image_buffer_init = NULL;