Mesa (master): mesa: Don' t reuse DummyFramebuffer as the incomplete framebuffer

Kristian Høgsberg krh at kemper.freedesktop.org
Thu Sep 9 22:01:55 UTC 2010


Module: Mesa
Branch: master
Commit: 144356f9925fa9d892faa64fa7264ef9f1d7e2b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=144356f9925fa9d892faa64fa7264ef9f1d7e2b4

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Thu Sep  9 17:08:12 2010 -0400

mesa: Don't reuse DummyFramebuffer as the incomplete framebuffer

Binding framebuffer 0 on a context that doesn't have a winsys drawable
will try to bind the incomplete framebuffer.  That fails when that's
also the dummy framebuffer.

---

 src/mesa/main/context.c  |    3 +++
 src/mesa/main/fbobject.c |    8 +++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 73d96e8..66e4183 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1300,6 +1300,9 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer)
    if (ctxvis == bufvis)
       return GL_TRUE;
 
+   if (buffer == _mesa_get_incomplete_framebuffer())
+      return GL_TRUE;
+
 #if 0
    /* disabling this fixes the fgl_glxgears pbuffer demo */
    if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 72cbb09..5201f50 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -71,6 +71,10 @@
 static struct gl_framebuffer DummyFramebuffer;
 static struct gl_renderbuffer DummyRenderbuffer;
 
+/* We bind this framebuffer when applications pass a NULL
+ * drawable/surface in make current. */
+static struct gl_framebuffer IncompleteFramebuffer;
+
 
 #define IS_CUBE_FACE(TARGET) \
    ((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \
@@ -95,14 +99,16 @@ _mesa_init_fbobjects(GLcontext *ctx)
 {
    _glthread_INIT_MUTEX(DummyFramebuffer.Mutex);
    _glthread_INIT_MUTEX(DummyRenderbuffer.Mutex);
+   _glthread_INIT_MUTEX(IncompleteFramebuffer.Mutex);
    DummyFramebuffer.Delete = delete_dummy_framebuffer;
    DummyRenderbuffer.Delete = delete_dummy_renderbuffer;
+   IncompleteFramebuffer.Delete = delete_dummy_framebuffer;
 }
 
 struct gl_framebuffer *
 _mesa_get_incomplete_framebuffer(void)
 {
-   return &DummyFramebuffer;
+   return &IncompleteFramebuffer;
 }
 
 /**




More information about the mesa-commit mailing list