(GL) Will have to rework set_viewport for the GL drivers -

video drivers should not be calling video_driver_build_info as
they could be on a separate thread
This commit is contained in:
twinaphex 2020-03-05 20:29:51 +01:00
parent a7d679d391
commit e65c816ed0

View File

@ -390,6 +390,7 @@ static void gl2_set_viewport(gl_t *gl,
bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
settings_t *settings = config_get_ptr();
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
@ -401,7 +402,7 @@ static void gl2_set_viewport(gl_t *gl,
video_context_driver_translate_aspect(&aspect_data);
if (video_info->scale_integer && !force_full)
if (settings->bools.video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp,
viewport_width, viewport_height,
@ -414,13 +415,14 @@ static void gl2_set_viewport(gl_t *gl,
float desired_aspect = video_driver_get_aspect_ratio();
#if defined(HAVE_MENU)
if (video_info->aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
/* GL has bottom-left origin viewport. */
x = video_info->custom_vp_x;
y = height - video_info->custom_vp_y - video_info->custom_vp_height;
viewport_width = video_info->custom_vp_width;
viewport_height = video_info->custom_vp_height;
x = custom->x;
y = height - custom->y - custom->height;
viewport_width = custom->width;
viewport_height = custom->height;
}
else
#endif