Remove video_driver_context_get_size

This commit is contained in:
twinaphex 2020-07-27 14:33:21 +02:00
parent d6465a1348
commit 7f1cd52d65
7 changed files with 91 additions and 72 deletions

View File

@ -3575,7 +3575,6 @@ static void *gl2_init(const video_info_t *video,
input_driver_t **input, void **input_data) input_driver_t **input, void **input_data)
{ {
enum gfx_wrap_type wrap_type; enum gfx_wrap_type wrap_type;
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp; gfx_ctx_input_t inp;
unsigned full_x, full_y; unsigned full_x, full_y;
video_shader_ctx_info_t shader_info; 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; bool video_gpu_record = settings->bools.video_gpu_record;
int interval = 0; int interval = 0;
unsigned mip_level = 0; unsigned mip_level = 0;
unsigned mode_width = 0;
unsigned mode_height = 0;
unsigned win_width = 0; unsigned win_width = 0;
unsigned win_height = 0; unsigned win_height = 0;
unsigned temp_width = 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); 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) #if defined(DINGUX)
mode.width = 320; mode_width = 320;
mode.height = 240; mode_height = 240;
#endif #endif
full_x = mode.width; full_x = mode_width;
full_y = mode.height; full_y = mode_height;
interval = 0; interval = 0;
RARCH_LOG("[GL]: Detecting screen resolution %ux%u.\n", full_x, full_y); 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->vsync = video->vsync;
gl->fullscreen = video->fullscreen; gl->fullscreen = video->fullscreen;
mode.width = 0; mode_width = 0;
mode.height = 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) #if defined(DINGUX)
mode.width = 320; mode_width = 320;
mode.height = 240; mode_height = 240;
#endif #endif
temp_width = mode.width; temp_width = mode_width;
temp_height = mode.height; temp_height = mode_height;
/* Get real known video size, which might have been altered by context. */ /* Get real known video size, which might have been altered by context. */

View File

@ -219,9 +219,10 @@ static void *gl1_gfx_init(const video_info_t *video,
{ {
unsigned full_x, full_y; unsigned full_x, full_y;
gfx_ctx_input_t inp; gfx_ctx_input_t inp;
gfx_ctx_mode_t mode;
void *ctx_data = NULL; void *ctx_data = NULL;
const gfx_ctx_driver_t *ctx_driver = 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 win_width = 0, win_height = 0;
unsigned temp_width = 0, temp_height = 0; unsigned temp_width = 0, temp_height = 0;
settings_t *settings = config_get_ptr(); 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); 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_x = mode_width;
full_y = mode.height; full_y = mode_height;
mode.width = 0; mode_width = 0;
mode.height = 0; mode_height = 0;
#ifdef VITA #ifdef VITA
if (!vgl_inited) if (!vgl_inited)
{ {
@ -301,9 +304,8 @@ static void *gl1_gfx_init(const video_info_t *video,
win_height = full_y; win_height = full_y;
} }
mode.width = win_width; mode_width = win_width;
mode.height = win_height; mode_height = win_height;
mode.fullscreen = video->fullscreen;
interval = video->swap_interval; interval = video->swap_interval;
@ -323,13 +325,15 @@ static void *gl1_gfx_init(const video_info_t *video,
gl1->fullscreen = video->fullscreen; gl1->fullscreen = video->fullscreen;
mode.width = 0; mode_width = 0;
mode.height = 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_width = mode_width;
temp_height = mode.height; temp_height = mode_height;
/* Get real known video size, which might have been altered by context. */ /* 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 frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t *video_info) unsigned pitch, const char *msg, video_frame_info_t *video_info)
{ {
gfx_ctx_mode_t mode;
const void *frame_to_copy = NULL; const void *frame_to_copy = NULL;
unsigned mode_width = 0;
unsigned mode_height = 0;
unsigned width = 0; unsigned width = 0;
unsigned height = 0; unsigned height = 0;
bool draw = true; bool draw = true;
@ -779,10 +784,12 @@ static bool gl1_gfx_frame(void *data, const void *frame,
gl1->video_height = height; 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_width = mode_width;
gl1->screen_height = mode.height; gl1->screen_height = mode_height;
if (draw) if (draw)
{ {

View File

@ -1152,12 +1152,13 @@ static void gl_core_set_viewport_wrapper(void *data,
static void *gl_core_init(const video_info_t *video, static void *gl_core_init(const video_info_t *video,
input_driver_t **input, void **input_data) input_driver_t **input, void **input_data)
{ {
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp; gfx_ctx_input_t inp;
unsigned full_x, full_y; unsigned full_x, full_y;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool video_gpu_record = settings->bools.video_gpu_record; bool video_gpu_record = settings->bools.video_gpu_record;
int interval = 0; int interval = 0;
unsigned mode_width = 0;
unsigned mode_height = 0;
unsigned win_width = 0; unsigned win_width = 0;
unsigned win_height = 0; unsigned win_height = 0;
unsigned temp_width = 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); 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_x = mode_width;
full_y = mode.height; full_y = mode_height;
mode.width = 0; mode_width = 0;
mode.height = 0; mode_height = 0;
interval = 0; interval = 0;
RARCH_LOG("[GLCore]: Detecting screen resolution %ux%u.\n", full_x, full_y); 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->fullscreen = video->fullscreen;
gl->keep_aspect = video->force_aspect; gl->keep_aspect = video->force_aspect;
mode.width = 0; mode_width = 0;
mode.height = 0; mode_height = 0;
video_context_driver_get_video_size(&mode); if (gl->ctx_driver->get_video_size)
temp_width = mode.width; gl->ctx_driver->get_video_size(gl->ctx_data,
temp_height = mode.height; &mode_width, &mode_height);
temp_width = mode_width;
temp_height = mode_height;
/* Get real known video size, which might have been altered by context. */ /* Get real known video size, which might have been altered by context. */

View File

@ -108,11 +108,12 @@ static INLINE bool vg_query_extension(const char *ext)
static void *vg_init(const video_info_t *video, static void *vg_init(const video_info_t *video,
input_driver_t **input, void **input_data) input_driver_t **input, void **input_data)
{ {
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp; gfx_ctx_input_t inp;
unsigned win_width, win_height; unsigned win_width, win_height;
VGfloat clearColor[4] = {0, 0, 0, 1}; VGfloat clearColor[4] = {0, 0, 0, 1};
int interval = 0; int interval = 0;
unsigned mode_width = 0;
unsigned mode_height = 0;
unsigned temp_width = 0; unsigned temp_width = 0;
unsigned temp_height = 0; unsigned temp_height = 0;
void *ctx_data = NULL; void *ctx_data = NULL;
@ -138,10 +139,12 @@ static void *vg_init(const video_info_t *video,
vg->ctx_driver = ctx; vg->ctx_driver = ctx;
video_context_driver_set((void*)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_width = mode_width;
temp_height = mode.height; temp_height = mode_height;
RARCH_LOG("[VG]: Detecting screen resolution %ux%u.\n", temp_width, temp_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_width = 0;
temp_height = 0; temp_height = 0;
mode.width = 0; mode_width = 0;
mode.height = 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_width = mode_width;
temp_height = mode.height; temp_height = mode_height;
vg->should_resize = true; vg->should_resize = true;

View File

@ -1164,11 +1164,12 @@ static void *vulkan_init(const video_info_t *video,
input_driver_t **input, input_driver_t **input,
void **input_data) void **input_data)
{ {
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp; gfx_ctx_input_t inp;
unsigned full_x, full_y; unsigned full_x, full_y;
unsigned win_width; unsigned win_width;
unsigned win_height; unsigned win_height;
unsigned mode_width = 0;
unsigned mode_height = 0;
int interval = 0; int interval = 0;
unsigned temp_width = 0; unsigned temp_width = 0;
unsigned temp_height = 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); RARCH_LOG("[Vulkan]: Found vulkan context: %s\n", ctx_driver->ident);
video_context_driver_get_video_size(&mode); if (vk->ctx_driver->get_video_size)
full_x = mode.width; vk->ctx_driver->get_video_size(vk->ctx_data,
full_y = mode.height; &mode_width, &mode_height);
mode.width = 0;
mode.height = 0; 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); RARCH_LOG("[Vulkan]: Detecting screen resolution %ux%u.\n", full_x, full_y);
interval = video->vsync ? video->swap_interval : 0; interval = video->vsync ? video->swap_interval : 0;
@ -1225,9 +1229,12 @@ static void *vulkan_init(const video_info_t *video,
goto error; goto error;
} }
video_context_driver_get_video_size(&mode); if (vk->ctx_driver->get_video_size)
temp_width = mode.width; vk->ctx_driver->get_video_size(vk->ctx_data,
temp_height = mode.height; &mode_width, &mode_height);
temp_width = mode_width;
temp_height = mode_height;
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
video_driver_set_size(temp_width, temp_height); video_driver_set_size(temp_width, temp_height);

View File

@ -33377,16 +33377,6 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident)
return true; 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) bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
{ {
struct rarch_state *p_rarch = &rarch_st; 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_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_get_refresh_rate(float *refresh_rate);
bool video_context_driver_set_flags(gfx_ctx_flags_t *flags); bool video_context_driver_set_flags(gfx_ctx_flags_t *flags);