Get rid of video_context_driver_set_video_mode

This commit is contained in:
twinaphex 2020-07-27 11:08:34 +02:00
parent 197465c1ea
commit 61b798b789
7 changed files with 35 additions and 85 deletions

View File

@ -2106,13 +2106,10 @@ static void gl2_set_rotation(void *data, unsigned rotation)
static void gl2_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
{
gfx_ctx_mode_t mode;
mode.width = width;
mode.height = height;
mode.fullscreen = fullscreen;
video_context_driver_set_video_mode(&mode);
gl_t *gl = (gl_t*)data;
if (gl->ctx_driver->set_video_mode)
gl->ctx_driver->set_video_mode(gl->ctx_data,
width, height, fullscreen);
}
static void gl2_update_input_size(gl_t *gl, unsigned width,
@ -3616,8 +3613,6 @@ static void *gl2_init(const video_info_t *video,
#endif
full_x = mode.width;
full_y = mode.height;
mode.width = 0;
mode.height = 0;
interval = 0;
RARCH_LOG("[GL]: Detecting screen resolution %ux%u.\n", full_x, full_y);
@ -3643,16 +3638,16 @@ static void *gl2_init(const video_info_t *video,
win_height = full_y;
}
mode.width = win_width;
mode.height = win_height;
mode.fullscreen = video->fullscreen;
if (!video_context_driver_set_video_mode(&mode))
if ( !gl->ctx_driver->set_video_mode
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
win_width, win_height, video->fullscreen))
goto error;
#if defined(__APPLE__) && !defined(IOS)
/* This is a hack for now to work around a very annoying
* issue that currently eludes us. */
if (!video_context_driver_set_video_mode(&mode))
if ( !gl->ctx_driver->set_video_mode
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
win_width, win_height, video->fullscreen))
goto error;
#endif
@ -3771,8 +3766,6 @@ static void *gl2_init(const video_info_t *video,
#endif
temp_width = mode.width;
temp_height = mode.height;
mode.width = 0;
mode.height = 0;
/* Get real known video size, which might have been altered by context. */

View File

@ -316,7 +316,9 @@ static void *gl1_gfx_init(const video_info_t *video,
ctx_driver->swap_interval(gl1->ctx_data, interval);
}
if (!video_context_driver_set_video_mode(&mode))
if ( !gl1->ctx_driver->set_video_mode
|| !gl1->ctx_driver->set_video_mode(gl1->ctx_data,
win_width, win_height, video->fullscreen))
goto error;
gl1->fullscreen = video->fullscreen;
@ -328,8 +330,6 @@ static void *gl1_gfx_init(const video_info_t *video,
temp_width = mode.width;
temp_height = mode.height;
mode.width = 0;
mode.height = 0;
/* Get real known video size, which might have been altered by context. */
@ -1187,13 +1187,10 @@ static void gl1_get_video_output_next(void *data)
static void gl1_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
{
gfx_ctx_mode_t mode;
mode.width = width;
mode.height = height;
mode.fullscreen = fullscreen;
video_context_driver_set_video_mode(&mode);
gl1_t *gl = (gl1_t*)data;
if (gl->ctx_driver->set_video_mode)
gl->ctx_driver->set_video_mode(gl->ctx_data,
width, height, fullscreen);
}
static unsigned gl1_wrap_type_to_enum(enum gfx_wrap_type type)

View File

@ -1211,11 +1211,9 @@ static void *gl_core_init(const video_info_t *video,
win_height = full_y;
}
mode.width = win_width;
mode.height = win_height;
mode.fullscreen = video->fullscreen;
if (!video_context_driver_set_video_mode(&mode))
if ( !gl->ctx_driver->set_video_mode
|| !gl->ctx_driver->set_video_mode(gl->ctx_data,
win_width, win_height, video->fullscreen))
goto error;
gl_core_context_bind_hw_render(gl, false);
@ -1290,9 +1288,6 @@ static void *gl_core_init(const video_info_t *video,
temp_width = mode.width;
temp_height = mode.height;
mode.width = 0;
mode.height = 0;
/* Get real known video size, which might have been altered by context. */
if (temp_width != 0 && temp_height != 0)
@ -2124,13 +2119,10 @@ static void gl_core_unload_texture(void *data, bool threaded,
static void gl_core_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
{
gfx_ctx_mode_t mode;
mode.width = width;
mode.height = height;
mode.fullscreen = fullscreen;
video_context_driver_set_video_mode(&mode);
gl_core_t *gl = (gl_core_t*)data;
if (gl->ctx_driver->set_video_mode)
gl->ctx_driver->set_video_mode(gl->ctx_data,
width, height, fullscreen);
}
static void gl_core_show_mouse(void *data, bool state)

View File

@ -142,8 +142,6 @@ static void *vg_init(const video_info_t *video,
temp_width = mode.width;
temp_height = mode.height;
mode.width = 0;
mode.height = 0;
RARCH_LOG("[VG]: Detecting screen resolution %ux%u.\n", temp_width, temp_height);
@ -173,11 +171,9 @@ static void *vg_init(const video_info_t *video,
win_height = temp_height;
}
mode.width = win_width;
mode.height = win_height;
mode.fullscreen = video->fullscreen;
if (!video_context_driver_set_video_mode(&mode))
if ( !vg->ctx_driver->set_video_mode
|| !vg->ctx_driver->set_video_mode(vg->ctx_data,
win_width, win_height, video->fullscreen))
goto error;
video_driver_get_size(&temp_width, &temp_height);
@ -191,8 +187,6 @@ static void *vg_init(const video_info_t *video,
temp_width = mode.width;
temp_height = mode.height;
mode.width = 0;
mode.height = 0;
vg->should_resize = true;

View File

@ -1217,11 +1217,9 @@ static void *vulkan_init(const video_info_t *video,
win_height = full_y;
}
mode.width = win_width;
mode.height = win_height;
mode.fullscreen = video->fullscreen;
if (!video_context_driver_set_video_mode(&mode))
if ( !vk->ctx_driver->set_video_mode
|| !vk->ctx_driver->set_video_mode(vk->ctx_data,
win_width, win_height, video->fullscreen))
{
RARCH_ERR("[Vulkan]: Failed to set video mode.\n");
goto error;
@ -1456,15 +1454,10 @@ static void vulkan_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
gfx_ctx_mode_t mode;
(void)data;
mode.width = width;
mode.height = height;
mode.fullscreen = fullscreen;
video_context_driver_set_video_mode(&mode);
vk_t *vk = (vk_t*)data;
if (vk->ctx_driver->set_video_mode)
vk->ctx_driver->set_video_mode(vk->ctx_data,
width, height, fullscreen);
}
static void vulkan_set_viewport(void *data, unsigned viewport_width,

View File

@ -31465,9 +31465,7 @@ bool video_driver_set_rotation(unsigned rotation)
bool video_driver_set_video_mode(unsigned width,
unsigned height, bool fullscreen)
{
gfx_ctx_mode_t mode;
struct rarch_state *p_rarch = &rarch_st;
if ( p_rarch->video_driver_poke &&
p_rarch->video_driver_poke->set_video_mode)
{
@ -31475,12 +31473,7 @@ bool video_driver_set_video_mode(unsigned width,
width, height, fullscreen);
return true;
}
mode.width = width;
mode.height = height;
mode.fullscreen = fullscreen;
return video_context_driver_set_video_mode(&mode);
return false;
}
bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
@ -33384,16 +33377,6 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident)
return true;
}
bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info)
{
struct rarch_state *p_rarch = &rarch_st;
if (!p_rarch->current_video_context.set_video_mode)
return false;
return p_rarch->current_video_context.set_video_mode(
p_rarch->video_context_data, mode_info->width,
mode_info->height, mode_info->fullscreen);
}
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info)
{
struct rarch_state *p_rarch = &rarch_st;

View File

@ -1770,8 +1770,6 @@ void video_context_driver_destroy(void);
bool video_context_driver_get_ident(gfx_ctx_ident_t *ident);
bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info);
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info);
bool video_context_driver_get_refresh_rate(float *refresh_rate);