Create more gfx_ctx wrapper functions and use them

This commit is contained in:
twinaphex 2015-04-10 08:33:07 +02:00
parent 187ab80f71
commit 4cb8074bf5
4 changed files with 26 additions and 9 deletions

View File

@ -1514,7 +1514,8 @@ static bool gl_frame(void *data, const void *frame,
if (gl->should_resize)
{
gl->should_resize = false;
ctx->set_resize(gl, gl->win_width, gl->win_height);
gfx_ctx_set_resize(gl, gl->win_width, gl->win_height);
#ifdef HAVE_FBO
if (gl->fbo_inited)
@ -1816,7 +1817,7 @@ static void gl_set_nonblock_state(void *data, bool state)
RARCH_LOG("[GL]: VSync => %s\n", state ? "off" : "on");
context_bind_hw_render(gl, false);
ctx->swap_interval(gl,
gfx_ctx_swap_interval(gl,
state ? 0 : settings->video.swap_interval);
context_bind_hw_render(gl, true);
}
@ -2244,7 +2245,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
gfx_ctx_get_video_size(gl, &gl->full_x, &gl->full_y);
RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y);
ctx_driver->swap_interval(gl,
gfx_ctx_swap_interval(gl,
video->vsync ? settings->video.swap_interval : 0);
win_width = video->width;

View File

@ -67,11 +67,7 @@ static PFNVGCREATEEGLIMAGETARGETKHRPROC pvgCreateEGLImageTargetKHR;
static void vg_set_nonblock_state(void *data, bool state)
{
vg_t *vg = (vg_t*)data;
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx)
ctx->swap_interval(vg, state ? 0 : 1);
gfx_ctx_swap_interval(data, state ? 0 : 1);
}
static INLINE bool vg_query_extension(const char *ext)
@ -106,7 +102,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
gfx_ctx_get_video_size(vg, &vg->mScreenWidth, &vg->mScreenHeight);
RARCH_LOG("Detecting screen resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);
ctx->swap_interval(vg, video->vsync ? 1 : 0);
gfx_ctx_swap_interval(vg, video->vsync ? 1 : 0);
gfx_ctx_update_window_title(vg);

View File

@ -212,6 +212,22 @@ void gfx_ctx_get_video_size(void *data,
ctx->get_video_size(data, width, height);
}
void gfx_ctx_swap_interval(void *data, unsigned interval)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx)
ctx->swap_interval(data, interval);
}
void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
if (ctx)
ctx->set_resize(data, width, height);
}
/**
* find_gfx_ctx_driver_index:
* @ident : Identifier of resampler driver to find.

View File

@ -230,6 +230,10 @@ void gfx_ctx_update_window_title(void *data);
void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height);
void gfx_ctx_set_resize(void *data, unsigned width, unsigned height);
void gfx_ctx_swap_interval(void *data, unsigned interval);
void gfx_ctx_free(void *data);
retro_proc_address_t gfx_ctx_get_proc_address(const char *sym);