From f4af66d167e4d009a7aedae083d4826e5d04268e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 27 Apr 2023 18:35:58 +0300 Subject: [PATCH] scene: Don't touch texture sampling params in ItemRendererOpenGL Items must be responsible for choosing texture sampling parameters. Doing so in the ItemRendererOpenGL breaks the encapsulation. --- src/backends/x11/standalone/x11_standalone_glx_backend.cpp | 3 ++- .../scenes/opengl/basiceglsurfacetexture_wayland.cpp | 2 +- src/scene/itemrenderer_opengl.cpp | 2 -- src/scene/workspacescene_opengl.cpp | 5 +++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp index ba81ac0cda..bfcb7f44d2 100644 --- a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp @@ -945,7 +945,8 @@ bool GlxPixmapTexturePrivate::create(SurfacePixmapX11 *texture) glGenTextures(1, &m_texture); q->setDirty(); - q->setFilter(GL_NEAREST); + q->setFilter(GL_LINEAR); + q->setWrapMode(GL_CLAMP_TO_EDGE); glBindTexture(m_target, m_texture); glXBindTexImageEXT(m_backend->display(), m_glxPixmap, GLX_FRONT_LEFT_EXT, nullptr); diff --git a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp index 665d686156..8eb2e97c10 100644 --- a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp +++ b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp @@ -106,7 +106,7 @@ bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(KWaylandServer::LinuxDmaBu m_texture->setSize(buffer->size()); m_texture->create(); m_texture->setWrapMode(GL_CLAMP_TO_EDGE); - m_texture->setFilter(GL_NEAREST); + m_texture->setFilter(GL_LINEAR); m_texture->bind(); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast(image)); m_texture->unbind(); diff --git a/src/scene/itemrenderer_opengl.cpp b/src/scene/itemrenderer_opengl.cpp index 5217c80d41..3bd102348a 100644 --- a/src/scene/itemrenderer_opengl.cpp +++ b/src/scene/itemrenderer_opengl.cpp @@ -353,8 +353,6 @@ void ItemRendererOpenGL::renderItem(const RenderTarget &renderTarget, const Rend opacity = renderNode.opacity; } - renderNode.texture->setFilter(GL_LINEAR); - renderNode.texture->setWrapMode(GL_CLAMP_TO_EDGE); renderNode.texture->bind(); vbo->draw(scissorRegion, GL_TRIANGLES, renderNode.firstVertex, diff --git a/src/scene/workspacescene_opengl.cpp b/src/scene/workspacescene_opengl.cpp index 5ec33b4f0c..845108d938 100644 --- a/src/scene/workspacescene_opengl.cpp +++ b/src/scene/workspacescene_opengl.cpp @@ -163,6 +163,8 @@ std::shared_ptr DecorationShadowTextureCache::getTexture(ShadowTextur Data d; d.providers << provider; d.texture = std::make_shared(shadow->decorationShadowImage()); + d.texture->setFilter(GL_LINEAR); + d.texture->setWrapMode(GL_CLAMP_TO_EDGE); m_cache.insert(decoShadow.get(), d); return d.texture; } @@ -251,6 +253,8 @@ void OpenGLShadowTextureProvider::update() } m_texture = std::make_shared(image); + m_texture->setFilter(GL_LINEAR); + m_texture->setWrapMode(GL_CLAMP_TO_EDGE); if (m_texture->internalFormat() == GL_R8) { // Swizzle red to alpha and all other channels to zero @@ -455,6 +459,7 @@ void SceneOpenGLDecorationRenderer::resizeTexture() if (!size.isEmpty()) { m_texture.reset(new GLTexture(GL_RGBA8, size.width(), size.height())); m_texture->setContentTransform(TextureTransform::MirrorY); + m_texture->setFilter(GL_LINEAR); m_texture->setWrapMode(GL_CLAMP_TO_EDGE); m_texture->clear(); } else {