Go through function callback for swap_buffers as well

This commit is contained in:
twinaphex 2017-05-18 03:05:07 +02:00
parent 86ee08b7a7
commit 941a5d4f94
8 changed files with 39 additions and 34 deletions

View File

@ -1461,11 +1461,11 @@ static bool d3d_frame(void *data, const void *frame,
}
#endif
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_context_driver_swap_buffers(video_info);
video_info_>cb_swap_buffers(
video_info->context_data, video_info);
return true;
}

View File

@ -272,9 +272,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
InvalidateRect(hwnd, NULL, false);
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
return true;
}

View File

@ -1272,9 +1272,8 @@ static bool gl_frame(void *data, const void *frame,
gl_render_overlay(gl, video_info);
#endif
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
#ifdef HAVE_FBO
/* Reset state which could easily mess up libretro core. */
@ -1323,11 +1322,11 @@ static bool gl_frame(void *data, const void *frame,
&& !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused)
{
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
glClear(GL_COLOR_BUFFER_BIT);
}
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
#ifdef HAVE_GL_SYNC
if (video_info->hard_sync && gl->have_sync)

View File

@ -422,11 +422,10 @@ static bool vg_frame(void *data, const void *frame,
vg_draw_message(vg, msg);
#endif
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_context_driver_swap_buffers(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_swap_buffers(
video_info->context_data, video_info);
return true;
}

View File

@ -244,9 +244,8 @@ static bool vga_gfx_frame(void *data, const void *frame,
if (msg)
font_driver_render_msg(video_info, NULL, msg, NULL);
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
return true;
}

View File

@ -1558,7 +1558,7 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
slock_unlock(vk->context->queue_lock);
#endif
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
}
static bool vulkan_frame(void *data, const void *frame,
@ -1924,12 +1924,11 @@ static bool vulkan_frame(void *data, const void *frame,
slock_unlock(vk->context->queue_lock);
#endif
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
if (!vk->context->swap_interval_emulation_lock)
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
/* Handle spurious swapchain invalidations as soon as we can,
* i.e. right after swap buffers. */

View File

@ -2322,6 +2322,14 @@ bool video_driver_texture_unload(uintptr_t *id)
return true;
}
static void update_window_title_null(void *data, video_frame_info_t *video_info)
{
}
static void swap_buffers_null(void *data, video_frame_info_t *video_info)
{
}
void video_driver_build_info(video_frame_info_t *video_info)
{
bool is_perfcnt_enable = false;
@ -2412,11 +2420,15 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->context_data = video_context_data;
video_info->cb_update_window_title = NULL;
video_info->cb_update_window_title = update_window_title_null;
video_info->cb_swap_buffers = swap_buffers_null;
if (current_video_context)
{
if (current_video_context->update_window_title)
video_info->cb_update_window_title = current_video_context->update_window_title;
if (current_video_context->swap_buffers)
video_info->cb_swap_buffers = current_video_context->swap_buffers;
}
#ifdef HAVE_THREADS

View File

@ -76,7 +76,8 @@ typedef void (*gfx_ctx_proc_t)(void);
typedef struct video_frame_info video_frame_info_t;
typedef void (*update_window_title)(void*, video_frame_info_t *video_info);
typedef void (*update_window_title_cb)(void*, video_frame_info_t *video_info);
typedef void (*swap_buffers_cb)(void*, video_frame_info_t *video_info);
typedef struct video_info
{
@ -203,7 +204,8 @@ typedef struct video_frame_info
float xmb_alpha_factor;
char fps_text[128];
update_window_title cb_update_window_title;
update_window_title_cb cb_update_window_title;
swap_buffers_cb cb_swap_buffers;
void *context_data;
} video_frame_info_t;
@ -248,7 +250,7 @@ typedef struct gfx_ctx_driver
float (*translate_aspect)(void*, unsigned, unsigned);
/* Asks driver to update window title (FPS, etc). */
update_window_title update_window_title;
update_window_title_cb update_window_title;
/* Queries for resize and quit events.
* Also processes events. */
@ -270,7 +272,7 @@ typedef struct gfx_ctx_driver
/* Swaps buffers. VBlank sync depends on
* earlier calls to swap_interval. */
void (*swap_buffers)(void*, video_frame_info_t *video_info);
swap_buffers_cb swap_buffers;
/* Most video backends will want to use a certain input driver.
* Checks for it here. */
@ -906,10 +908,6 @@ bool video_context_driver_set(const gfx_ctx_driver_t *data);
void video_context_driver_destroy(void);
#define video_context_driver_swap_buffers(video_info) \
if (current_video_context && current_video_context->swap_buffers) \
current_video_context->swap_buffers(video_context_data, video_info)
#define video_context_driver_set_resize(mode_info) \
if (current_video_context && current_video_context->set_resize) \
current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height)