Pass the actual window format to the offscreen surface during cleanup
authorLaszlo Agocs <laszlo.agocs@digia.com>
Tue, 25 Mar 2014 14:01:44 +0000 (15:01 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 27 Mar 2014 09:01:41 +0000 (10:01 +0100)
Using the requested format (we don't have anything else since the platform
window is gone) is wrong on EGL implementations that offer a different set
of configurations for window and pbuffer surfaces, because we may end up
with a pbuffer surface that is incompatible with the context/window due to
having different color buffer sizes.

To be absolutely sure that the surface is compatible, store the actual
surface format so that it is available even after the platform window is
gone.

Change-Id: Id17c25439c463d4c37af95fc90f336d3f67c6427
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/quick/scenegraph/qsgthreadedrenderloop.cpp
src/quick/scenegraph/qsgthreadedrenderloop_p.h

index 4adcb3ccfb0a33f6cd5cc8bdc5fb33967bf122e3..40243a5b1bcb92e727a294097322375468d10909 100644 (file)
@@ -850,6 +850,7 @@ void QSGThreadedRenderLoop::show(QQuickWindow *window)
 
     Window win;
     win.window = window;
+    win.actualWindowFormat = window->format();
     win.thread = new QSGRenderThread(this, QQuickWindowPrivate::get(window)->context);
     win.timerId = 0;
     win.updateDuringSync = false;
@@ -1102,7 +1103,7 @@ void QSGThreadedRenderLoop::releaseResources(QQuickWindow *window, bool inDestru
         if (!window->handle()) {
             QSG_GUI_DEBUG(w->window, " - using fallback surface");
             fallback = new QOffscreenSurface();
-            fallback->setFormat(window->requestedFormat());
+            fallback->setFormat(w->actualWindowFormat);
             fallback->create();
         }
 
index e142f7f2c8f719f208f61736d3cba988c7e9f6ad..82ab2cdaa07c506090d37a0499655d200a7332e7 100644 (file)
@@ -87,6 +87,7 @@ private:
     struct Window {
         QQuickWindow *window;
         QSGRenderThread *thread;
+        QSurfaceFormat actualWindowFormat;
         int timerId;
         uint updateDuringSync : 1;
     };