From 3aa635430bc67abd4d1a721153b9969b929ec57d Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 10 Jun 2022 22:54:21 +0300 Subject: [PATCH] effects: Drop WindowPaintData.shader property It allows us to encapsulate SurfaceItem rendering. It's needed to add support for YUV->RGB conversion fallback path. Effects that use this property must be ported to OffscreenEffect, see also OffscreenEffect::setShader(). This is a BREAKING CHANGE! --- src/effects/startupfeedback/startupfeedback.h | 2 ++ src/libkwineffects/kwineffects.cpp | 2 -- src/libkwineffects/kwineffects.h | 6 ------ src/libkwineffects/kwinoffscreeneffect.h | 1 + src/scenes/opengl/scene_opengl.cpp | 9 ++------- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/effects/startupfeedback/startupfeedback.h b/src/effects/startupfeedback/startupfeedback.h index 3318220a6a..ccfc33c7e3 100644 --- a/src/effects/startupfeedback/startupfeedback.h +++ b/src/effects/startupfeedback/startupfeedback.h @@ -19,6 +19,8 @@ class KSelectionOwner; namespace KWin { + +class GLShader; class GLTexture; class StartupFeedbackEffect diff --git a/src/libkwineffects/kwineffects.cpp b/src/libkwineffects/kwineffects.cpp index d45337f3fe..d70fa9b034 100644 --- a/src/libkwineffects/kwineffects.cpp +++ b/src/libkwineffects/kwineffects.cpp @@ -240,7 +240,6 @@ WindowPaintData::WindowPaintData() WindowPaintData::WindowPaintData(const QMatrix4x4 &screenProjectionMatrix) : PaintData() - , shader(nullptr) , d(std::make_unique()) { d->screenProjectionMatrix = screenProjectionMatrix; @@ -253,7 +252,6 @@ WindowPaintData::WindowPaintData(const QMatrix4x4 &screenProjectionMatrix) WindowPaintData::WindowPaintData(const WindowPaintData &other) : PaintData() - , shader(other.shader) , d(std::make_unique()) { setXScale(other.xScale()); diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index dea6455a49..5ac6a3d4d3 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -81,7 +81,6 @@ class OffscreenQuickView; class EffectScreen; class Effect; class WindowQuad; -class GLShader; class WindowQuadList; class WindowPrePaintData; class WindowPaintData; @@ -3387,11 +3386,6 @@ public: std::optional renderTargetScale() const; void setRenderTargetScale(qreal scale); - /** - * Shader to be used for rendering, if any. - */ - GLShader *shader; - private: const std::unique_ptr d; }; diff --git a/src/libkwineffects/kwinoffscreeneffect.h b/src/libkwineffects/kwinoffscreeneffect.h index fee4b5a2ee..f5c502aeb6 100644 --- a/src/libkwineffects/kwinoffscreeneffect.h +++ b/src/libkwineffects/kwinoffscreeneffect.h @@ -11,6 +11,7 @@ namespace KWin { +class GLShader; class OffscreenEffectPrivate; class CrossFadeEffectPrivate; class ShaderEffectPrivate; diff --git a/src/scenes/opengl/scene_opengl.cpp b/src/scenes/opengl/scene_opengl.cpp index 1dd474fea9..06a62e033c 100644 --- a/src/scenes/opengl/scene_opengl.cpp +++ b/src/scenes/opengl/scene_opengl.cpp @@ -507,10 +507,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion ®ion, const Wind vbo->unmap(); vbo->bindArrays(); - GLShader *shader = data.shader; - if (!shader) { - shader = ShaderManager::instance()->pushShader(shaderTraits); - } + GLShader *shader = ShaderManager::instance()->pushShader(shaderTraits); shader->setUniform(GLShader::Saturation, data.saturation()); if (renderContext.hardwareClipping) { @@ -556,9 +553,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion ®ion, const Wind setBlendEnabled(false); - if (!data.shader) { - ShaderManager::instance()->popShader(); - } + ShaderManager::instance()->popShader(); if (renderContext.hardwareClipping) { glDisable(GL_SCISSOR_TEST);