mount.sh: Fixed uid for unmounting using HAL
[openembedded.git] / recipes / qt4 / qt-4.6.0 / 0919-Rebind-window-surface-fbo-after-native-GL-rendering.patch
1 From c0b81480b2909b18ac15bdd124a562ae005c2f41 Mon Sep 17 00:00:00 2001
2 From: Rhys Weatherley <rhys.weatherley@nokia.com>
3 Date: Fri, 4 Dec 2009 17:17:00 +1000
4 Subject: [PATCH 0919/1244] Rebind window surface fbo after native GL rendering
5
6 If the user called QGLFramebufferObject::bind()/release() during a
7 beginNativePainting() callout, the release() would reset the context's
8 fbo to zero, not the actual window surface fbo.
9
10 Task-number: QTBUG-6204
11 Reviewed-by: Tom
12 ---
13  src/opengl/qgl.cpp                  |    1 +
14  src/opengl/qgl_p.h                  |    1 +
15  src/opengl/qglframebufferobject.cpp |    4 ++--
16  src/opengl/qglpaintdevice.cpp       |   10 ++++++++++
17  4 files changed, 14 insertions(+), 2 deletions(-)
18
19 diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
20 index 5ada125..94b8aa5 100644
21 --- a/src/opengl/qgl.cpp
22 +++ b/src/opengl/qgl.cpp
23 @@ -1495,6 +1495,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
24      version_flags_cached = false;
25      version_flags = QGLFormat::OpenGL_Version_None;
26      current_fbo = 0;
27 +    default_fbo = 0;
28      active_engine = 0;
29  }
30  
31 diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
32 index 8e472e5..ab72c9c 100644
33 --- a/src/opengl/qgl_p.h
34 +++ b/src/opengl/qgl_p.h
35 @@ -328,6 +328,7 @@ public:
36      GLint max_texture_size;
37  
38      GLuint current_fbo;
39 +    GLuint default_fbo;
40      QPaintEngine *active_engine;
41  
42      static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; }
43 diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
44 index d79283e..d0297c9 100644
45 --- a/src/opengl/qglframebufferobject.cpp
46 +++ b/src/opengl/qglframebufferobject.cpp
47 @@ -899,8 +899,8 @@ bool QGLFramebufferObject::release()
48  #endif
49  
50      if (current) {
51 -        current->d_ptr->current_fbo = 0;
52 -        glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
53 +        current->d_ptr->current_fbo = current->d_ptr->default_fbo;
54 +        glBindFramebuffer(GL_FRAMEBUFFER_EXT, current->d_ptr->default_fbo);
55      }
56  
57      return true;
58 diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
59 index 2867de5..bcd90a5 100644
60 --- a/src/opengl/qglpaintdevice.cpp
61 +++ b/src/opengl/qglpaintdevice.cpp
62 @@ -89,6 +89,12 @@ void QGLPaintDevice::beginPaint()
63          ctx->d_ptr->current_fbo = m_thisFBO;
64          glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
65      }
66 +
67 +    // Set the default fbo for the context to m_thisFBO so that
68 +    // if some raw GL code between beginNativePainting() and
69 +    // endNativePainting() calls QGLFramebufferObject::release(),
70 +    // painting will revert to the window surface's fbo.
71 +    ctx->d_ptr->default_fbo = m_thisFBO;
72  }
73  
74  void QGLPaintDevice::ensureActiveTarget()
75 @@ -101,6 +107,8 @@ void QGLPaintDevice::ensureActiveTarget()
76          ctx->d_ptr->current_fbo = m_thisFBO;
77          glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
78      }
79 +
80 +    ctx->d_ptr->default_fbo = m_thisFBO;
81  }
82  
83  void QGLPaintDevice::endPaint()
84 @@ -111,6 +119,8 @@ void QGLPaintDevice::endPaint()
85          ctx->d_ptr->current_fbo = m_previousFBO;
86          glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO);
87      }
88 +
89 +    ctx->d_ptr->default_fbo = 0;
90  }
91  
92  QGLFormat QGLPaintDevice::format() const
93 -- 
94 1.6.5
95