glx: turn LIBGL_NO_DRAWARRAYS into a boolean
[mesa.git] / src / glx / indirect_glx.c
index 28b8cd071058886e9936fe7e3fffe513271ecc97..4302a8ff28815cf11fb809f3cd2cfd236a970960 100644 (file)
  *   Kristian Høgsberg (krh@bitplanet.net)
  */
 
+#include <stdbool.h>
+
 #include "glapi.h"
 #include "glxclient.h"
 
+#include "util/debug.h"
+
+#ifndef GLX_USE_APPLEGL
+
 extern struct _glapi_table *__glXNewIndirectAPI(void);
 
 /*
@@ -129,7 +135,6 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
                      GLXDrawable draw, GLXDrawable read)
 {
    GLXContextTag tag;
-   __GLXattribute *state;
    Display *dpy = gc->psc->dpy;
    int opcode = __glXSetupForCommand(dpy);
    Bool sent;
@@ -148,13 +153,6 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
       IndirectAPI = __glXNewIndirectAPI();
    _glapi_set_dispatch(IndirectAPI);
 
-   state = gc->client_state_private;
-   if (state->array_state == NULL) {
-      glGetString(GL_EXTENSIONS);
-      glGetString(GL_VERSION);
-      __glXInitVertexArrayState(gc);
-   }
-
    return !sent;
 }
 
@@ -167,7 +165,7 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new)
    if (gc == new)
       return;
    
-   /* We are either switching to no context, away from a indirect
+   /* We are either switching to no context, away from an indirect
     * context to a direct context or from one dpy to another and have
     * to send a request to the dpy to unbind the previous context.
     */
@@ -323,15 +321,15 @@ indirect_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
 }
 
 static const struct glx_context_vtable indirect_context_vtable = {
-   indirect_destroy_context,
-   indirect_bind_context,
-   indirect_unbind_context,
-   indirect_wait_gl,
-   indirect_wait_x,
-   indirect_use_x_font,
-   indirect_bind_tex_image,
-   indirect_release_tex_image,
-   NULL, /* get_proc_address */
+   .destroy             = indirect_destroy_context,
+   .bind                = indirect_bind_context,
+   .unbind              = indirect_unbind_context,
+   .wait_gl             = indirect_wait_gl,
+   .wait_x              = indirect_wait_x,
+   .use_x_font          = indirect_use_x_font,
+   .bind_tex_image      = indirect_bind_tex_image,
+   .release_tex_image   = indirect_release_tex_image,
+   .get_proc_address    = NULL,
 };
 
 /**
@@ -377,7 +375,7 @@ indirect_create_context(struct glx_screen *psc,
       return NULL;
    }
    gc->client_state_private = state;
-   state->NoDrawArraysProtocol = (getenv("LIBGL_NO_DRAWARRAYS") != NULL);
+   state->NoDrawArraysProtocol = env_var_as_boolean("LIBGL_NO_DRAWARRAYS", false);
 
    /*
     ** Create a temporary buffer to hold GLX rendering commands.  The size
@@ -467,9 +465,11 @@ indirect_create_context_attribs(struct glx_screen *base,
    return indirect_create_context(base, config_base, shareList, renderType);
 }
 
-struct glx_screen_vtable indirect_screen_vtable = {
-   indirect_create_context,
-   indirect_create_context_attribs
+static const struct glx_screen_vtable indirect_screen_vtable = {
+   .create_context         = indirect_create_context,
+   .create_context_attribs = indirect_create_context_attribs,
+   .query_renderer_integer = NULL,
+   .query_renderer_string  = NULL,
 };
 
 _X_HIDDEN struct glx_screen *
@@ -486,3 +486,5 @@ indirect_create_screen(int screen, struct glx_display * priv)
 
    return psc;
 }
+
+#endif