renderer: moved alpha channel detection to where texture is actually made

This commit is contained in:
itsmattkc
2020-11-16 02:02:12 +11:00
parent 1dd7e24920
commit 17b9a7e3ad
2 changed files with 19 additions and 16 deletions
-12
View File
@@ -286,7 +286,6 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
QString iterative_name;
GLuint iterative_input = 0;
QVector<TextureToBind> textures_to_bind;
bool input_textures_have_alpha = false;
QOpenGLShaderProgram* shader = Node::ValueToPtr<QOpenGLShaderProgram>(s);
@@ -360,10 +359,6 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
GLuint tex_id = texture ? texture->id().value<GLuint>() : 0;
textures_to_bind.append({texture, job.GetInterpolation(it.key())});
if (texture && texture->channel_count() == VideoParams::kRGBAChannelCount) {
input_textures_have_alpha = true;
}
// Set enable flag if shader wants it
int enable_param_location = shader->uniformLocation(QStringLiteral("%1_enabled").arg(it.key()));
if (enable_param_location > -1) {
@@ -440,13 +435,6 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
destination_params.effective_width(),
destination_params.effective_height());
// Set whether our destination texture needs an alpha channel
if (input_textures_have_alpha || job.GetAlphaChannelRequired()) {
destination_params.set_channel_count(VideoParams::kRGBAChannelCount);
} else {
destination_params.set_channel_count(VideoParams::kRGBChannelCount);
}
// Bind vertex array object
QOpenGLVertexArrayObject vao_;
vao_.create();