Mesa (master): glx: Set an all NULL vtable for dummyContext

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Sep 7 18:34:03 UTC 2010


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

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Tue Sep  7 14:32:28 2010 -0400

glx: Set an all NULL vtable for dummyContext

This reverts 6a6e6d7b0a84e20f9754af02a575ae34081d310c and initializes
dummyContext with an all NULL vtable.  The context vtable pointer is
supposed to always be non-NULL, but the vtable entries can be NULL.

---

 src/glx/glxclient.h  |    4 ++--
 src/glx/glxcmds.c    |   10 +++++-----
 src/glx/glxcurrent.c |    3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 813547a..b453e6d 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -260,6 +260,8 @@ struct glx_context
    GLint bufSize;
    /*@} */
 
+   const struct glx_context_vtable *vtable;
+
     /**
      * The XID of this rendering context.  When the context is created a
      * new XID is allocated.  This is set to None when the context is
@@ -423,8 +425,6 @@ struct glx_context
    unsigned long thread_id;
 
    char gl_extension_bits[__GL_EXT_BYTES];
-
-   const struct glx_context_vtable *vtable;
 };
 
 extern Bool
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4bdb41d..9575156 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -481,7 +481,7 @@ glXWaitGL(void)
 {
    struct glx_context *gc = __glXGetCurrentContext();
 
-   if (gc && gc->vtable && gc->vtable->wait_gl)
+   if (gc && gc->vtable->wait_gl)
       gc->vtable->wait_gl(gc);
 }
 
@@ -494,7 +494,7 @@ glXWaitX(void)
 {
    struct glx_context *gc = __glXGetCurrentContext();
 
-   if (gc && gc->vtable && gc->vtable->wait_x)
+   if (gc && gc->vtable->wait_x)
       gc->vtable->wait_x(gc);
 }
 
@@ -503,7 +503,7 @@ glXUseXFont(Font font, int first, int count, int listBase)
 {
    struct glx_context *gc = __glXGetCurrentContext();
 
-   if (gc && gc->vtable && gc->vtable->use_x_font)
+   if (gc && gc->vtable->use_x_font)
       gc->vtable->use_x_font(gc, font, first, count, listBase);
 }
 
@@ -2338,7 +2338,7 @@ __glXBindTexImageEXT(Display * dpy,
 {
    struct glx_context *gc = __glXGetCurrentContext();
 
-   if (gc == NULL || gc->vtable == NULL || gc->vtable->bind_tex_image == NULL)
+   if (gc == NULL || gc->vtable->bind_tex_image == NULL)
       return;
 
    gc->vtable->bind_tex_image(dpy, drawable, buffer, attrib_list);
@@ -2349,7 +2349,7 @@ __glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
 {
    struct glx_context *gc = __glXGetCurrentContext();
 
-   if (gc == NULL || gc->vtable == NULL || gc->vtable->release_tex_image == NULL)
+   if (gc == NULL || gc->vtable->release_tex_image == NULL)
       return;
 
    gc->vtable->release_tex_image(dpy, drawable, buffer);
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index e256997..98f66c2 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -53,7 +53,7 @@
 */
 
 static GLubyte dummyBuffer[__GLX_BUFFER_LIMIT_SIZE];
-
+static struct glx_context_vtable dummyVtable;
 /*
 ** Dummy context used by small commands when there is no current context.
 ** All the
@@ -66,6 +66,7 @@ struct glx_context dummyContext = {
    &dummyBuffer[0],
    &dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
    sizeof(dummyBuffer),
+   &dummyVtable
 };
 
 /*




More information about the mesa-commit mailing list