diff options
author | James Rowe <jroweboy@gmail.com> | 2020-05-12 07:50:03 +0200 |
---|---|---|
committer | James Rowe <jroweboy@gmail.com> | 2020-05-12 07:50:03 +0200 |
commit | 1585981eece8658f9fb1e19ac93b74e0517b024c (patch) | |
tree | 290e325ad76fe74208913e07ab3e7e9602602418 | |
parent | Merge pull request #3816 from ReinUsesLisp/vk-rasterizer-enable (diff) | |
download | yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.tar yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.tar.gz yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.tar.bz2 yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.tar.lz yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.tar.xz yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.tar.zst yuzu-1585981eece8658f9fb1e19ac93b74e0517b024c.zip |
-rw-r--r-- | src/yuzu/bootmanager.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 3d759f77b..1adf8932b 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -150,18 +150,19 @@ public: } void MakeCurrent() override { - if (is_current) { - return; + // We can't track the current state of the underlying context in this wrapper class because + // Qt may make the underlying context not current for one reason or another. In particular, + // the WebBrowser uses GL, so it seems to conflict if we aren't careful. + // Instead of always just making the context current (which does not have any caching to + // check if the underlying context is already current) we can check for the current context + // in the thread local data by calling `currentContext()` and checking if its ours. + if (QOpenGLContext::currentContext() != context.get()) { + context->makeCurrent(surface); } - is_current = context->makeCurrent(surface); } void DoneCurrent() override { - if (!is_current) { - return; - } context->doneCurrent(); - is_current = false; } QOpenGLContext* GetShareContext() { @@ -178,7 +179,6 @@ private: std::unique_ptr<QOpenGLContext> context; std::unique_ptr<QOffscreenSurface> offscreen_surface{}; QSurface* surface; - bool is_current = false; }; class DummyContext : public Core::Frontend::GraphicsContext {}; |