Add GFX_CTL_SWAP_BUFFERS

This commit is contained in:
twinaphex 2016-02-13 08:33:33 +01:00
parent 0a7c481ff0
commit 752e9abd4e
5 changed files with 11 additions and 15 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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,