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!
This commit is contained in:
Vlad Zahorodnii 2022-06-10 22:54:21 +03:00
parent 4363b25b2d
commit 3aa635430b
5 changed files with 5 additions and 15 deletions

View file

@ -19,6 +19,8 @@
class KSelectionOwner; class KSelectionOwner;
namespace KWin namespace KWin
{ {
class GLShader;
class GLTexture; class GLTexture;
class StartupFeedbackEffect class StartupFeedbackEffect

View file

@ -240,7 +240,6 @@ WindowPaintData::WindowPaintData()
WindowPaintData::WindowPaintData(const QMatrix4x4 &screenProjectionMatrix) WindowPaintData::WindowPaintData(const QMatrix4x4 &screenProjectionMatrix)
: PaintData() : PaintData()
, shader(nullptr)
, d(std::make_unique<WindowPaintDataPrivate>()) , d(std::make_unique<WindowPaintDataPrivate>())
{ {
d->screenProjectionMatrix = screenProjectionMatrix; d->screenProjectionMatrix = screenProjectionMatrix;
@ -253,7 +252,6 @@ WindowPaintData::WindowPaintData(const QMatrix4x4 &screenProjectionMatrix)
WindowPaintData::WindowPaintData(const WindowPaintData &other) WindowPaintData::WindowPaintData(const WindowPaintData &other)
: PaintData() : PaintData()
, shader(other.shader)
, d(std::make_unique<WindowPaintDataPrivate>()) , d(std::make_unique<WindowPaintDataPrivate>())
{ {
setXScale(other.xScale()); setXScale(other.xScale());

View file

@ -81,7 +81,6 @@ class OffscreenQuickView;
class EffectScreen; class EffectScreen;
class Effect; class Effect;
class WindowQuad; class WindowQuad;
class GLShader;
class WindowQuadList; class WindowQuadList;
class WindowPrePaintData; class WindowPrePaintData;
class WindowPaintData; class WindowPaintData;
@ -3387,11 +3386,6 @@ public:
std::optional<qreal> renderTargetScale() const; std::optional<qreal> renderTargetScale() const;
void setRenderTargetScale(qreal scale); void setRenderTargetScale(qreal scale);
/**
* Shader to be used for rendering, if any.
*/
GLShader *shader;
private: private:
const std::unique_ptr<WindowPaintDataPrivate> d; const std::unique_ptr<WindowPaintDataPrivate> d;
}; };

View file

@ -11,6 +11,7 @@
namespace KWin namespace KWin
{ {
class GLShader;
class OffscreenEffectPrivate; class OffscreenEffectPrivate;
class CrossFadeEffectPrivate; class CrossFadeEffectPrivate;
class ShaderEffectPrivate; class ShaderEffectPrivate;

View file

@ -507,10 +507,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion &region, const Wind
vbo->unmap(); vbo->unmap();
vbo->bindArrays(); vbo->bindArrays();
GLShader *shader = data.shader; GLShader *shader = ShaderManager::instance()->pushShader(shaderTraits);
if (!shader) {
shader = ShaderManager::instance()->pushShader(shaderTraits);
}
shader->setUniform(GLShader::Saturation, data.saturation()); shader->setUniform(GLShader::Saturation, data.saturation());
if (renderContext.hardwareClipping) { if (renderContext.hardwareClipping) {
@ -556,9 +553,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion &region, const Wind
setBlendEnabled(false); setBlendEnabled(false);
if (!data.shader) { ShaderManager::instance()->popShader();
ShaderManager::instance()->popShader();
}
if (renderContext.hardwareClipping) { if (renderContext.hardwareClipping) {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);