From c17714ffbbab6bd44aeec361f7b521d4309d54db Mon Sep 17 00:00:00 2001 From: Themaister Date: Sat, 13 Apr 2013 16:48:03 +0200 Subject: [PATCH] Add full screen mode to set_texture_enable. --- driver.h | 2 +- frontend/menu/rgui.c | 4 ++-- gfx/d3d9/d3d9.cpp | 3 ++- gfx/gl.c | 14 ++++++++++++-- gfx/gl_common.h | 1 + gfx/thread_wrapper.c | 6 ++++-- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/driver.h b/driver.h index fe15f6ccf2..fd0c69ef7a 100644 --- a/driver.h +++ b/driver.h @@ -341,7 +341,7 @@ typedef struct video_poke_interface #if defined(HAVE_RGUI) || defined(HAVE_RMENU) void (*set_texture_frame)(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha); // Update texture. - void (*set_texture_enable)(void *data, bool enable); // Enable/disable rendering. + void (*set_texture_enable)(void *data, bool enable, bool full_screen); // Enable/disable rendering. #endif void (*set_osd_msg)(void *data, const char *msg, void *userdata); diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index bd221b5c69..0fdf1f4726 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -2163,13 +2163,13 @@ bool menu_iterate(void) { driver.video_poke->set_texture_frame(driver.video_data, menu_framebuf, false, RGUI_WIDTH, RGUI_HEIGHT, 1.0f); - driver.video_poke->set_texture_enable(driver.video_data, true); + driver.video_poke->set_texture_enable(driver.video_data, true, false); } rarch_render_cached_frame(); if (driver.video_poke && driver.video_poke->set_texture_enable) - driver.video_poke->set_texture_enable(driver.video_data, false); + driver.video_poke->set_texture_enable(driver.video_data, false, false); input_process_ret = menu_input_process(NULL, NULL); diff --git a/gfx/d3d9/d3d9.cpp b/gfx/d3d9/d3d9.cpp index 6b5ed55a22..df417f048d 100644 --- a/gfx/d3d9/d3d9.cpp +++ b/gfx/d3d9/d3d9.cpp @@ -1436,8 +1436,9 @@ static void d3d9_set_rgui_texture_frame(void *data, reinterpret_cast(data)->set_rgui_texture_frame(frame, rgb32, width, height, alpha); } -static void d3d9_set_rgui_texture_enable(void *data, bool state) +static void d3d9_set_rgui_texture_enable(void *data, bool state, bool full_screen) { + (void)full_screen; // Ignore for now. reinterpret_cast(data)->set_rgui_texture_enable(state); } #endif diff --git a/gfx/gl.c b/gfx/gl.c index 2cc0711cf2..93b42916d1 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1286,7 +1286,16 @@ static inline void gl_draw_texture(void *data) glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + if (gl->rgui_texture_full_screen) + { + glViewport(0, 0, gl->win_width, gl->win_height); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height); + } + else + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDisable(GL_BLEND); gl->coords.tex_coord = gl->tex_coords; @@ -2345,10 +2354,11 @@ static void gl_set_texture_frame(void *data, glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); } -static void gl_set_texture_enable(void *data, bool state) +static void gl_set_texture_enable(void *data, bool state, bool full_screen) { gl_t *gl = (gl_t*)data; gl->rgui_texture_enable = state; + gl->rgui_texture_full_screen = full_screen; } #endif diff --git a/gfx/gl_common.h b/gfx/gl_common.h index ab135bf695..c942442c0b 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -278,6 +278,7 @@ typedef struct gl #if defined(HAVE_RGUI) || defined(HAVE_RMENU) GLuint rgui_texture; bool rgui_texture_enable; + bool rgui_texture_full_screen; GLfloat rgui_texture_alpha; #endif diff --git a/gfx/thread_wrapper.c b/gfx/thread_wrapper.c index 3850101053..82b4ebc497 100644 --- a/gfx/thread_wrapper.c +++ b/gfx/thread_wrapper.c @@ -81,6 +81,7 @@ typedef struct thread_video unsigned height; float alpha; bool enable; + bool full_screen; } texture; #endif bool apply_state_changes; @@ -308,7 +309,7 @@ static void thread_loop(void *data) } if (thr->poke && thr->poke->set_texture_enable) - thr->poke->set_texture_enable(thr->driver_data, thr->texture.enable); + thr->poke->set_texture_enable(thr->driver_data, thr->texture.enable, thr->texture.full_screen); #endif if (thr->apply_state_changes) @@ -655,12 +656,13 @@ static void thread_set_texture_frame(void *data, const void *frame, slock_unlock(thr->frame.lock); } -static void thread_set_texture_enable(void *data, bool state) +static void thread_set_texture_enable(void *data, bool state, bool full_screen) { thread_video_t *thr = (thread_video_t*)data; slock_lock(thr->frame.lock); thr->texture.enable = state; + thr->texture.full_screen = full_screen; slock_unlock(thr->frame.lock); } #endif