From f1eb095a0cec9b50a03942f86466cb2ebf8a8db5 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 20 Aug 2024 22:43:34 +0300 Subject: [PATCH] opengl: Drop GLTexture::clear() It's used only by the decoration renderer, but even it doesn't need it because the atlas parts are padded. From the API point of view, it's worth looking for alternative solutions, like integrating the render target clear step in the render passes. And texture uploading code usually doesn't need to clear the texture because it is going to overwrite its contents anyway. --- src/opengl/gltexture.cpp | 11 ----------- src/opengl/gltexture.h | 4 ---- src/scene/workspacescene_opengl.cpp | 1 - 3 files changed, 16 deletions(-) diff --git a/src/opengl/gltexture.cpp b/src/opengl/gltexture.cpp index 02c5732056..cd8ca155f5 100644 --- a/src/opengl/gltexture.cpp +++ b/src/opengl/gltexture.cpp @@ -353,17 +353,6 @@ GLenum GLTexture::internalFormat() const return d->m_internalFormat; } -void GLTexture::clear() -{ - Q_ASSERT(d->m_owning); - GLFramebuffer fbo(this); - GLFramebuffer::pushFramebuffer(&fbo); - glClearColor(0, 0, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, d->m_texture, 0); - glClear(GL_COLOR_BUFFER_BIT); - GLFramebuffer::popFramebuffer(); -} - bool GLTexture::isDirty() const { return d->m_markedDirty; diff --git a/src/opengl/gltexture.h b/src/opengl/gltexture.h index 43c63a0f37..9a89974df1 100644 --- a/src/opengl/gltexture.h +++ b/src/opengl/gltexture.h @@ -98,10 +98,6 @@ public: QImage toImage(); - /** @short - * Make the texture fully transparent - */ - void clear(); /** * @deprecated track modifications to the texture yourself */ diff --git a/src/scene/workspacescene_opengl.cpp b/src/scene/workspacescene_opengl.cpp index 5db1a7f925..e8b3b1f598 100644 --- a/src/scene/workspacescene_opengl.cpp +++ b/src/scene/workspacescene_opengl.cpp @@ -472,7 +472,6 @@ void SceneOpenGLDecorationRenderer::resizeTexture() m_texture->setContentTransform(OutputTransform::FlipY); m_texture->setFilter(GL_LINEAR); m_texture->setWrapMode(GL_CLAMP_TO_EDGE); - m_texture->clear(); } else { m_texture.reset(); }