Remove gfx_ctx_destroy

This commit is contained in:
twinaphex 2016-02-13 16:33:38 +01:00
parent ef1b0b0965
commit 425a290ced
5 changed files with 11 additions and 23 deletions

View File

@ -1138,7 +1138,7 @@ static void *d3d_init(const video_info_t *info,
return d3d;
error:
gfx_ctx_destroy(ctx_driver);
gfx_ctx_ctl(GFX_CTL_DESTROY, NULL);
if (d3d)
delete d3d;
return NULL;

View File

@ -2454,18 +2454,14 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
{
unsigned win_width, win_height, temp_width = 0, temp_height = 0;
bool force_smooth = false;
const gfx_ctx_driver_t *ctx_driver = NULL;
const char *vendor = NULL;
const char *renderer = NULL;
const char *version = NULL;
struct retro_hw_render_callback *hw_render = NULL;
settings_t *settings = config_get_ptr();
gl_t *gl = (gl_t*)calloc(1, sizeof(gl_t));
if (!gl)
return NULL;
ctx_driver = gl_get_context(gl);
if (!ctx_driver)
const gfx_ctx_driver_t *ctx_driver = gl_get_context(gl);
if (!gl || !ctx_driver)
goto error;
gfx_ctx_set(ctx_driver);
@ -2672,7 +2668,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
return gl;
error:
gfx_ctx_destroy(ctx_driver);
gfx_ctx_ctl(GFX_CTL_DESTROY, NULL);
free(gl);
return NULL;
}

View File

@ -87,16 +87,11 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
unsigned temp_width = 0, temp_height = 0;
VGfloat clearColor[4] = {0, 0, 0, 1};
settings_t *settings = config_get_ptr();
const gfx_ctx_driver_t *ctx = NULL;
vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
if (!vg)
goto error;
ctx = gfx_ctx_init_first(vg, settings->video.context_driver,
const gfx_ctx_driver_t *ctx = gfx_ctx_init_first(vg, settings->video.context_driver,
GFX_CTX_OPENVG_API, 0, 0, false);
if (!ctx)
if (!vg || !ctx)
goto error;
gfx_ctx_set(ctx);
@ -199,7 +194,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
error:
if (vg)
free(vg);
gfx_ctx_destroy(ctx);
gfx_ctx_ctl(GFX_CTL_DESTROY, NULL);
return NULL;
}

View File

@ -90,11 +90,6 @@ void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver)
current_video_context = ctx_driver;
}
void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver)
{
current_video_context = NULL;
}
const char *gfx_ctx_get_ident(void)
{
const gfx_ctx_driver_t *ctx = current_video_context;
@ -412,6 +407,9 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
{
switch (state)
{
case GFX_CTL_DESTROY:
current_video_context = NULL;
break;
case GFX_CTL_UPDATE_WINDOW_TITLE:
if (!current_video_context || !current_video_context->update_window_title)
return false;

View File

@ -55,6 +55,7 @@ enum gfx_ctx_ctl_state
{
GFX_CTL_NONE = 0,
GFX_CTL_FOCUS,
GFX_CTL_DESTROY,
GFX_CTL_FREE,
GFX_CTL_SWAP_BUFFERS,
GFX_CTL_HAS_WINDOWED,
@ -252,8 +253,6 @@ retro_proc_address_t gfx_ctx_get_proc_address(const char *sym);
void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver);
void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver);
bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data);
#ifdef __cplusplus