Ejemplo n.º 1
0
static struct _glxapi_table *
get_dispatch(Display *dpy)
{
   if (!dpy)
      return NULL;

   /* search list of display/dispatch pairs for this display */
   {
      const struct display_dispatch *d = DispatchList;
      while (d) {
         if (d->Dpy == dpy) {
            prevDisplay = dpy;
            prevTable = d->Table;
            return d->Table;  /* done! */
         }
         d = d->Next;
      }
   }

   /* A new display, determine if we should use real GLX
    * or Mesa's pseudo-GLX.
    */
   {
      struct _glxapi_table *t = _mesa_GetGLXDispatchTable();

      if (t) {
         struct display_dispatch *d;
         d = malloc(sizeof(struct display_dispatch));
         if (d) {
            d->Dpy = dpy;
            d->Table = t;
            /* insert at head of list */
            d->Next = DispatchList;
            DispatchList = d;
            /* update cache */
            prevDisplay = dpy;
            prevTable = t;
            return t;
         }
      }
   }

   /* If we get here that means we can't use real GLX on this display
    * and the Mesa pseudo-GLX software renderer wasn't compiled in.
    * Or, we ran out of memory!
    */
   return NULL;
}
Ejemplo n.º 2
0
static struct _glxapi_table *
get_dispatch(Display *dpy)
{
   if (!dpy)
      return NULL;

   /* search list of display/dispatch pairs for this display */
   {
      const struct display_dispatch *d = DispatchList;
      while (d) {
         if (d->Dpy == dpy) {
            prevDisplay = dpy;
            prevTable = d->Table;
            return d->Table;  /* done! */
         }
         d = d->Next;
      }
   }

   /* Setup the dispatch table */
   {
      struct _glxapi_table *t = _mesa_GetGLXDispatchTable();

      if (t) {
         struct display_dispatch *d;
         d = malloc(sizeof(struct display_dispatch));
         if (d) {
            d->Dpy = dpy;
            d->Table = t;
            /* insert at head of list */
            d->Next = DispatchList;
            DispatchList = d;
            /* update cache */
            prevDisplay = dpy;
            prevTable = t;
            return t;
         }
      }
   }

   return NULL;
}