diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-07-08 13:21:31 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-03 16:04:38 +0000 |
commit | 40e8e9c55f949f61688a5c416875b260723b3b83 (patch) | |
tree | b0db7a1d1fa9317cf7b496d961667412e8421c21 | |
parent | 2c2a69498b91f3075006263a97e571ae2e68d8e2 (diff) |
rhi: gl: Reset the buffer bindings on beginExternal
Play nice with old renderers like the OpenGL paint engine for
QPainter.
When combining Qt Quick and QPainter targeting the same GL window,
calling QQuickWindow::beginExternalCommands() is not currently
sufficient to ensure problem-free operation, it also needs a
QQOpenGLUtils::resetOpenGLState() afterwards to get rid of the buffer
bindings. (which is important when using legacy code with client-side
vertex arrays) Which in turn is not what the documentation promises,
so resetting the bindings is now ensured on the rhi level when
Qt Quick calls beginExternal().
Fixes: QTBUG-104801
Change-Id: Ibd82753996768aad0118bff87d4e1f8bcc388c58
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 4fdadd2348eb2c952650fbd8b9e5d18ed41405dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 13a7b997ea..264f4eeb74 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -1853,8 +1853,14 @@ void QRhiGles2::beginExternal(QRhiCommandBuffer *cb) cbD->resetCommands(); - if (vao) + if (vao) { f->glBindVertexArray(0); + } else { + f->glBindBuffer(GL_ARRAY_BUFFER, 0); + f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + if (caps.compute) + f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); + } } void QRhiGles2::endExternal(QRhiCommandBuffer *cb) |