aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-02-10 22:27:48 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-10 22:27:48 -0800
commit9e33d1dbccee9b13ac001dfc3094a503f9e84e9d (patch)
treebb84810ce1122c5d0d7cd37f259c74245f03e20d /debugger
parent3632f8473a7842b6f1351694d9b4071a66529224 (diff)
debugger: Abandon context when Qt changes it without notice
Qt changes the context on many conditions. Abandon GrContext in these cases. Also call GrContext::resetContext during Qt GL paint callback, the GL state may be touched by Qt. Fixes the bug where changing between gpu and msaa would start erroring in framebuffer binds, if the .skp had many layers. Review URL: https://codereview.chromium.org/915573002
Diffstat (limited to 'debugger')
-rw-r--r--debugger/QT/SkGLWidget.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp
index 1fbedf17a7..6720239024 100644
--- a/debugger/QT/SkGLWidget.cpp
+++ b/debugger/QT/SkGLWidget.cpp
@@ -32,19 +32,16 @@ void SkGLWidget::initializeGL() {
if (!fCurIntf) {
return;
}
- if (!fCurContext) {
- fCurContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf.get()));
- }
- if (!fCurContext) {
- return;
- }
-
// The call may come multiple times, for example after setSampleCount(). The QGLContext will be
// different, but we do not have a mechanism to catch the destroying of QGLContext, so that
- // proper resource cleanup could be made. Instead, we assume that the underlying GL context
- // never actually changes. If it would, we could not destroy the resources.
+ // proper resource cleanup could be made.
+ if (fCurContext) {
+ fCurContext->abandonContext();
+ }
fGpuDevice.reset(NULL);
fCanvas.reset(NULL);
+
+ fCurContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf.get()));
}
void SkGLWidget::createRenderTarget() {
@@ -76,6 +73,7 @@ void SkGLWidget::resizeGL(int w, int h) {
void SkGLWidget::paintGL() {
if (!this->isHidden() && fCanvas) {
+ fCurContext->resetContext();
fDebugger->draw(fCanvas.get());
// TODO(chudy): Implement an optional flush button in Gui.
fCanvas->flush();