diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 8433a2e617..a6a85bf80b 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1508,7 +1508,7 @@ static bool d3d_frame(void *data, const void *frame, retro_perf_stop(&d3d_frame); - gfx_ctx_swap_buffers(); + gfx_ctx_ctl(GFX_CTL_SWAP_BUFFERS, NULL); return true; } diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 9cdf237bf6..14f5fc30f5 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1862,11 +1862,11 @@ static bool gl_frame(void *data, const void *frame, && !input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL) && !is_slowmotion && !is_paused) { - gfx_ctx_swap_buffers(); + gfx_ctx_ctl(GFX_CTL_SWAP_BUFFERS, NULL); glClear(GL_COLOR_BUFFER_BIT); } - gfx_ctx_swap_buffers(); + gfx_ctx_ctl(GFX_CTL_SWAP_BUFFERS, NULL); #ifdef HAVE_GL_SYNC if (settings->video.hard_sync && gl->have_sync) diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index a967d25f59..d89c2e67bd 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -357,7 +357,7 @@ static bool vg_frame(void *data, const void *frame, retro_perf_stop(&vg_fr); - gfx_ctx_swap_buffers(); + gfx_ctx_ctl(GFX_CTL_SWAP_BUFFERS, NULL); return true; } diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 580c0783a8..c1ac254b2d 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -135,14 +135,6 @@ bool gfx_ctx_get_video_output_next(void) return true; } -void gfx_ctx_swap_buffers(void) -{ - if (!current_video_context) - return; - if (current_video_context->swap_buffers) - current_video_context->swap_buffers(video_context_data); -} - void gfx_ctx_bind_hw_render(bool enable) { if (current_video_context->bind_hw_render) @@ -433,6 +425,11 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) { switch (state) { + case GFX_CTL_SWAP_BUFFERS: + if (!current_video_context || !current_video_context->swap_buffers) + return false; + current_video_context->swap_buffers(video_context_data); + break; case GFX_CTL_FOCUS: if (!video_context_data || !current_video_context->has_focus) return false; diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 5821461ddb..8122f62445 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -55,7 +55,8 @@ enum gfx_ctx_ctl_state { GFX_CTL_NONE = 0, GFX_CTL_FOCUS, - GFX_CTL_FREE + GFX_CTL_FREE, + GFX_CTL_SWAP_BUFFERS }; typedef void (*gfx_ctx_proc_t)(void); @@ -213,8 +214,6 @@ void gfx_ctx_translate_aspect(float *aspect, bool gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscreen); -void gfx_ctx_swap_buffers(void); - bool gfx_ctx_image_buffer_init(const video_info_t *info); bool gfx_ctx_image_buffer_write(const void *frame,