moved buffer mutex

This commit is contained in:
itsmattkc
2019-02-27 11:13:29 -08:00
parent a24b90c99e
commit d3487086c7
4 changed files with 9 additions and 22 deletions
+8 -4
View File
@@ -203,7 +203,9 @@ void RenderThread::paint() {
params.backend_attachment2 = back_texture_2;
params.main_buffer = front_buffer_switcher ? front_buffer1 : front_buffer2;
params.main_attachment = front_buffer_switcher ? front_texture1 : front_texture2;
params.main_buffer_mutex = front_buffer_switcher ? &front_mutex1 : &front_mutex2;
QMutex& active_mutex = front_buffer_switcher ? front_mutex1 : front_mutex2;
active_mutex.lock();
// bind framebuffer for drawing
ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, params.main_buffer);
@@ -223,8 +225,13 @@ void RenderThread::paint() {
compose_sequence(params);
// flush changes
ctx->functions()->glFinish();
texture_failed = params.texture_failed;
active_mutex.unlock();
if (!save_fn.isEmpty()) {
if (texture_failed) {
// texture failed, try again
@@ -263,9 +270,6 @@ void RenderThread::paint() {
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
// flush changes
ctx->functions()->glFinish();
// release
ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}