From 5424e06a09355d820d87e51ed62985ac60f7ce6c Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 10 Dec 2012 13:02:59 +0100 Subject: [PATCH] Only increment to next frame if frame is non-NULL. --- gfx/gl.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index b9ddeda97e..66a536e76e 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -913,7 +913,7 @@ static void gl_init_textures_data(gl_t *gl) for (unsigned i = 0; i < TEXTURES; i++) { - gl->prev_info[i].tex = gl->texture[(gl->tex_index - (i + 1)) & TEXTURES_MASK]; + gl->prev_info[i].tex = gl->texture[0]; gl->prev_info[i].input_size[0] = gl->tex_w; gl->prev_info[i].tex_size[0] = gl->tex_w; gl->prev_info[i].input_size[1] = gl->tex_h; @@ -1108,8 +1108,6 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_shader_use_func(gl, 1); gl->frame_count++; - glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); - #ifdef HAVE_FBO // Render to texture in first pass. if (gl->fbo_inited) @@ -1130,16 +1128,6 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_update_resize(gl); } - if (frame) // Can be NULL for frame dupe / NULL render. - { - gl_update_input_size(gl, width, height, pitch); - - RARCH_PERFORMANCE_INIT(copy_frame); - RARCH_PERFORMANCE_START(copy_frame); - gl_copy_frame(gl, frame, width, height, pitch); - RARCH_PERFORMANCE_STOP(copy_frame); - } - struct gl_tex_info tex_info = {0}; tex_info.tex = gl->texture[gl->tex_index]; tex_info.input_size[0] = width; @@ -1149,6 +1137,21 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei memcpy(tex_info.coord, gl->tex_coords, sizeof(gl->tex_coords)); + if (frame) // Can be NULL for frame dupe / NULL render. + { + gl_next_texture_index(gl, &tex_info); + glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); + + gl_update_input_size(gl, width, height, pitch); + + RARCH_PERFORMANCE_INIT(copy_frame); + RARCH_PERFORMANCE_START(copy_frame); + gl_copy_frame(gl, frame, width, height, pitch); + RARCH_PERFORMANCE_STOP(copy_frame); + } + else + glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); + glClear(GL_COLOR_BUFFER_BIT); gl_shader_set_params_func(gl, width, height, gl->tex_w, gl->tex_h, @@ -1164,8 +1167,6 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_frame_fbo(gl, &tex_info); #endif - gl_next_texture_index(gl, &tex_info); - #ifdef FPS_COUNTER bool fps_enable = g_extern.console.rmenu.state.msg_fps.enable; if (fps_enable)