diff --git a/gfx/drivers/caca_gfx.c b/gfx/drivers/caca_gfx.c index 409badc683..b5e5e6d21c 100644 --- a/gfx/drivers/caca_gfx.c +++ b/gfx/drivers/caca_gfx.c @@ -65,7 +65,7 @@ static void caca_gfx_create(void) video_driver_set_size(&caca_video_width, &caca_video_height); } -static void *caca_gfx_init(video_info_t *video, +static void *caca_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { caca_t *caca = (caca_t*)calloc(1, sizeof(*caca)); diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 3eaf8e0773..2e3a335e51 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -287,7 +287,7 @@ static bool ctr_tasks_finder(retro_task_t *task,void *userdata) task_finder_data_t ctr_tasks_finder_data = {ctr_tasks_finder, NULL}; #endif -static void* ctr_init(video_info_t* video, +static void* ctr_init(const video_info_t* video, const input_driver_t** input, void** input_data) { float refresh_rate; diff --git a/gfx/drivers/d3d.cpp b/gfx/drivers/d3d.cpp index c833ab8255..d6768ff30e 100644 --- a/gfx/drivers/d3d.cpp +++ b/gfx/drivers/d3d.cpp @@ -132,7 +132,7 @@ static bool d3d_init_imports(d3d_video_t *d3d) return true; } -static bool d3d_init_chain(d3d_video_t *d3d, video_info_t *video_info) +static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info) { unsigned current_width, current_height, out_width, out_height; unsigned i = 0; @@ -607,7 +607,7 @@ void d3d_make_d3dpp(void *data, #endif } -static bool d3d_init_base(void *data, video_info_t *info) +static bool d3d_init_base(void *data, const video_info_t *info) { D3DPRESENT_PARAMETERS d3dpp; d3d_video_t *d3d = (d3d_video_t*)data; @@ -773,7 +773,7 @@ static void d3d_set_viewport(void *data, d3d->renderchain_driver->set_font_rect(d3d, NULL); } -static bool d3d_initialize(d3d_video_t *d3d, video_info_t *info) +static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info) { unsigned width, height; bool ret = true; @@ -978,7 +978,7 @@ static void d3d_set_osd_msg(void *data, /* Delay constructor due to lack of exceptions. */ static bool d3d_construct(d3d_video_t *d3d, - video_info_t *info, const input_driver_t **input, + const video_info_t *info, const input_driver_t **input, void **input_data) { gfx_ctx_input_t inp; @@ -1122,7 +1122,7 @@ static const gfx_ctx_driver_t *d3d_get_context(void *data) api, major, minor, false); } -static void *d3d_init(video_info_t *info, +static void *d3d_init(const video_info_t *info, const input_driver_t **input, void **input_data) { d3d_video_t *d3d = NULL; diff --git a/gfx/drivers/dispmanx_gfx.c b/gfx/drivers/dispmanx_gfx.c index 09bac82877..090a76ad1b 100644 --- a/gfx/drivers/dispmanx_gfx.c +++ b/gfx/drivers/dispmanx_gfx.c @@ -281,7 +281,7 @@ static void dispmanx_blank_console (void *data) dispmanx_surface_update_async(_dispvars, image, _dispvars->back_surface); } -static void *dispmanx_gfx_init(video_info_t *video, +static void *dispmanx_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { struct dispmanx_video *_dispvars = calloc(1, sizeof(struct dispmanx_video)); diff --git a/gfx/drivers/drm_gfx.c b/gfx/drivers/drm_gfx.c index 2857ade90c..99eed65b59 100644 --- a/gfx/drivers/drm_gfx.c +++ b/gfx/drivers/drm_gfx.c @@ -700,7 +700,7 @@ static bool init_drm(void) } -static void *drm_gfx_init(video_info_t *video, +static void *drm_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { struct drm_video *_drmvars = (struct drm_video*) diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index 746bd80f3e..1e5b2def70 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -1163,7 +1163,7 @@ static int exynos_render_msg(struct exynos_video *vid, return exynos_blend_font(pdata); } -static void *exynos_gfx_init(video_info_t *video, +static void *exynos_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { struct exynos_video *vid; diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index cfeaa8eaeb..51448d1661 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -52,7 +52,7 @@ static void gdi_gfx_create(void) { } -static void *gdi_gfx_init(video_info_t *video, +static void *gdi_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { unsigned full_x, full_y; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 3d97f7fdf3..6cec666eac 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -621,7 +621,7 @@ static void gl_init_textures_reference(gl_t *gl, unsigned i, #endif } -static void gl_init_textures(gl_t *gl, video_info_t *video) +static void gl_init_textures(gl_t *gl, const video_info_t *video) { unsigned i; GLenum internal_fmt, texture_type = 0, texture_fmt = 0; @@ -1820,7 +1820,7 @@ static void gl_begin_debug(gl_t *gl) #endif -static void *gl_init(video_info_t *video, const input_driver_t **input, void **input_data) +static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data) { gfx_ctx_mode_t mode; gfx_ctx_input_t inp; @@ -1832,6 +1832,8 @@ static void *gl_init(video_info_t *video, const input_driver_t **input, void **i video_shader_ctx_wrap_t wrap_info = {0}; unsigned win_width = 0; unsigned win_height = 0; + unsigned temp_width = 0; + unsigned temp_height = 0; bool force_smooth = false; const char *vendor = NULL; const char *renderer = NULL; @@ -1905,39 +1907,46 @@ static void *gl_init(video_info_t *video, const input_driver_t **input, void **i gl_begin_debug(gl); #endif - gl->vsync = video->vsync; - gl->fullscreen = video->fullscreen; + 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); - video->real_width = mode.width; - video->real_height = mode.height; - mode.width = 0; - mode.height = 0; + temp_width = mode.width; + temp_height = mode.height; + mode.width = 0; + mode.height = 0; - hwr = video_driver_get_hw_context(); + /* Get real known video size, which might have been altered by context. */ - gl->vertex_ptr = hwr->bottom_left_origin + if (temp_width != 0 && temp_height != 0) + video_driver_set_size(&temp_width, &temp_height); + + video_driver_get_size(&temp_width, &temp_height); + + RARCH_LOG("[GL]: Using resolution %ux%u\n", temp_width, temp_height); + + hwr = video_driver_get_hw_context(); + + gl->vertex_ptr = hwr->bottom_left_origin ? vertexes : vertexes_flipped; /* Better pipelining with GPU due to synchronous glSubTexImage. * Multiple async PBOs would be an alternative, * but still need multiple textures with PREV. */ - gl->textures = 4; - + gl->textures = 4; #ifdef HAVE_FBO - gl->hw_render_use = hwr->context_type != RETRO_HW_CONTEXT_NONE; + gl->hw_render_use = hwr->context_type != RETRO_HW_CONTEXT_NONE; if (gl->hw_render_use) { /* All on GPU, no need to excessively * create textures. */ - gl->textures = 1; - + gl->textures = 1; #ifdef GL_DEBUG context_bind_hw_render(true); gl_begin_debug(gl); @@ -1945,7 +1954,6 @@ static void *gl_init(video_info_t *video, const input_driver_t **input, void **i #endif } #endif - gl->white_color_ptr = white_color; #ifdef HAVE_GLSL @@ -1991,17 +1999,17 @@ static void *gl_init(video_info_t *video, const input_driver_t **input, void **i shader_info.num); gl->tex_w = gl->tex_h = (RARCH_SCALE_BASE * video->input_scale); - gl->keep_aspect = video->force_aspect; + gl->keep_aspect = video->force_aspect; /* Apparently need to set viewport for passes * when we aren't using FBOs. */ gl_set_shader_viewport(gl, 0); gl_set_shader_viewport(gl, 1); - mip_level = 1; - gl->tex_mipmap = video_shader_driver_mipmap_input(&mip_level); - shader_filter.index = 1; - shader_filter.smooth = &force_smooth; + mip_level = 1; + gl->tex_mipmap = video_shader_driver_mipmap_input(&mip_level); + shader_filter.index = 1; + shader_filter.smooth = &force_smooth; if (video_shader_driver_filter_type(&shader_filter)) gl->tex_min_filter = gl->tex_mipmap ? (force_smooth ? @@ -2012,13 +2020,13 @@ static void *gl_init(video_info_t *video, const input_driver_t **input, void **i (video->smooth ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST) : (video->smooth ? GL_LINEAR : GL_NEAREST); - gl->tex_mag_filter = min_filter_to_mag(gl->tex_min_filter); + gl->tex_mag_filter = min_filter_to_mag(gl->tex_min_filter); - wrap_info.idx = 1; + wrap_info.idx = 1; video_shader_driver_wrap_type(&wrap_info); - gl->wrap_mode = gl_wrap_type_to_enum(wrap_info.type); + gl->wrap_mode = gl_wrap_type_to_enum(wrap_info.type); gl_set_texture_fmts(gl, video->rgb32); diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index 084ae342b7..133f132165 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -572,7 +572,7 @@ static void init_texture(void *data, unsigned width, unsigned height) GX_InvalidateTexAll(); } -static void init_vtx(void *data, video_info_t *video) +static void init_vtx(void *data, const video_info_t *video) { Mtx44 m; gx_video_t *gx = (gx_video_t*)data; @@ -693,7 +693,7 @@ static void gx_efb_screenshot(void) #endif -static void *gx_init(video_info_t *video, +static void *gx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { settings_t *settings = config_get_ptr(); diff --git a/gfx/drivers/nullgfx.c b/gfx/drivers/nullgfx.c index 7c230c21b6..b3d66d428b 100644 --- a/gfx/drivers/nullgfx.c +++ b/gfx/drivers/nullgfx.c @@ -19,7 +19,7 @@ #include "../../driver.h" #include "../../verbosity.h" -static void *null_gfx_init(video_info_t *video, +static void *null_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { RARCH_ERR("Using the null video driver. RetroArch will not be visible."); diff --git a/gfx/drivers/omap_gfx.c b/gfx/drivers/omap_gfx.c index 986395a1ca..f9b6679357 100644 --- a/gfx/drivers/omap_gfx.c +++ b/gfx/drivers/omap_gfx.c @@ -934,7 +934,7 @@ static void omap_render_msg(omap_video_t *vid, const char *msg) } /* FIXME/TODO: Filters not supported. */ -static void *omap_gfx_init(video_info_t *video, +static void *omap_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { settings_t *settings = config_get_ptr(); diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index 18acaa21ba..b27d246c5d 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -257,7 +257,7 @@ static void psp_on_vblank(u32 sub, psp1_video_t *psp) psp->vblank_not_reached = false; } -static void *psp_init(video_info_t *video, +static void *psp_init(const video_info_t *video, const input_driver_t **input, void **input_data) { /* TODO : add ASSERT() checks or use main RAM if diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index ea248e0644..746833b97b 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -377,7 +377,7 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32, } } -static void *sdl2_gfx_init(video_info_t *video, +static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { int i; diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index c437ec9e24..ee24dd6b69 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -228,7 +228,7 @@ static void sdl_gfx_set_handles(void) #endif } -static void *sdl_gfx_init(video_info_t *video, const input_driver_t **input, void **input_data) +static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { unsigned full_x, full_y; const SDL_VideoInfo *video_info = NULL; diff --git a/gfx/drivers/sunxi_gfx.c b/gfx/drivers/sunxi_gfx.c index 99283f402e..0d6e4d5a61 100644 --- a/gfx/drivers/sunxi_gfx.c +++ b/gfx/drivers/sunxi_gfx.c @@ -613,7 +613,7 @@ static void sunxi_vsync_thread_func(void *data) } } -static void *sunxi_gfx_init(video_info_t *video, +static void *sunxi_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { struct sunxi_video *_dispvars = (struct sunxi_video*) diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 42fe9a5904..1ebb8d9a9a 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -92,7 +92,7 @@ static INLINE bool vg_query_extension(const char *ext) return ret; } -static void *vg_init(video_info_t *video, +static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data) { gfx_ctx_mode_t mode; diff --git a/gfx/drivers/vga_gfx.c b/gfx/drivers/vga_gfx.c index 9e12fa493b..1214e6574e 100644 --- a/gfx/drivers/vga_gfx.c +++ b/gfx/drivers/vga_gfx.c @@ -111,7 +111,7 @@ static void vga_gfx_create(void) vga_upload_palette(); } -static void *vga_gfx_init(video_info_t *video, +static void *vga_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { vga_t *vga = (vga_t*)calloc(1, sizeof(*vga)); diff --git a/gfx/drivers/vita2d_gfx.c b/gfx/drivers/vita2d_gfx.c index 14669057eb..0a6a52bfe6 100644 --- a/gfx/drivers/vita2d_gfx.c +++ b/gfx/drivers/vita2d_gfx.c @@ -45,7 +45,7 @@ extern void *memcpy_neon(void *dst, const void *src, size_t n); static void vita2d_gfx_set_viewport(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate); -static void *vita2d_gfx_init(video_info_t *video, +static void *vita2d_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t)); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 4109d9a27e..2d0d7119cb 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1071,7 +1071,7 @@ static void vulkan_init_readback(vk_t *vk) } } -static void *vulkan_init(video_info_t *video, +static void *vulkan_init(const video_info_t *video, const input_driver_t **input, void **input_data) { diff --git a/gfx/drivers/wiiu_gfx.c b/gfx/drivers/wiiu_gfx.c index 48579c0257..7117773836 100644 --- a/gfx/drivers/wiiu_gfx.c +++ b/gfx/drivers/wiiu_gfx.c @@ -271,7 +271,7 @@ static void wiiu_gfx_set_aspect_ratio(void* data, unsigned aspect_ratio_idx) wiiu->should_resize = true; } -static void* wiiu_gfx_init(video_info_t* video, +static void* wiiu_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) { int i; diff --git a/gfx/drivers/xenon360_gfx.c b/gfx/drivers/xenon360_gfx.c index 0e1022bc39..809cf5e664 100644 --- a/gfx/drivers/xenon360_gfx.c +++ b/gfx/drivers/xenon360_gfx.c @@ -103,8 +103,7 @@ static void xenon360_gfx_free(void *data) free(vid); } -static void *xenon360_gfx_init(video_info_t *video, - const input_driver_t **input, void **input_data) +static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { gl_t * gl = calloc(1, sizeof(gl_t)); if (!gl) diff --git a/gfx/drivers/xshm_gfx.c b/gfx/drivers/xshm_gfx.c index 88bed07650..561b20726f 100644 --- a/gfx/drivers/xshm_gfx.c +++ b/gfx/drivers/xshm_gfx.c @@ -49,7 +49,7 @@ typedef struct xshm GC gc; } xshm_t; -static void *xshm_gfx_init(video_info_t *video, +static void *xshm_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { xshm_t* xshm = (xshm_t*)malloc(sizeof(xshm_t)); diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index d6932cfcbd..1277e22aaf 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -319,7 +319,7 @@ static const struct format_desc formats[] = { }; static bool xv_adaptor_set_format(xv_t *xv, Display *dpy, - XvPortID port, video_info_t *video) + XvPortID port, const video_info_t *video) { int i; unsigned j; @@ -416,7 +416,7 @@ static void xv_calc_out_rect(bool keep_aspect, } } -static void *xv_init(video_info_t *video, +static void *xv_init(const video_info_t *video, const input_driver_t **input, void **input_data) { unsigned i; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 0020d6c086..4864c65d4c 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -824,14 +824,6 @@ static bool video_driver_init_internal(void) goto error; } - /* Get real known video size, which might have been altered by video context. */ - if (video.real_width != 0 && video.real_height != 0) - { - video_driver_width = video.real_width; - video_driver_height = video.real_height; - RARCH_LOG("[Video]: Using resolution %ux%u\n", video_driver_width, video_driver_width); - } - video_driver_poke = NULL; if (current_video->poke_interface) current_video->poke_interface(video_driver_data, &video_driver_poke); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 80a00ef6a9..cdbbccce47 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -54,9 +54,6 @@ typedef struct video_info */ unsigned height; - unsigned real_width; - unsigned real_height; - /* Launch in fullscreen mode instead of windowed mode. */ bool fullscreen; @@ -233,7 +230,7 @@ typedef struct video_driver * The video initialization might preinitialize an input driver * to override the settings in case the video driver relies on * input driver for event handling. */ - void *(*init)(video_info_t *video, + void *(*init)(const video_info_t *video, const input_driver_t **input, void **input_data); diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index f2f3f33a97..f573e397aa 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -223,7 +223,7 @@ struct thread_video }; -static void *video_thread_init_never_call(video_info_t *video, +static void *video_thread_init_never_call(const video_info_t *video, const input_driver_t **input, void **input_data) { (void)video;