diff --git a/gfx/fonts/freetype.c b/gfx/fonts/freetype.c index 53e5557414..7014c8c28c 100644 --- a/gfx/fonts/freetype.c +++ b/gfx/fonts/freetype.c @@ -266,3 +266,21 @@ void gl_render_msg(gl_t *gl, const char *msg) (void)msg; #endif } + +void gl_render_msg_pre(gl_t *gl) +{ +#ifdef HAVE_FREETYPE +#ifdef HAVE_CG + gl_shader_use(0); +#endif + set_viewport(gl, gl->win_width, gl->win_height, false, false); + glEnable(GL_BLEND); +#endif +} + +void gl_render_msg_post(gl_t *gl) +{ +#ifdef HAVE_FREETYPE + gl_old_render_path(gl); +#endif +} diff --git a/gfx/fonts/ps3_libdbgfont.c b/gfx/fonts/ps3_libdbgfont.c index 51f4951987..ffee675870 100644 --- a/gfx/fonts/ps3_libdbgfont.c +++ b/gfx/fonts/ps3_libdbgfont.c @@ -40,3 +40,9 @@ void gl_render_msg(gl_t *gl, const char *msg) cellDbgFontPrintf(g_settings.video.msg_pos_x, g_settings.video.msg_pos_y, 1.10f, WHITE, msg); } +void gl_render_msg_pre(gl_t *gl) { } + +void gl_render_msg_post(gl_t *gl) +{ + cellDbgFontDraw(); +} diff --git a/gfx/gl.c b/gfx/gl.c index 21fd6e90ed..2da9d6909a 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -445,7 +445,7 @@ static void set_projection(gl_t *gl, bool allow_rotate) gl_shader_set_proj_matrix(); } -static void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate) +void set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate) { if (gl->keep_aspect && !force_full) { @@ -836,15 +836,7 @@ static void gl_next_texture_index(gl_t *gl, const struct gl_tex_info *tex_info) gl->tex_index = (gl->tex_index + 1) & TEXTURES_MASK; } -#ifdef HAVE_FREETYPE -static inline void gl_render_msg_pre(gl_t *gl) -{ - gl_shader_use(0); - set_viewport(gl, gl->win_width, gl->win_height, false, false); - glEnable(GL_BLEND); -} - -static inline void gl_render_msg_post(gl_t *gl) +void gl_old_render_path (gl_t *gl) { // Go back to old rendering path. glTexCoordPointer(2, GL_FLOAT, 0, gl->tex_coords); @@ -855,17 +847,6 @@ static inline void gl_render_msg_post(gl_t *gl) glDisable(GL_BLEND); set_projection(gl, true); } -#elif defined(__CELLOS_LV2__) -static inline void gl_render_msg_pre(gl_t *gl) { } - -static inline void gl_render_msg_post(gl_t *gl) -{ - cellDbgFontDraw(); -} -#else -#define gl_render_msg_pre(...) -#define gl_render_msg_post(...) -#endif static bool gl_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg) { diff --git a/gfx/gl_font.h b/gfx/gl_font.h index 5ee5c3ad8b..6fd286bafa 100644 --- a/gfx/gl_font.h +++ b/gfx/gl_font.h @@ -23,9 +23,8 @@ void gl_deinit_font(gl_t *gl); void gl_render_msg(gl_t *gl, const char *msg); -extern void gl_init_font_ctx(gl_t *gl, const char *font_path, unsigned font_size); -extern void gl_deinit_font_ctx(gl_t *gl); -extern void gl_render_msg_ctx(gl_t *gl, const char *msg); +void gl_render_msg_post(gl_t *gl); +void gl_render_msg_pre(gl_t *gl); #endif diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index 1c976fa774..e17bd07fc1 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -222,6 +222,17 @@ static void gl_shader_deinit(void) #endif } +static void gl_shader_set_proj_matrix(void) +{ +#ifdef HAVE_CG + gl_cg_set_proj_matrix(); +#endif + +#ifdef HAVE_XML + gl_glsl_set_proj_matrix(); +#endif +} + static void gl_shader_set_params(unsigned width, unsigned height, unsigned tex_width, unsigned tex_height, unsigned out_width, unsigned out_height, @@ -473,6 +484,23 @@ error: RARCH_ERR("Failed to set up frame buffer objects. Multi-pass shading will not work.\n"); } +//////////// + +static void set_projection(gl_t *gl, bool allow_rotate) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + if (allow_rotate) + glRotatef(gl->rotation, 0, 0, 1); + + glOrtho(0, 1, 0, 1, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + gl_shader_set_proj_matrix(); +} + static inline void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height, unsigned vp_width, unsigned vp_height) { @@ -753,15 +781,7 @@ static void gl_init_textures(gl_t *gl) } #endif -#ifdef HAVE_FREETYPE -static inline void gl_render_msg_pre(gl_t *gl) -{ - gl_shader_use(0); - set_viewport(gl, gl->win_width, gl->win_height, false, false); - glEnable(GL_BLEND); -} - -static inline void gl_render_msg_post(gl_t *gl) +void gl_old_render_path (gl_t *gl) { // Go back to old rendering path. glTexCoordPointer(2, GL_FLOAT, 0, gl->tex_coords); @@ -772,17 +792,6 @@ static inline void gl_render_msg_post(gl_t *gl) glDisable(GL_BLEND); set_projection(gl, true); } -#elif defined(__CELLOS_LV2__) -static inline void gl_render_msg_pre(gl_t *gl) { } - -static inline void gl_render_msg_post(gl_t *gl) -{ - cellDbgFontDraw(); -} -#else -#define gl_render_msg_pre(...) -#define gl_render_msg_post(...) -#endif static bool gl_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg) {