[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
This commit is contained in:
Vlad Zagorodniy 2019-02-15 13:31:51 +02:00
parent 6d9ac76cf7
commit 0d7415336f
2 changed files with 2 additions and 0 deletions

View file

@ -483,6 +483,7 @@ void ContrastEffect::doContrast(EffectWindow *w, const QRegion& shape, const QRe
// Upload geometry for the horizontal and vertical passes // Upload geometry for the horizontal and vertical passes
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
uploadGeometry(vbo, actualShape); uploadGeometry(vbo, actualShape);
vbo->bindArrays(); vbo->bindArrays();

View file

@ -647,6 +647,7 @@ void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float o
// Upload geometry for the down and upsample iterations // Upload geometry for the down and upsample iterations
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
uploadGeometry(vbo, expandedBlurRegion.translated(xTranslate, yTranslate), shape); uploadGeometry(vbo, expandedBlurRegion.translated(xTranslate, yTranslate), shape);
vbo->bindArrays(); vbo->bindArrays();