From 81447c439fd11866bf4c37ff3a4792209df5ffbb Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 22 Nov 2020 10:32:22 +1100 Subject: [PATCH] opengl: update for shader changes mentioned earlier --- app/render/opengl/openglrenderer.cpp | 39 +++++----------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/app/render/opengl/openglrenderer.cpp b/app/render/opengl/openglrenderer.cpp index 06c655a54..36e1cc109 100644 --- a/app/render/opengl/openglrenderer.cpp +++ b/app/render/opengl/openglrenderer.cpp @@ -169,13 +169,13 @@ QVariant OpenGLRenderer::CreateNativeTexture2D(int width, int height, VideoParam functions_->glBindTexture(GL_TEXTURE_2D, texture); -{ + { - PRINT_GL_ERRORS; - functions_->glTexImage2D(GL_TEXTURE_2D, 0, GetInternalFormat(format, channel_count), - width, height, 0, GetPixelFormat(channel_count), - GetPixelType(format), data); -} + PRINT_GL_ERRORS; + functions_->glTexImage2D(GL_TEXTURE_2D, 0, GetInternalFormat(format, channel_count), + width, height, 0, GetPixelFormat(channel_count), + GetPixelType(format), data); + } functions_->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); @@ -418,35 +418,15 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video iterative_name = it.key(); } - GLuint tex_id = texture ? texture->id().value() : 0; textures_to_bind.append({texture, job.GetInterpolation(it.key())}); // Set enable flag if shader wants it + GLuint tex_id = texture ? texture->id().value() : 0; int enable_param_location = shader->uniformLocation(QStringLiteral("%1_enabled").arg(it.key())); if (enable_param_location > -1) { shader->setUniformValue(enable_param_location, tex_id > 0); } - - if (tex_id > 0) { - // Set texture resolution if shader wants it - int res_param_location = shader->uniformLocation(QStringLiteral("%1_resolution").arg(it.key())); - if (res_param_location > -1) { - int virtual_width = texture->params().width(); - - // Adjust virtual width by pixel aspect if necessary - if (texture->params().pixel_aspect_ratio() != 1 - || destination_params.pixel_aspect_ratio() != 1) { - double relative_pixel_aspect = texture->params().pixel_aspect_ratio().toDouble() / destination_params.pixel_aspect_ratio().toDouble(); - - virtual_width = qRound(static_cast(virtual_width) * relative_pixel_aspect); - } - - shader->setUniformValue(res_param_location, - virtual_width, - static_cast(texture->height() * texture->divider())); - } - } break; } case NodeInput::kSamples: @@ -483,11 +463,6 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video PrepareInputTexture(target, t.interpolation); } - // Set ove_resolution to the destination to the "logical" resolution of the destination - shader->setUniformValue("ove_resolution", - static_cast(destination_params.width()), - static_cast(destination_params.height())); - // Ensure matrix is set, at least to identity shader->setUniformValue("ove_mvpmat", job.GetValue(QStringLiteral("ove_mvpmat")).data.value());