From 0d7415336f0aeed4f85d28761cff78131d20fce6 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Fri, 15 Feb 2019 13:31:51 +0200 Subject: [PATCH] [effects] Make sure that all effects reset the streaming buffer Summary: The streaming buffer is shared so we have to reset it before rendering something. Otherwise, it's basically undefined behavior. For example, if the streaming buffer had been used for rendering a geometry with some color, then the Background Contrast effect may crash in GLVertexBuffer::bindArrays, it all depends on whether there is any bounded GLShader. To fix that, the buffer has to be reset. BUG: 356141 Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D19034 --- effects/backgroundcontrast/contrast.cpp | 1 + effects/blur/blur.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/effects/backgroundcontrast/contrast.cpp b/effects/backgroundcontrast/contrast.cpp index 71276e8d6c..67f11b635e 100644 --- a/effects/backgroundcontrast/contrast.cpp +++ b/effects/backgroundcontrast/contrast.cpp @@ -483,6 +483,7 @@ void ContrastEffect::doContrast(EffectWindow *w, const QRegion& shape, const QRe // Upload geometry for the horizontal and vertical passes GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); + vbo->reset(); uploadGeometry(vbo, actualShape); vbo->bindArrays(); diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index 3992f6e884..f1a0b54217 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -647,6 +647,7 @@ void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float o // Upload geometry for the down and upsample iterations GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); + vbo->reset(); uploadGeometry(vbo, expandedBlurRegion.translated(xTranslate, yTranslate), shape); vbo->bindArrays();