diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 8fbc741e5a..5abe1e020c 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -3575,7 +3575,6 @@ static void *gl2_init(const video_info_t *video, input_driver_t **input, void **input_data) { enum gfx_wrap_type wrap_type; - gfx_ctx_mode_t mode; gfx_ctx_input_t inp; unsigned full_x, full_y; video_shader_ctx_info_t shader_info; @@ -3583,6 +3582,8 @@ static void *gl2_init(const video_info_t *video, bool video_gpu_record = settings->bools.video_gpu_record; int interval = 0; unsigned mip_level = 0; + unsigned mode_width = 0; + unsigned mode_height = 0; unsigned win_width = 0; unsigned win_height = 0; unsigned temp_width = 0; @@ -3606,13 +3607,16 @@ static void *gl2_init(const video_info_t *video, RARCH_LOG("[GL]: Found GL context: %s\n", ctx_driver->ident); - video_context_driver_get_video_size(&mode); + if (gl->ctx_driver->get_video_size) + gl->ctx_driver->get_video_size(gl->ctx_data, + &mode_width, &mode_height); + #if defined(DINGUX) - mode.width = 320; - mode.height = 240; + mode_width = 320; + mode_height = 240; #endif - full_x = mode.width; - full_y = mode.height; + full_x = mode_width; + full_y = mode_height; interval = 0; RARCH_LOG("[GL]: Detecting screen resolution %ux%u.\n", full_x, full_y); @@ -3755,17 +3759,19 @@ static void *gl2_init(const video_info_t *video, gl->vsync = video->vsync; gl->fullscreen = video->fullscreen; - mode.width = 0; - mode.height = 0; + mode_width = 0; + mode_height = 0; - video_context_driver_get_video_size(&mode); + if (gl->ctx_driver->get_video_size) + gl->ctx_driver->get_video_size(gl->ctx_data, + &mode_width, &mode_height); #if defined(DINGUX) - mode.width = 320; - mode.height = 240; + mode_width = 320; + mode_height = 240; #endif - temp_width = mode.width; - temp_height = mode.height; + temp_width = mode_width; + temp_height = mode_height; /* Get real known video size, which might have been altered by context. */ diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 6ed4b649b9..0548148392 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -219,9 +219,10 @@ static void *gl1_gfx_init(const video_info_t *video, { unsigned full_x, full_y; gfx_ctx_input_t inp; - gfx_ctx_mode_t mode; void *ctx_data = NULL; const gfx_ctx_driver_t *ctx_driver = NULL; + unsigned mode_width = 0; + unsigned mode_height = 0; unsigned win_width = 0, win_height = 0; unsigned temp_width = 0, temp_height = 0; settings_t *settings = config_get_ptr(); @@ -269,12 +270,14 @@ static void *gl1_gfx_init(const video_info_t *video, RARCH_LOG("[GL1]: Found GL1 context: %s\n", ctx_driver->ident); - video_context_driver_get_video_size(&mode); + if (gl1->ctx_driver->get_video_size) + gl1->ctx_driver->get_video_size(gl1->ctx_data, + &mode_width, &mode_height); - full_x = mode.width; - full_y = mode.height; - mode.width = 0; - mode.height = 0; + full_x = mode_width; + full_y = mode_height; + mode_width = 0; + mode_height = 0; #ifdef VITA if (!vgl_inited) { @@ -301,9 +304,8 @@ static void *gl1_gfx_init(const video_info_t *video, win_height = full_y; } - mode.width = win_width; - mode.height = win_height; - mode.fullscreen = video->fullscreen; + mode_width = win_width; + mode_height = win_height; interval = video->swap_interval; @@ -323,13 +325,15 @@ static void *gl1_gfx_init(const video_info_t *video, gl1->fullscreen = video->fullscreen; - mode.width = 0; - mode.height = 0; + mode_width = 0; + mode_height = 0; - video_context_driver_get_video_size(&mode); + if (gl1->ctx_driver->get_video_size) + gl1->ctx_driver->get_video_size(gl1->ctx_data, + &mode_width, &mode_height); - temp_width = mode.width; - temp_height = mode.height; + temp_width = mode_width; + temp_height = mode_height; /* Get real known video size, which might have been altered by context. */ @@ -686,8 +690,9 @@ static bool gl1_gfx_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info) { - gfx_ctx_mode_t mode; const void *frame_to_copy = NULL; + unsigned mode_width = 0; + unsigned mode_height = 0; unsigned width = 0; unsigned height = 0; bool draw = true; @@ -779,10 +784,12 @@ static bool gl1_gfx_frame(void *data, const void *frame, gl1->video_height = height; } - video_context_driver_get_video_size(&mode); + if (gl1->ctx_driver->get_video_size) + gl1->ctx_driver->get_video_size(gl1->ctx_data, + &mode_width, &mode_height); - gl1->screen_width = mode.width; - gl1->screen_height = mode.height; + gl1->screen_width = mode_width; + gl1->screen_height = mode_height; if (draw) { diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index ae209b8000..16535b08b8 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -1152,12 +1152,13 @@ static void gl_core_set_viewport_wrapper(void *data, static void *gl_core_init(const video_info_t *video, input_driver_t **input, void **input_data) { - gfx_ctx_mode_t mode; gfx_ctx_input_t inp; unsigned full_x, full_y; settings_t *settings = config_get_ptr(); bool video_gpu_record = settings->bools.video_gpu_record; int interval = 0; + unsigned mode_width = 0; + unsigned mode_height = 0; unsigned win_width = 0; unsigned win_height = 0; unsigned temp_width = 0; @@ -1180,12 +1181,14 @@ static void *gl_core_init(const video_info_t *video, RARCH_LOG("[GLCore]: Found GL context: %s\n", ctx_driver->ident); - video_context_driver_get_video_size(&mode); + if (gl->ctx_driver->get_video_size) + gl->ctx_driver->get_video_size(gl->ctx_data, + &mode_width, &mode_height); - full_x = mode.width; - full_y = mode.height; - mode.width = 0; - mode.height = 0; + full_x = mode_width; + full_y = mode_height; + mode_width = 0; + mode_height = 0; interval = 0; RARCH_LOG("[GLCore]: Detecting screen resolution %ux%u.\n", full_x, full_y); @@ -1281,12 +1284,15 @@ static void *gl_core_init(const video_info_t *video, gl->fullscreen = video->fullscreen; gl->keep_aspect = video->force_aspect; - mode.width = 0; - mode.height = 0; + mode_width = 0; + mode_height = 0; - video_context_driver_get_video_size(&mode); - temp_width = mode.width; - temp_height = mode.height; + if (gl->ctx_driver->get_video_size) + gl->ctx_driver->get_video_size(gl->ctx_data, + &mode_width, &mode_height); + + temp_width = mode_width; + temp_height = mode_height; /* Get real known video size, which might have been altered by context. */ diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 68b34c3f5a..6d8625772a 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -108,11 +108,12 @@ static INLINE bool vg_query_extension(const char *ext) static void *vg_init(const video_info_t *video, input_driver_t **input, void **input_data) { - gfx_ctx_mode_t mode; gfx_ctx_input_t inp; unsigned win_width, win_height; VGfloat clearColor[4] = {0, 0, 0, 1}; int interval = 0; + unsigned mode_width = 0; + unsigned mode_height = 0; unsigned temp_width = 0; unsigned temp_height = 0; void *ctx_data = NULL; @@ -138,10 +139,12 @@ static void *vg_init(const video_info_t *video, vg->ctx_driver = ctx; video_context_driver_set((void*)ctx); - video_context_driver_get_video_size(&mode); + if (vg->ctx_driver->get_video_size) + vg->ctx_driver->get_video_size(vg->ctx_data, + &mode_width, &mode_height); - temp_width = mode.width; - temp_height = mode.height; + temp_width = mode_width; + temp_height = mode_height; RARCH_LOG("[VG]: Detecting screen resolution %ux%u.\n", temp_width, temp_height); @@ -180,13 +183,15 @@ static void *vg_init(const video_info_t *video, temp_width = 0; temp_height = 0; - mode.width = 0; - mode.height = 0; + mode_width = 0; + mode_height = 0; - video_context_driver_get_video_size(&mode); + if (vg->ctx_driver->get_video_size) + vg->ctx_driver->get_video_size(vg->ctx_data, + &mode_width, &mode_height); - temp_width = mode.width; - temp_height = mode.height; + temp_width = mode_width; + temp_height = mode_height; vg->should_resize = true; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 7f19ff9e0d..6a6939d724 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1164,11 +1164,12 @@ static void *vulkan_init(const video_info_t *video, input_driver_t **input, void **input_data) { - gfx_ctx_mode_t mode; gfx_ctx_input_t inp; unsigned full_x, full_y; unsigned win_width; unsigned win_height; + unsigned mode_width = 0; + unsigned mode_height = 0; int interval = 0; unsigned temp_width = 0; unsigned temp_height = 0; @@ -1190,11 +1191,14 @@ static void *vulkan_init(const video_info_t *video, RARCH_LOG("[Vulkan]: Found vulkan context: %s\n", ctx_driver->ident); - video_context_driver_get_video_size(&mode); - full_x = mode.width; - full_y = mode.height; - mode.width = 0; - mode.height = 0; + if (vk->ctx_driver->get_video_size) + vk->ctx_driver->get_video_size(vk->ctx_data, + &mode_width, &mode_height); + + full_x = mode_width; + full_y = mode_height; + mode_width = 0; + mode_height = 0; RARCH_LOG("[Vulkan]: Detecting screen resolution %ux%u.\n", full_x, full_y); interval = video->vsync ? video->swap_interval : 0; @@ -1225,9 +1229,12 @@ static void *vulkan_init(const video_info_t *video, goto error; } - video_context_driver_get_video_size(&mode); - temp_width = mode.width; - temp_height = mode.height; + if (vk->ctx_driver->get_video_size) + vk->ctx_driver->get_video_size(vk->ctx_data, + &mode_width, &mode_height); + + temp_width = mode_width; + temp_height = mode_height; if (temp_width != 0 && temp_height != 0) video_driver_set_size(temp_width, temp_height); diff --git a/retroarch.c b/retroarch.c index 7cbc7f9b22..906bac9ac1 100644 --- a/retroarch.c +++ b/retroarch.c @@ -33377,16 +33377,6 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident) return true; } -bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info) -{ - struct rarch_state *p_rarch = &rarch_st; - if (!p_rarch->current_video_context.get_video_size) - return false; - p_rarch->current_video_context.get_video_size(p_rarch->video_context_data, - &mode_info->width, &mode_info->height); - return true; -} - bool video_context_driver_get_flags(gfx_ctx_flags_t *flags) { struct rarch_state *p_rarch = &rarch_st; diff --git a/retroarch.h b/retroarch.h index d970b90190..cde9837de9 100644 --- a/retroarch.h +++ b/retroarch.h @@ -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_get_video_size(gfx_ctx_mode_t *mode_info); - bool video_context_driver_get_refresh_rate(float *refresh_rate); bool video_context_driver_set_flags(gfx_ctx_flags_t *flags);