no need to compile a shader for multiplying alpha

This commit is contained in:
itsmattkc
2019-03-10 13:44:14 +11:00
parent a834c8dc7c
commit 636cf64b3e
4 changed files with 2 additions and 25 deletions
+2 -2
View File
@@ -367,11 +367,11 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
if (!c->media()->to_footage()->alpha_is_premultiplied) {
// alpha is not premultiplied, we'll need to multiply it for the rest of the pipeline
params.premultiply_program->bind();
params.ctx->functions()->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ZERO);
textureID = draw_clip(c->fbo[0], textureID, true);
params.premultiply_program->release();
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
fbo_switcher = true;
}
-12
View File
@@ -143,18 +143,6 @@ struct ComposeSequenceParams {
*/
QOpenGLShaderProgram* blend_mode_program;
/**
* @brief Premultiply alpha shader
*
* Used only for video rendering. Never accessed with audio rendering.
*
* compose_sequence()'s internal composition
* expects premultipled alpha, but it will pre-emptively multiply any footage that is not set as already
* premultiplied (see Footage::alpha_is_premultiplied) using this shader. Must be compiled and linked beforehand.
* See RenderThread::premultiply_program for how this is properly set up.
*/
QOpenGLShaderProgram* premultiply_program;
/**
* @brief The OpenGL framebuffer object that the final texture to be shown is rendered to.
*
-10
View File
@@ -39,7 +39,6 @@ RenderThread::RenderThread() :
share_ctx(nullptr),
ctx(nullptr),
blend_mode_program(nullptr),
premultiply_program(nullptr),
seq(nullptr),
tex_width(-1),
tex_height(-1),
@@ -104,11 +103,6 @@ void RenderThread::run() {
blend_mode_program->addShaderFromSourceCode(QOpenGLShader::Fragment, olive::generated_blending_shader);
olive::effects_loaded.unlock();
blend_mode_program->link();
premultiply_program = new QOpenGLShaderProgram();
premultiply_program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/internalshaders/common.vert");
premultiply_program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/internalshaders/premultiply.frag");
premultiply_program->link();
}
// draw frame
@@ -153,7 +147,6 @@ void RenderThread::paint() {
params.wait_for_mutexes = true;
params.playback_speed = 1;
params.blend_mode_program = blend_mode_program;
params.premultiply_program = premultiply_program;
params.backend_buffer1 = back_buffer_1.buffer();
params.backend_buffer2 = back_buffer_2.buffer();
params.backend_attachment1 = back_buffer_1.texture();
@@ -280,9 +273,6 @@ void RenderThread::delete_buffers() {
void RenderThread::delete_shaders() {
delete blend_mode_program;
blend_mode_program = nullptr;
delete premultiply_program;
premultiply_program = nullptr;
}
void RenderThread::delete_ctx() {
-1
View File
@@ -92,7 +92,6 @@ private:
QOpenGLContext* share_ctx;
QOpenGLContext* ctx;
QOpenGLShaderProgram* blend_mode_program;
QOpenGLShaderProgram* premultiply_program;
FramebufferObject back_buffer_1;
FramebufferObject back_buffer_2;