diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index df01d7c5bb..858356d63f 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -122,6 +122,7 @@ CubeEffect::CubeEffect() connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int))); connect(effects, SIGNAL(tabBoxClosed()), this, SLOT(slotTabBoxClosed())); connect(effects, SIGNAL(tabBoxUpdated()), this, SLOT(slotTabBoxUpdated())); + connect(effects, SIGNAL(screenGeometryChanged(const QSize&)), this, SLOT(slotResetShaders())); reconfigure(ReconfigureAll); } @@ -290,6 +291,14 @@ void CubeEffect::slotWallPaperLoaded() watcher->deleteLater(); } +void CubeEffect::slotResetShaders() +{ + ShaderManager::instance()->resetShader(m_capShader, ShaderManager::GenericShader); + ShaderManager::instance()->resetShader(m_reflectionShader, ShaderManager::GenericShader); + ShaderManager::instance()->resetShader(cylinderShader, ShaderManager::GenericShader); + ShaderManager::instance()->resetShader(sphereShader, ShaderManager::GenericShader); +} + bool CubeEffect::loadShader() { if (!(GLPlatform::instance()->supports(GLSL) && diff --git a/effects/cube/cube.h b/effects/cube/cube.h index 4fb15adfd2..d222ee4c02 100644 --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -139,6 +139,7 @@ private slots: void slotTabBoxClosed(); void slotCubeCapLoaded(); void slotWallPaperLoaded(); + void slotResetShaders(); private: enum RotationDirection { Left, diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 777755af79..a6cd8c33d9 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -787,6 +787,16 @@ void ShaderManager::resetAllShaders() } } +void ShaderManager::resetShader(GLShader *shader, ShaderType type) +{ + if (!(shader && shader->isValid())) + return; + + pushShader(shader); + resetShader(type); + popShader(); +} + void ShaderManager::pushShader(GLShader *shader) { diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index 20a66013b4..e5c6f7660f 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -352,6 +352,12 @@ public: **/ void resetAllShaders(); + /** + * Resets ShaderType @p type uniforms of a custom shader + * @since 4.11.1 + */ + void resetShader(GLShader *shader, ShaderType type); + /** * Creates a GLShader with a built-in vertex shader and a custom fragment shader. * @param vertex The generic vertex shader