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
View File
@@ -541,10 +541,6 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
// thread safety (see docs for ComposeSequenceParams::main_buffer_mutex)
if (final_fbo == params.main_buffer) {
params.main_buffer_mutex->lock();
}
// bind front buffer as draw buffer
params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, final_fbo);
@@ -593,10 +589,6 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
// unbind framebuffer
params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
// thread safety (see docs for ComposeSequenceParams::main_buffer_mutex)
if (final_fbo == params.main_buffer) {
params.main_buffer_mutex->unlock();
}
-10
View File
@@ -174,16 +174,6 @@ struct ComposeSequenceParams {
*/
GLuint main_attachment;
/**
* @brief Mutex for the main framebuffer
*
* Used only for video rendering. Never accessed with audio rendering.
*
* If this is not nullptr, compose_sequence() will lock this mutex when rendering to main_buffer/main_attachment.
* Used to synchronize ViewerWidget and ViewerWindow with RenderThread.
*/
QMutex* main_buffer_mutex;
/**
* @brief Backend OpenGL framebuffer 1 used for further processing before rendering to main_buffer
*
+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);
}
+1
View File
@@ -613,6 +613,7 @@ void ViewerWidget::paintGL() {
}
glDisable(GL_TEXTURE_2D);
glFinish();
if (window->isVisible()) {
window->set_texture(tex, double(viewer->seq->width)/double(viewer->seq->height), tex_lock);