diff --git a/app/node/node.h b/app/node/node.h index 83f7e489c..355b39b50 100644 --- a/app/node/node.h +++ b/app/node/node.h @@ -22,7 +22,6 @@ #define NODE_H #include -#include #include #include #include diff --git a/app/node/param.h b/app/node/param.h index c860c4867..c88b1fb1b 100644 --- a/app/node/param.h +++ b/app/node/param.h @@ -21,7 +21,6 @@ #ifndef NODEPARAM_H #define NODEPARAM_H -#include #include #include #include diff --git a/app/render/backend/opengl/openglrenderfunctions.h b/app/render/backend/opengl/openglrenderfunctions.h index 493f29995..7540836da 100644 --- a/app/render/backend/opengl/openglrenderfunctions.h +++ b/app/render/backend/opengl/openglrenderfunctions.h @@ -22,6 +22,7 @@ #define OPENGLFUNCTIONS_H #include +#include #include #include "openglshader.h" @@ -48,6 +49,7 @@ public: static void OCIOBlit(OpenGLShaderPtr pipeline, GLuint lut, bool flipped = false, QMatrix4x4 matrix = QMatrix4x4()); static void PrepareToDraw(QOpenGLFunctions* f); + }; #endif // OPENGLFUNCTIONS_H diff --git a/app/render/backend/opengl/openglshader.cpp b/app/render/backend/opengl/openglshader.cpp index 0f17c5b12..13d2d8fd1 100644 --- a/app/render/backend/opengl/openglshader.cpp +++ b/app/render/backend/opengl/openglshader.cpp @@ -230,13 +230,3 @@ QString OpenGLShader::CodeAlphaAssociate(const QString &function_name) " return vec4(col.rgb * col.a, col.a);\n" "}\n").arg(function_name); } - -void OpenGLShader::Lock() -{ - lock_.lock(); -} - -void OpenGLShader::Unlock() -{ - lock_.unlock(); -} diff --git a/app/render/backend/opengl/openglshader.h b/app/render/backend/opengl/openglshader.h index 7f250e693..f1d4c56db 100644 --- a/app/render/backend/opengl/openglshader.h +++ b/app/render/backend/opengl/openglshader.h @@ -2,7 +2,6 @@ #define OPENGLSHADER_H #include -#include #include #include @@ -33,11 +32,6 @@ public: static QString CodeAlphaReassociate(const QString& function_name); static QString CodeAlphaAssociate(const QString& function_name); - void Lock(); - void Unlock(); - -private: - QMutex lock_; }; #endif // OPENGLSHADER_H diff --git a/app/render/backend/opengl/openglworker.cpp b/app/render/backend/opengl/openglworker.cpp index 8e9e85c19..83eb39587 100644 --- a/app/render/backend/opengl/openglworker.cpp +++ b/app/render/backend/opengl/openglworker.cpp @@ -180,7 +180,6 @@ void OpenGLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, } // Lock the shader so no other thread interferes as we set parameters and draw (and we don't interfere with any others) - shader->Lock(); shader->bind(); unsigned int input_texture_count = 0; @@ -292,35 +291,32 @@ void OpenGLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, static_cast(video_params().width()), static_cast(video_params().height())); - if (node->IsBlock()) { - const Block* block_node = static_cast(node); + if (node->IsBlock() && static_cast(node)->type() == Block::kTransition) { + const TransitionBlock* transition_node = static_cast(node); - if (block_node->type() == Block::kTransition) { - const TransitionBlock* transition_node = static_cast(node); + // Provides total transition progress from 0.0 (start) - 1.0 (end) + shader->setUniformValue("ove_tprog_all", static_cast(transition_node->GetTotalProgress(range.in()))); - // Provides total transition progress from 0.0 (start) - 1.0 (end) - shader->setUniformValue("ove_tprog_all", static_cast(transition_node->GetTotalProgress(range.in()))); + // Provides progress of out section from 1.0 (start) - 0.0 (end) + shader->setUniformValue("ove_tprog_out", static_cast(transition_node->GetOutProgress(range.in()))); - // Provides progress of out section from 1.0 (start) - 0.0 (end) - shader->setUniformValue("ove_tprog_out", static_cast(transition_node->GetOutProgress(range.in()))); - - // Provides progress of in section from 0.0 (start) - 1.0 (end) - shader->setUniformValue("ove_tprog_in", static_cast(transition_node->GetInProgress(range.in()))); - } + // Provides progress of in section from 0.0 (start) - 1.0 (end) + shader->setUniformValue("ove_tprog_in", static_cast(transition_node->GetInProgress(range.in()))); } // Some nodes use multiple iterations for optimization OpenGLTextureCache::ReferencePtr output_tex; for (int iteration=0;iterationAcceleratedCodeIterations();iteration++) { + // If this is not the first iteration, set the parameter that will receive the last iteration's texture + OpenGLTextureCache::ReferencePtr source_tex = dst_refs.at((iteration+1)%dst_refs.size()); + OpenGLTextureCache::ReferencePtr destination_tex = dst_refs.at(iteration%dst_refs.size()); + // Set iteration number shader->bind(); shader->setUniformValue("ove_iteration", iteration); shader->release(); - // If this is not the first iteration, set the parameter that will receive the last iteration's texture - OpenGLTextureCache::ReferencePtr source_tex = dst_refs.at((iteration+1)%dst_refs.size()); - OpenGLTextureCache::ReferencePtr destination_tex = dst_refs.at(iteration%dst_refs.size()); if (iteration > 0) { functions_->glActiveTexture(GL_TEXTURE0 + iterative_input); functions_->glBindTexture(GL_TEXTURE_2D, source_tex->texture()->texture()); @@ -339,10 +335,6 @@ void OpenGLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, output_tex = destination_tex; } - // Make sure all OpenGL functions are complete by this point before unlocking the shader (or another thread may - // change its parameters before our drawing in this thread is done) - shader->Unlock(); - // Release any textures we bound before while (input_texture_count > 0) { input_texture_count--; @@ -371,8 +363,8 @@ void OpenGLWorker::TextureToBuffer(const QVariant &tex_in, QByteArray &buffer) f->glReadPixels(0, 0, - texture->texture()->width(), - texture->texture()->height(), + video_params().effective_width(), + video_params().effective_height(), format_info.pixel_format, format_info.gl_pixel_type, buffer.data());