diff --git a/gfx/fonts/gl_font.c b/gfx/fonts/gl_font.c index e7e4fccbd3..97548324f4 100644 --- a/gfx/fonts/gl_font.c +++ b/gfx/fonts/gl_font.c @@ -25,12 +25,13 @@ static const gl_font_renderer_t *gl_font_backends[] = { #endif }; -const gl_font_renderer_t *gl_font_init_first(void *data, const char *font_path, float font_size) +const gl_font_renderer_t *gl_font_init_first(void *data, const char *font_path, float font_size, + unsigned win_width, unsigned win_height) { size_t i; for (i = 0; i < ARRAY_SIZE(gl_font_backends); i++) { - if (gl_font_backends[i]->init(data, font_path, font_size)) + if (gl_font_backends[i]->init(data, font_path, font_size, win_width, win_height)) return gl_font_backends[i]; } diff --git a/gfx/fonts/gl_font.h b/gfx/fonts/gl_font.h index 98991f738a..21c63cf9d7 100644 --- a/gfx/fonts/gl_font.h +++ b/gfx/fonts/gl_font.h @@ -21,7 +21,8 @@ typedef struct gl_font_renderer { - bool (*init)(void *data, const char *font_path, float font_size); + bool (*init)(void *data, const char *font_path, float font_size, + unsigned win_width, unsigned win_height); void (*deinit)(void *data); void (*render_msg)(void *data, const char *msg, void *parms); const char *ident; @@ -31,7 +32,7 @@ extern const gl_font_renderer_t gl_raster_font; extern const gl_font_renderer_t libdbg_font; const gl_font_renderer_t *gl_font_init_first(void *data, - const char *font_path, float font_size); + const char *font_path, float font_size, unsigned win_width, unsigned win_height); #endif diff --git a/gfx/fonts/gl_raster_font.c b/gfx/fonts/gl_raster_font.c index e482d55f71..d5a6933d82 100644 --- a/gfx/fonts/gl_raster_font.c +++ b/gfx/fonts/gl_raster_font.c @@ -18,9 +18,12 @@ #include "../gl_common.h" #include "../shader_common.h" -static bool gl_init_font(void *data, const char *font_path, float font_size) +static bool gl_init_font(void *data, const char *font_path, float font_size, unsigned win_width, unsigned win_height) { size_t i, j; + (void)win_width; + (void)win_height; + if (!g_settings.video.font_enable) return false; diff --git a/gfx/fonts/ps_libdbgfont.c b/gfx/fonts/ps_libdbgfont.c index ade23ba409..bf6fdd86a9 100644 --- a/gfx/fonts/ps_libdbgfont.c +++ b/gfx/fonts/ps_libdbgfont.c @@ -32,7 +32,8 @@ #define DbgFontExit cellDbgFontExit #endif -static bool gl_init_font(void *data, const char *font_path, float font_size) +static bool gl_init_font(void *data, const char *font_path, float font_size, + unsigned win_width, unsigned win_height) { (void)font_path; (void)font_size; @@ -45,12 +46,9 @@ static bool gl_init_font(void *data, const char *font_path, float font_size) #if defined(SN_TARGET_PSP2) cfg.fontSize = SCE_DBGFONT_FONTSIZE_LARGE; #elif defined(__CELLOS_LV2__) - // FIXME - We need to do init_font_first in gl_start because of this - gl_t *gl = (gl_t*)driver.video_data; - cfg.bufSize = SCE_DBGFONT_BUFSIZE_LARGE; - cfg.screenWidth = gl->win_width; - cfg.screenHeight = gl->win_height; + cfg.screenWidth = win_width; + cfg.screenHeight = win_height; #endif DbgFontInit(&cfg); diff --git a/gfx/gl.c b/gfx/gl.c index 32a697c167..14a416331d 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1700,6 +1700,13 @@ static bool resolve_extensions(gl_t *gl) RARCH_WARN("[GL]: GLES implementation does not have BGRA8888 extension.\n" "32-bit path will require conversion.\n"); } + + gl->support_unpack_row_length = false; + if (gl_query_extension(gl, "GL_EXT_unpack_subimage")) + { + RARCH_LOG("[GL]: Extension GL_EXT_unpack_subimage, can copy textures faster using UNPACK_ROW_LENGTH.\n"); + gl->support_unpack_row_length = true; + } #endif #ifdef GL_DEBUG @@ -2151,25 +2158,16 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo if (input && input_data) context_input_driver_func(input, input_data); -#if !defined(RARCH_CONSOLE) - // Comes too early for console - moved to gl_start if (g_settings.video.font_enable) - gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size); -#endif + { + gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size, + gl->win_width, gl->win_height); + } #if !defined(HAVE_OPENGLES) && defined(HAVE_FFMPEG) gl_init_pbo_readback(gl); #endif -#if defined(HAVE_OPENGLES) - gl->support_unpack_row_length = false; - if (gl_query_extension(gl, "GL_EXT_unpack_subimage")) - { - RARCH_LOG("[GL]: Extension GL_EXT_unpack_subimage, can copy textures faster using UNPACK_ROW_LENGTH.\n"); - gl->support_unpack_row_length = true; - } -#endif - if (!gl_check_error()) { context_destroy_func(); @@ -2429,9 +2427,6 @@ static void gl_start(void) gl_t *gl = (gl_t*)driver.video_data; gl_get_poke_interface(gl, &driver.video_poke); - - // Comes too early for console - moved to gl_start - gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size); } static void gl_restart(void)