mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
driver->video_context should be self-contained now to video_context_driver.c
This commit is contained in:
parent
0520a1b3c7
commit
6f18656baa
@ -764,7 +764,7 @@ static void *d3d_init(const video_info_t *info,
|
||||
|
||||
if (input && input_data)
|
||||
{
|
||||
*input = driver->input;
|
||||
*input = driver->input;
|
||||
*input_data = driver->input_data;
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ static void *d3d_init(const video_info_t *info,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
driver->video_context = ctx;
|
||||
gfx_ctx_set(ctx);
|
||||
|
||||
if (!d3d_construct(vid, info, input, input_data))
|
||||
{
|
||||
@ -819,8 +819,7 @@ static void *d3d_init(const video_info_t *info,
|
||||
error:
|
||||
if (vid)
|
||||
delete vid;
|
||||
if (driver)
|
||||
driver->video_context = NULL;
|
||||
gfx_ctx_destroy(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2409,16 +2409,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;
|
||||
gl_t *gl = NULL;
|
||||
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();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
gl = (gl_t*)calloc(1, sizeof(gl_t));
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gl_t *gl = (gl_t*)calloc(1, sizeof(gl_t));
|
||||
if (!gl)
|
||||
return NULL;
|
||||
|
||||
@ -2426,7 +2424,8 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
if (!ctx_driver)
|
||||
goto error;
|
||||
|
||||
driver->video_context = ctx_driver;
|
||||
gfx_ctx_set(ctx_driver);
|
||||
|
||||
gl->video_info = *video;
|
||||
|
||||
RARCH_LOG("Found GL context: %s\n", ctx_driver->ident);
|
||||
@ -2631,8 +2630,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
return gl;
|
||||
|
||||
error:
|
||||
if (ctx_driver)
|
||||
ctx_driver->destroy(gl);
|
||||
gfx_ctx_destroy(ctx_driver);
|
||||
free(gl);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
if (!ctx)
|
||||
goto error;
|
||||
|
||||
driver->video_context = ctx;
|
||||
gfx_ctx_set(ctx);
|
||||
|
||||
gfx_ctx_get_video_size(vg, &temp_width, &temp_height);
|
||||
RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height);
|
||||
@ -199,8 +199,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
error:
|
||||
if (vg)
|
||||
free(vg);
|
||||
if (driver)
|
||||
driver->video_context = NULL;
|
||||
gfx_ctx_destroy(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,26 @@ void *gfx_ctx_data_get_ptr(void)
|
||||
return video_context_data;
|
||||
}
|
||||
|
||||
void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver || !ctx_driver)
|
||||
return;
|
||||
driver->video_context = ctx_driver;
|
||||
}
|
||||
|
||||
void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (ctx_driver)
|
||||
gfx_ctx_destroy(ctx_driver);
|
||||
|
||||
driver->video_context = NULL;
|
||||
}
|
||||
|
||||
void gfx_ctx_data_set(void *ptr)
|
||||
{
|
||||
if (!ptr)
|
||||
|
@ -260,6 +260,10 @@ void gfx_ctx_data_set(void *ptr);
|
||||
|
||||
void gfx_ctx_free_data(void);
|
||||
|
||||
void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver);
|
||||
|
||||
void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user