Merge pull request #8559 from jdgleaver/font-alignment

(Menu Widgets) Fix text alignment issues with Vulkan and D3D video drivers
This commit is contained in:
Twinaphex 2019-04-08 14:53:00 +02:00 committed by GitHub
commit 682d757cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 11 deletions

View File

@ -2366,7 +2366,7 @@ static void vulkan_unload_texture(void *data, uintptr_t handle)
{
vk_t *vk = (vk_t*)data;
struct vk_texture *texture = (struct vk_texture*)handle;
if (!texture)
if (!texture || !vk)
return;
/* TODO: We really want to defer this deletion instead,

View File

@ -178,8 +178,8 @@ static void d3d10_font_render_line(
if (!glyph)
continue;
v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d10->viewport.Width;
v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d10->viewport.Height;
v->pos.x = (x + (glyph->draw_offset_x * scale)) / (float)d3d10->viewport.Width;
v->pos.y = (y + (glyph->draw_offset_y * scale)) / (float)d3d10->viewport.Height;
v->pos.w = glyph->width * scale / (float)d3d10->viewport.Width;
v->pos.h = glyph->height * scale / (float)d3d10->viewport.Height;

View File

@ -176,8 +176,8 @@ static void d3d11_font_render_line(
if (!glyph)
continue;
v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d11->viewport.Width;
v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d11->viewport.Height;
v->pos.x = (x + (glyph->draw_offset_x * scale)) / (float)d3d11->viewport.Width;
v->pos.y = (y + (glyph->draw_offset_y * scale)) / (float)d3d11->viewport.Height;
v->pos.w = glyph->width * scale / (float)d3d11->viewport.Width;
v->pos.h = glyph->height * scale / (float)d3d11->viewport.Height;

View File

@ -184,8 +184,8 @@ static void d3d12_font_render_line(
if (!glyph)
continue;
v->pos.x = (x + glyph->draw_offset_x) * scale / (float)d3d12->chain.viewport.Width;
v->pos.y = (y + glyph->draw_offset_y) * scale / (float)d3d12->chain.viewport.Height;
v->pos.x = (x + (glyph->draw_offset_x * scale)) / (float)d3d12->chain.viewport.Width;
v->pos.y = (y + (glyph->draw_offset_y * scale)) / (float)d3d12->chain.viewport.Height;
v->pos.w = glyph->width * scale / (float)d3d12->chain.viewport.Width;
v->pos.h = glyph->height * scale / (float)d3d12->chain.viewport.Height;

View File

@ -203,8 +203,8 @@ static void vulkan_raster_font_render_line(
height = glyph->height;
vulkan_write_quad_vbo(font->pv + font->vertices,
(x + off_x + delta_x * scale) * inv_win_width,
(y + off_y + delta_y * scale) * inv_win_height,
(x + (off_x + delta_x) * scale) * inv_win_width,
(y + (off_y + delta_y) * scale) * inv_win_height,
width * scale * inv_win_width,
height * scale * inv_win_height,
tex_x * inv_tex_size_x,

View File

@ -208,7 +208,7 @@ static char *menu_widgets_icons_names[MENU_WIDGETS_ICON_LAST] = {
"menu_info.png"
};
static menu_texture_item menu_widgets_icons_textures[MENU_WIDGETS_ICON_LAST];
static menu_texture_item menu_widgets_icons_textures[MENU_WIDGETS_ICON_LAST] = {0};
/* Volume */
static float volume_db = 0.0f;
@ -1776,6 +1776,9 @@ void menu_widgets_free(void)
{
int i;
if (!menu_widgets_inited)
return;
menu_widgets_inited = false;
/* Kill any pending animation */
@ -2078,4 +2081,4 @@ void menu_widgets_start_load_content_animation(const char *content_name, bool re
bool menu_widgets_ready(void)
{
return menu_widgets_inited;
}
}

View File

@ -700,6 +700,13 @@ void driver_uninit(int flags)
#ifdef HAVE_MENU
if (flags & DRIVER_MENU_MASK)
{
#if defined(HAVE_MENU_WIDGETS)
/* This absolutely has to be done before video_driver_free()
* is called/completes, otherwise certain menu drivers
* (e.g. Vulkan) will segfault */
menu_widgets_context_destroy();
menu_widgets_free();
#endif
menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
menu_driver_free();
}