video_init function - video_info_t should not be const -

try to set video_driver_width/video_driver_height outside
of video driver init function
This commit is contained in:
twinaphex 2017-04-24 12:03:21 +02:00
parent 5a3b78bad3
commit c8bcbad4a7
26 changed files with 68 additions and 64 deletions

View File

@ -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(const video_info_t *video,
static void *caca_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
caca_t *caca = (caca_t*)calloc(1, sizeof(*caca));

View File

@ -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(const video_info_t* video,
static void* ctr_init(video_info_t* video,
const input_driver_t** input, void** input_data)
{
float refresh_rate;

View File

@ -132,7 +132,7 @@ static bool d3d_init_imports(d3d_video_t *d3d)
return true;
}
static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
static bool d3d_init_chain(d3d_video_t *d3d, 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, const video_info_t *info)
static bool d3d_init_base(void *data, 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, const video_info_t *info)
static bool d3d_initialize(d3d_video_t *d3d, 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,
const video_info_t *info, const input_driver_t **input,
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(const video_info_t *info,
static void *d3d_init(video_info_t *info,
const input_driver_t **input, void **input_data)
{
d3d_video_t *d3d = NULL;

View File

@ -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(const video_info_t *video,
static void *dispmanx_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
struct dispmanx_video *_dispvars = calloc(1, sizeof(struct dispmanx_video));

View File

@ -700,7 +700,7 @@ static bool init_drm(void)
}
static void *drm_gfx_init(const video_info_t *video,
static void *drm_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
struct drm_video *_drmvars = (struct drm_video*)

View File

@ -1163,7 +1163,7 @@ static int exynos_render_msg(struct exynos_video *vid,
return exynos_blend_font(pdata);
}
static void *exynos_gfx_init(const video_info_t *video,
static void *exynos_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
struct exynos_video *vid;

View File

@ -52,7 +52,7 @@ static void gdi_gfx_create(void)
{
}
static void *gdi_gfx_init(const video_info_t *video,
static void *gdi_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
unsigned full_x, full_y;

View File

@ -621,7 +621,7 @@ static void gl_init_textures_reference(gl_t *gl, unsigned i,
#endif
}
static void gl_init_textures(gl_t *gl, const video_info_t *video)
static void gl_init_textures(gl_t *gl, 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(const video_info_t *video, const input_driver_t **input, void **input_data)
static void *gl_init(video_info_t *video, const input_driver_t **input, void **input_data)
{
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp;
@ -1832,8 +1832,6 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
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;
@ -1907,46 +1905,39 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
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);
temp_width = mode.width;
temp_height = mode.height;
mode.width = 0;
mode.height = 0;
video->real_width = mode.width;
video->real_height = mode.height;
mode.width = 0;
mode.height = 0;
/* Get real known video size, which might have been altered by context. */
hwr = video_driver_get_hw_context();
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
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);
@ -1954,6 +1945,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
#endif
}
#endif
gl->white_color_ptr = white_color;
#ifdef HAVE_GLSL
@ -1999,17 +1991,17 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
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 ?
@ -2020,13 +2012,13 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
(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);

View File

@ -572,7 +572,7 @@ static void init_texture(void *data, unsigned width, unsigned height)
GX_InvalidateTexAll();
}
static void init_vtx(void *data, const video_info_t *video)
static void init_vtx(void *data, 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(const video_info_t *video,
static void *gx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
settings_t *settings = config_get_ptr();

View File

@ -19,7 +19,7 @@
#include "../../driver.h"
#include "../../verbosity.h"
static void *null_gfx_init(const video_info_t *video,
static void *null_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
RARCH_ERR("Using the null video driver. RetroArch will not be visible.");

View File

@ -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(const video_info_t *video,
static void *omap_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
settings_t *settings = config_get_ptr();

View File

@ -257,7 +257,7 @@ static void psp_on_vblank(u32 sub, psp1_video_t *psp)
psp->vblank_not_reached = false;
}
static void *psp_init(const video_info_t *video,
static void *psp_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
/* TODO : add ASSERT() checks or use main RAM if

View File

@ -377,7 +377,7 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
}
}
static void *sdl2_gfx_init(const video_info_t *video,
static void *sdl2_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
int i;

View File

@ -228,7 +228,7 @@ static void sdl_gfx_set_handles(void)
#endif
}
static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
static void *sdl_gfx_init(video_info_t *video, const input_driver_t **input, void **input_data)
{
unsigned full_x, full_y;
const SDL_VideoInfo *video_info = NULL;

View File

@ -613,7 +613,7 @@ static void sunxi_vsync_thread_func(void *data)
}
}
static void *sunxi_gfx_init(const video_info_t *video,
static void *sunxi_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)

View File

@ -92,7 +92,7 @@ static INLINE bool vg_query_extension(const char *ext)
return ret;
}
static void *vg_init(const video_info_t *video,
static void *vg_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
gfx_ctx_mode_t mode;

View File

@ -111,7 +111,7 @@ static void vga_gfx_create(void)
vga_upload_palette();
}
static void *vga_gfx_init(const video_info_t *video,
static void *vga_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
vga_t *vga = (vga_t*)calloc(1, sizeof(*vga));

View File

@ -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(const video_info_t *video,
static void *vita2d_gfx_init(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));

View File

@ -1071,7 +1071,7 @@ static void vulkan_init_readback(vk_t *vk)
}
}
static void *vulkan_init(const video_info_t *video,
static void *vulkan_init(video_info_t *video,
const input_driver_t **input,
void **input_data)
{

View File

@ -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(const video_info_t* video,
static void* wiiu_gfx_init(video_info_t* video,
const input_driver_t** input, void** input_data)
{
int i;

View File

@ -103,7 +103,8 @@ static void xenon360_gfx_free(void *data)
free(vid);
}
static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
static void *xenon360_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
gl_t * gl = calloc(1, sizeof(gl_t));
if (!gl)

View File

@ -49,7 +49,7 @@ typedef struct xshm
GC gc;
} xshm_t;
static void *xshm_gfx_init(const video_info_t *video,
static void *xshm_gfx_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
xshm_t* xshm = (xshm_t*)malloc(sizeof(xshm_t));

View File

@ -319,7 +319,7 @@ static const struct format_desc formats[] = {
};
static bool xv_adaptor_set_format(xv_t *xv, Display *dpy,
XvPortID port, const video_info_t *video)
XvPortID port, 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(const video_info_t *video,
static void *xv_init(video_info_t *video,
const input_driver_t **input, void **input_data)
{
unsigned i;

View File

@ -824,6 +824,14 @@ 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);

View File

@ -54,6 +54,9 @@ typedef struct video_info
*/
unsigned height;
unsigned real_width;
unsigned real_height;
/* Launch in fullscreen mode instead of windowed mode. */
bool fullscreen;
@ -230,7 +233,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)(const video_info_t *video,
void *(*init)(video_info_t *video,
const input_driver_t **input,
void **input_data);

View File

@ -223,7 +223,7 @@ struct thread_video
};
static void *video_thread_init_never_call(const video_info_t *video,
static void *video_thread_init_never_call(video_info_t *video,
const input_driver_t **input, void **input_data)
{
(void)video;