libobs-opengl: Fix bug switching render targets

If a render target was switched from one to another and then back
consecutively, the texture would not get reattached at the last point
due to the fact that the cur_render_target variable of the FBO storage
structure would already be set to that texture, and then it would never
get reattached because it thought it was already using that render
target.

So to fix this, any time a render target legitimately changes from one
to another, it sets the cur_render_target and cur_zstencil_buffer
variables of the FBO structure to null.
This commit is contained in:
jp9000 2015-03-17 18:05:06 -07:00
parent 86e56a5c4e
commit 2abf7b057a

View File

@ -658,6 +658,11 @@ static bool set_current_fbo(gs_device_t *device, struct fbo_info *fbo)
GLuint fbo_obj = fbo ? fbo->fbo : 0;
if (!gl_bind_framebuffer(GL_DRAW_FRAMEBUFFER, fbo_obj))
return false;
if (device->cur_fbo) {
device->cur_fbo->cur_render_target = NULL;
device->cur_fbo->cur_zstencil_buffer = NULL;
}
}
device->cur_fbo = fbo;