From e43c55bef3430049cf8d2649adf086a9caec0719 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 13 Aug 2019 12:23:02 +0200 Subject: [PATCH] (GLCore) Don't use video_driver_get_size --- gfx/common/gl_core_common.h | 3 +++ gfx/drivers/gl_core.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gfx/common/gl_core_common.h b/gfx/common/gl_core_common.h index 68b9489b26..a20236de76 100644 --- a/gfx/common/gl_core_common.h +++ b/gfx/common/gl_core_common.h @@ -103,6 +103,9 @@ typedef struct gl_core struct gl_core_buffer_locations bokeh_loc; } pipelines; + unsigned video_width; + unsigned video_height; + GLuint *overlay_tex; float *overlay_vertex_coord; float *overlay_tex_coord; diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index 615a00abe5..7e8f588538 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -1083,6 +1083,8 @@ static void *gl_core_init(const video_info_t *video, if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); video_driver_get_size(&temp_width, &temp_height); + gl->video_width = temp_width; + gl->video_height = temp_height; RARCH_LOG("[GLCore]: Using resolution %ux%u\n", temp_width, temp_height); @@ -1325,19 +1327,16 @@ static void gl_core_free(void *data) static bool gl_core_alive(void *data) { - unsigned temp_width = 0; - unsigned temp_height = 0; bool ret = false; bool quit = false; bool resize = false; gl_core_t *gl = (gl_core_t*)data; bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); - - /* Needed because some context drivers don't track their sizes */ - video_driver_get_size(&temp_width, &temp_height); + unsigned temp_width = gl->video_width; + unsigned temp_height = gl->video_height; gl->ctx_driver->check_window(gl->ctx_data, - &quit, &resize, &temp_width, &temp_height, is_shutdown); + &quit, &resize, &temp_width, &temp_height, is_shutdown); if (quit) gl->quitting = true; @@ -1347,7 +1346,11 @@ static bool gl_core_alive(void *data) ret = !gl->quitting; if (temp_width != 0 && temp_height != 0) + { video_driver_set_size(&temp_width, &temp_height); + gl->video_width = temp_width; + gl->video_height = temp_height; + } return ret; } @@ -1428,11 +1431,11 @@ static void gl_core_set_rotation(void *data, unsigned rotation) static void gl_core_viewport_info(void *data, struct video_viewport *vp) { - unsigned width, height; unsigned top_y, top_dist; - gl_core_t *gl = (gl_core_t*)data; + gl_core_t *gl = (gl_core_t*)data; + unsigned width = gl->video_width; + unsigned height = gl->video_height; - video_driver_get_size(&width, &height); *vp = gl->vp; vp->full_width = width;