#include "apple_glx_context.h"
#include "apple_glx.h"
#include "glx_error.h"
-#define GC_IS_DIRECT(gc) ((gc)->isDirect)
#else
#include <sys/time.h>
#include <X11/extensions/xf86vmode.h>
#include "xf86dri.h"
-#define GC_IS_DIRECT(gc) ((gc)->driContext != NULL)
#endif
#else
-#define GC_IS_DIRECT(gc) (0)
#endif
#if defined(USE_XCB)
static const char __glXGLXClientVendorName[] = "Mesa Project and SGI";
static const char __glXGLXClientVersion[] = "1.4";
-static const struct glx_context_vtable indirect_context_vtable;
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
{
XID draw;
__GLXDRIdrawable *pdraw;
- __GLXdisplayPrivate *priv = sc->display;
+ struct glx_display *priv = sc->display;
XWindowAttributes xwa;
int (*oldXErrorHandler) (Display *, XErrorEvent *);
_X_HIDDEN __GLXDRIdrawable *
GetGLXDRIDrawable(Display * dpy, GLXDrawable drawable)
{
- __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+ struct glx_display *priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw;
if (priv == NULL)
static struct glx_screen *
GetGLXScreenConfigs(Display * dpy, int scrn)
{
- __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ struct glx_display *const priv = __glXInitialize(dpy);
return (priv
&& priv->screens !=
static int
-GetGLXPrivScreenConfig(Display * dpy, int scrn, __GLXdisplayPrivate ** ppriv,
+GetGLXPrivScreenConfig(Display * dpy, int scrn, struct glx_display ** ppriv,
struct glx_screen ** ppsc)
{
/* Initialize the extension, if needed . This has the added value
static struct glx_config *
ValidateGLXFBConfig(Display * dpy, GLXFBConfig fbconfig)
{
- __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ struct glx_display *const priv = __glXInitialize(dpy);
int num_screens = ScreenCount(dpy);
unsigned i;
struct glx_config *config;
return NULL;
}
-#ifdef GLX_USE_APPLEGL
-
-static const struct glx_context_vtable applegl_context_vtable;
-
-static __GLcontext *
-applegl_create_context(struct glx_screen *psc,
- struct glx_config *mode,
- GLXContext shareList, int renderType)
-{
- __GLXcontext *gc;
- int errorcode;
- bool x11error;
-
- /* TODO: Integrate this with apple_glx_create_context and make
- * struct apple_glx_context inherit from __GLXcontext. */
-
- gc = Xmalloc(sizeof *gc);
- if (pcp == NULL)
- return NULL;
-
- memset(gc, 0, sizeof *gc);
- if (!glx_context_init(&gc->base, &psc->base, mode)) {
- Xfree(gc);
- return NULL;
- }
-
- gc->vtable = &applegl_context_vtable;
- gc->driContext = NULL;
- gc->do_destroy = False;
-
- /* TODO: darwin: Integrate with above to do indirect */
- if(apple_glx_create_context(&gc->driContext, dpy, screen, fbconfig,
- shareList ? shareList->driContext : NULL,
- &errorcode, &x11error)) {
- __glXSendError(dpy, errorcode, 0, X_GLXCreateContext, x11error);
- gc->vtable->destroy(gc);
- return NULL;
- }
-
- gc->currentContextTag = -1;
- gc->mode = fbconfig;
- gc->isDirect = allowDirect;
- gc->xid = 1; /* Just something not None, so we know when to destroy
- * it in MakeContextCurrent. */
-
- return gc;
-}
-#endif
-
-
-/**
- * \todo It should be possible to move the allocate of \c client_state_private
- * later in the function for direct-rendering contexts. Direct-rendering
- * contexts don't need to track client state, so they don't need that memory
- * at all.
- *
- * \todo Eliminate \c __glXInitVertexArrayState. Replace it with a new
- * function called \c __glXAllocateClientState that allocates the memory and
- * does all the initialization (including the pixel pack / unpack).
- */
-static GLXContext
-indirect_create_context(struct glx_screen *psc,
- struct glx_config *mode,
- GLXContext shareList, int renderType)
-{
- GLXContext gc;
- int bufSize;
- CARD8 opcode;
- __GLXattribute *state;
-
- opcode = __glXSetupForCommand(psc->dpy);
- if (!opcode) {
- return NULL;
- }
-
- /* Allocate our context record */
- gc = (GLXContext) Xmalloc(sizeof(struct __GLXcontextRec));
- if (!gc) {
- /* Out of memory */
- return NULL;
- }
- memset(gc, 0, sizeof(struct __GLXcontextRec));
-
- glx_context_init(gc, psc, mode);
- gc->isDirect = GL_FALSE;
- gc->vtable = &indirect_context_vtable;
- state = Xmalloc(sizeof(struct __GLXattributeRec));
- if (state == NULL) {
- /* Out of memory */
- Xfree(gc);
- return NULL;
- }
- gc->client_state_private = state;
- memset(gc->client_state_private, 0, sizeof(struct __GLXattributeRec));
- state->NoDrawArraysProtocol = (getenv("LIBGL_NO_DRAWARRAYS") != NULL);
-
- /*
- ** Create a temporary buffer to hold GLX rendering commands. The size
- ** of the buffer is selected so that the maximum number of GLX rendering
- ** commands can fit in a single X packet and still have room in the X
- ** packet for the GLXRenderReq header.
- */
-
- bufSize = (XMaxRequestSize(psc->dpy) * 4) - sz_xGLXRenderReq;
- gc->buf = (GLubyte *) Xmalloc(bufSize);
- if (!gc->buf) {
- Xfree(gc->client_state_private);
- Xfree(gc);
- return NULL;
- }
- gc->bufSize = bufSize;
-
- /* Fill in the new context */
- gc->renderMode = GL_RENDER;
-
- state->storePack.alignment = 4;
- state->storeUnpack.alignment = 4;
-
- gc->attributes.stackPointer = &gc->attributes.stack[0];
-
- /*
- ** PERFORMANCE NOTE: A mode dependent fill image can speed things up.
- ** Other code uses the fastImageUnpack bit, but it is never set
- ** to GL_TRUE.
- */
- gc->fastImageUnpack = GL_FALSE;
- gc->fillImage = __glFillImage;
- gc->pc = gc->buf;
- gc->bufEnd = gc->buf + bufSize;
- gc->isDirect = GL_FALSE;
- if (__glXDebug) {
- /*
- ** Set limit register so that there will be one command per packet
- */
- gc->limit = gc->buf;
- }
- else {
- gc->limit = gc->buf + bufSize - __GLX_BUFFER_LIMIT_SIZE;
- }
- gc->majorOpcode = opcode;
-
- /*
- ** Constrain the maximum drawing command size allowed to be
- ** transfered using the X_GLXRender protocol request. First
- ** constrain by a software limit, then constrain by the protocl
- ** limit.
- */
- if (bufSize > __GLX_RENDER_CMD_SIZE_LIMIT) {
- bufSize = __GLX_RENDER_CMD_SIZE_LIMIT;
- }
- if (bufSize > __GLX_MAX_RENDER_CMD_SIZE) {
- bufSize = __GLX_MAX_RENDER_CMD_SIZE;
- }
- gc->maxSmallRenderCommandSize = bufSize;
-
-
- return gc;
-}
-
-struct glx_screen_vtable indirect_screen_vtable = {
- indirect_create_context
-};
-
-_X_HIDDEN struct glx_screen *
-indirect_create_screen(int screen, __GLXdisplayPrivate * priv)
-{
- struct glx_screen *psc;
-
- psc = Xmalloc(sizeof *psc);
- if (psc == NULL)
- return NULL;
-
- memset(psc, 0, sizeof *psc);
- glx_screen_init(psc, screen, priv);
- psc->vtable = &indirect_screen_vtable;
-
- return psc;
-}
-
-
_X_HIDDEN Bool
-glx_context_init(__GLXcontext *gc,
+glx_context_init(struct glx_context *gc,
struct glx_screen *psc, struct glx_config *config)
{
gc->majorOpcode = __glXSetupForCommand(psc->display->dpy);
gc->psc = psc;
gc->config = config;
gc->isDirect = GL_TRUE;
+ gc->currentContextTag = -1;
return GL_TRUE;
}
static GLXContext
CreateContext(Display * dpy, int generic_id,
struct glx_config *config,
- GLXContext shareList,
+ GLXContext shareList_user,
Bool allowDirect,
unsigned code, int renderType, int screen)
{
- GLXContext gc = NULL;
+ struct glx_context *gc = NULL;
struct glx_screen *const psc = GetGLXScreenConfigs(dpy, screen);
-
+ struct glx_context *shareList = (struct glx_context *) shareList_user;
if (dpy == NULL)
return NULL;
req->visual = generic_id;
req->screen = screen;
req->shareList = shareList ? shareList->xid : None;
- req->isDirect = GC_IS_DIRECT(gc);
+ req->isDirect = gc->isDirect;
break;
}
req->screen = screen;
req->renderType = renderType;
req->shareList = shareList ? shareList->xid : None;
- req->isDirect = GC_IS_DIRECT(gc);
+ req->isDirect = gc->isDirect;
break;
}
req->screen = screen;
req->renderType = renderType;
req->shareList = shareList ? shareList->xid : None;
- req->isDirect = GC_IS_DIRECT(gc);
+ req->isDirect = gc->isDirect;
break;
}
gc->imported = GL_FALSE;
gc->renderType = renderType;
- return gc;
+ return (GLXContext) gc;
}
_X_EXPORT GLXContext
SyncHandle();
}
-static void
-indirect_destroy_context(__GLXcontext *gc)
-{
- if (!gc->imported && gc->xid)
- glx_send_destroy_context(gc->psc->dpy, gc->xid);
-
- __glXFreeVertexArrayState(gc);
-
- if (gc->vendor)
- XFree((char *) gc->vendor);
- if (gc->renderer)
- XFree((char *) gc->renderer);
- if (gc->version)
- XFree((char *) gc->version);
- if (gc->extensions)
- XFree((char *) gc->extensions);
- __glFreeAttributeState(gc);
- XFree((char *) gc->buf);
- Xfree((char *) gc->client_state_private);
- XFree((char *) gc);
-}
-
/*
** Destroy the named context
*/
static void
-DestroyContext(Display * dpy, GLXContext gc)
+DestroyContext(Display * dpy, GLXContext ctx)
{
+ struct glx_context *gc = (struct glx_context *) ctx;
+
if (!gc)
return;
_X_EXPORT Bool
glXQueryVersion(Display * dpy, int *major, int *minor)
{
- __GLXdisplayPrivate *priv;
+ struct glx_display *priv;
/* Init the extension. This fetches the major and minor version. */
priv = __glXInitialize(dpy);
return rv;
}
-static void
-indirect_wait_gl(__GLXcontext *gc)
-{
- xGLXWaitGLReq *req;
- Display *dpy = gc->currentDpy;
-
- /* Flush any pending commands out */
- __glXFlushRenderBuffer(gc, gc->pc);
-
- /* Send the glXWaitGL request */
- LockDisplay(dpy);
- GetReq(GLXWaitGL, req);
- req->reqType = gc->majorOpcode;
- req->glxCode = X_GLXWaitGL;
- req->contextTag = gc->currentContextTag;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
/*
** Put a barrier in the token stream that forces the GL to finish its
** work before X can proceed.
_X_EXPORT void
glXWaitGL(void)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
- if (gc && gc->vtable->use_x_font)
+ if (gc && gc->vtable->wait_gl)
gc->vtable->wait_gl(gc);
}
-static void
-indirect_wait_x(__GLXcontext *gc)
-{
- xGLXWaitXReq *req;
- Display *dpy = gc->currentDpy;
-
- /* Flush any pending commands out */
- __glXFlushRenderBuffer(gc, gc->pc);
-
- LockDisplay(dpy);
- GetReq(GLXWaitX, req);
- req->reqType = gc->majorOpcode;
- req->glxCode = X_GLXWaitX;
- req->contextTag = gc->currentContextTag;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
/*
** Put a barrier in the token stream that forces X to finish its
** work before GL can proceed.
_X_EXPORT void
glXWaitX(void)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
- if (gc && gc->vtable->use_x_font)
+ if (gc && gc->vtable->wait_x)
gc->vtable->wait_x(gc);
}
-static void
-indirect_use_x_font(__GLXcontext *gc,
- Font font, int first, int count, int listBase)
-{
- xGLXUseXFontReq *req;
- Display *dpy = gc->currentDpy;
-
- /* Flush any pending commands out */
- __glXFlushRenderBuffer(gc, gc->pc);
-
- /* Send the glXUseFont request */
- LockDisplay(dpy);
- GetReq(GLXUseXFont, req);
- req->reqType = gc->majorOpcode;
- req->glxCode = X_GLXUseXFont;
- req->contextTag = gc->currentContextTag;
- req->font = font;
- req->first = first;
- req->count = count;
- req->listBase = listBase;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-#ifdef GLX_USE_APPLEGL
-
-static void
-applegl_destroy_context(__GLXcontext *gc)
-{
- apple_glx_destroy_context(&gc->driContext, gc->currentDpy);
-}
-
-static void
-applegl_wait_gl(__GLXcontext *gc)
-{
- glFinish();
-}
-
-static void
-applegl_wait_x(__GLXcontext *gc)
-{
- apple_glx_waitx(gc->dpy, gc->driContext);
-}
-
-static const struct glx_context_vtable applegl_context_vtable = {
- applegl_destroy_context,
- applegl_wait_gl,
- applegl_wait_x,
- DRI_glXUseXFont,
- NULL, /* bind_tex_image, */
- NULL, /* release_tex_image, */
-};
-
-#endif
-
_X_EXPORT void
glXUseXFont(Font font, int first, int count, int listBase)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
if (gc && gc->vtable->use_x_font)
gc->vtable->use_x_font(gc, font, first, count, listBase);
** attribute "mask".
*/
_X_EXPORT void
-glXCopyContext(Display * dpy, GLXContext source,
- GLXContext dest, unsigned long mask)
+glXCopyContext(Display * dpy, GLXContext source_user,
+ GLXContext dest_user, unsigned long mask)
{
+ struct glx_context *source = (struct glx_context *) source_user;
+ struct glx_context *dest = (struct glx_context *) dest_user;
#ifdef GLX_USE_APPLEGL
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
int errorcode;
bool x11error;
#else
xGLXCopyContextReq *req;
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
GLXContextTag tag;
CARD8 opcode;
}
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- if (gc->driContext) {
+ if (gc->isDirect) {
/* NOT_DONE: This does not work yet */
}
#endif
* the GLX protocol here at all?
*/
_X_EXPORT Bool
-glXIsDirect(Display * dpy, GLXContext gc)
+glXIsDirect(Display * dpy, GLXContext gc_user)
{
+ struct glx_context *gc = (struct glx_context *) gc_user;
+
if (!gc) {
return GL_FALSE;
}
- else if (GC_IS_DIRECT(gc)) {
+ else if (gc->isDirect) {
return GL_TRUE;
}
#ifdef GLX_USE_APPLEGL /* TODO: indirect on darwin */
/* FIXME: Maybe delay __DRIdrawable creation until the drawable
* is actually bound to a context... */
- __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ struct glx_display *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw;
struct glx_screen *psc;
struct glx_config *config;
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
{
- __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ struct glx_display *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);
if (pdraw != NULL) {
__glXSendError(dpy, GLXBadCurrentWindow, 0, X_GLXSwapBuffers, false);
}
#else
- GLXContext gc;
+ struct glx_context *gc;
GLXContextTag tag;
CARD8 opcode;
#ifdef USE_XCB
glXGetConfig(Display * dpy, XVisualInfo * vis, int attribute,
int *value_return)
{
- __GLXdisplayPrivate *priv;
+ struct glx_display *priv;
struct glx_screen *psc;
struct glx_config *config;
int status;
glXChooseVisual(Display * dpy, int screen, int *attribList)
{
XVisualInfo *visualList = NULL;
- __GLXdisplayPrivate *priv;
+ struct glx_display *priv;
struct glx_screen *psc;
struct glx_config test_config;
struct glx_config *config;
glXQueryExtensionsString(Display * dpy, int screen)
{
struct glx_screen *psc;
- __GLXdisplayPrivate *priv;
+ struct glx_display *priv;
if (GetGLXPrivScreenConfig(dpy, screen, &priv, &psc) != Success) {
return NULL;
glXQueryServerString(Display * dpy, int screen, int name)
{
struct glx_screen *psc;
- __GLXdisplayPrivate *priv;
+ struct glx_display *priv;
const char **str;
_X_EXPORT Display *
glXGetCurrentDisplay(void)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
if (NULL == gc)
return NULL;
return gc->currentDpy;
_X_EXPORT GLXContext
glXImportContextEXT(Display *dpy, GLXContextID contextID)
{
- __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+ struct glx_display *priv = __glXInitialize(dpy);
struct glx_screen *psc;
xGLXQueryContextReply reply;
CARD8 opcode;
- GLXContext ctx;
+ struct glx_context *ctx;
int propList[__GLX_MAX_CONTEXT_PROPS * 2], *pProp, nPropListBytes;
int i, renderType;
XID share;
ctx->imported = GL_TRUE;
ctx->share_xid = share;
- return ctx;
+ return (GLXContext) ctx;
}
#endif
_X_EXPORT int
-glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value)
+glXQueryContext(Display * dpy, GLXContext ctx_user, int attribute, int *value)
{
+ struct glx_context *ctx = (struct glx_context *) ctx_user;
+
switch (attribute) {
case GLX_SHARE_CONTEXT_EXT:
*value = ctx->share_xid;
(Display * dpy, GLXContext ctx, int attribute, int *value),
(dpy, ctx, attribute, value), glXQueryContext)
-_X_EXPORT GLXContextID glXGetContextIDEXT(const GLXContext ctx)
+_X_EXPORT GLXContextID glXGetContextIDEXT(const GLXContext ctx_user)
{
+ struct glx_context *ctx = (struct glx_context *) ctx_user;
+
return ctx->xid;
}
_X_EXPORT GLXDrawable
glXGetCurrentReadDrawable(void)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
+
return gc->currentReadable;
}
_X_EXPORT GLXFBConfig *
glXGetFBConfigs(Display * dpy, int screen, int *nelements)
{
- __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+ struct glx_display *priv = __glXInitialize(dpy);
struct glx_config **config_list = NULL;
struct glx_config *config;
unsigned num_configs = 0;
__glXSwapIntervalSGI(int interval)
{
xGLXVendorPrivateReq *req;
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
struct glx_screen *psc;
Display *dpy;
CARD32 *interval_ptr;
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
#ifdef GLX_DIRECT_RENDERING
- if (gc->driContext && psc->driScreen && psc->driScreen->setSwapInterval) {
+ if (gc->isDirect && psc->driScreen && psc->driScreen->setSwapInterval) {
__GLXDRIdrawable *pdraw =
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
psc->driScreen->setSwapInterval(pdraw, interval);
__glXSwapIntervalMESA(unsigned int interval)
{
#ifdef GLX_DIRECT_RENDERING
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
- if (gc != NULL && gc->driContext) {
+ if (gc != NULL && gc->isDirect) {
struct glx_screen *psc;
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
__glXGetSwapIntervalMESA(void)
{
#ifdef GLX_DIRECT_RENDERING
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
- if (gc != NULL && gc->driContext) {
+ if (gc != NULL && gc->isDirect) {
struct glx_screen *psc;
psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
{
int64_t ust, msc, sbc;
int ret;
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
struct glx_screen *psc;
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw;
return GLX_BAD_CONTEXT;
#ifdef GLX_DIRECT_RENDERING
- if (!gc->driContext)
+ if (!gc->isDirect)
return GLX_BAD_CONTEXT;
#endif
static int
__glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
struct glx_screen *psc;
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw;
return GLX_BAD_CONTEXT;
#ifdef GLX_DIRECT_RENDERING
- if (!gc->driContext)
+ if (!gc->isDirect)
return GLX_BAD_CONTEXT;
#endif
_X_EXPORT GLXFBConfigSGIX
glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis)
{
- __GLXdisplayPrivate *priv;
+ struct glx_display *priv;
struct glx_screen *psc = NULL;
if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) != Success)
__glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
int64_t * ust, int64_t * msc, int64_t * sbc)
{
- __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
+ struct glx_display * const priv = __glXInitialize(dpy);
int ret;
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw;
__glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
int64_t target_msc, int64_t divisor, int64_t remainder)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
struct glx_screen *psc = pdraw ? pdraw->psc : NULL;
return -1;
#ifdef GLX_DIRECT_RENDERING
- if (!pdraw || !gc->driContext)
+ if (!pdraw || !gc->isDirect)
return -1;
#endif
int x, int y, int width, int height)
{
xGLXVendorPrivateReq *req;
- GLXContext gc;
+ struct glx_context *gc;
GLXContextTag tag;
CARD32 *drawable_ptr;
INT32 *x_ptr, *y_ptr, *w_ptr, *h_ptr;
SyncHandle();
}
-
-/**
- * GLX_EXT_texture_from_pixmap
- */
-static void
-indirect_bind_tex_image(Display * dpy,
- GLXDrawable drawable,
- int buffer, const int *attrib_list)
-{
- xGLXVendorPrivateReq *req;
- GLXContext gc = __glXGetCurrentContext();
- CARD32 *drawable_ptr;
- INT32 *buffer_ptr;
- CARD32 *num_attrib_ptr;
- CARD32 *attrib_ptr;
- CARD8 opcode;
- unsigned int i;
-
- i = 0;
- if (attrib_list) {
- while (attrib_list[i * 2] != None)
- i++;
- }
-
- opcode = __glXSetupForCommand(dpy);
- if (!opcode)
- return;
-
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate, 12 + 8 * i, req);
- req->reqType = opcode;
- req->glxCode = X_GLXVendorPrivate;
- req->vendorCode = X_GLXvop_BindTexImageEXT;
- req->contextTag = gc->currentContextTag;
-
- drawable_ptr = (CARD32 *) (req + 1);
- buffer_ptr = (INT32 *) (drawable_ptr + 1);
- num_attrib_ptr = (CARD32 *) (buffer_ptr + 1);
- attrib_ptr = (CARD32 *) (num_attrib_ptr + 1);
-
- *drawable_ptr = drawable;
- *buffer_ptr = buffer;
- *num_attrib_ptr = (CARD32) i;
-
- i = 0;
- if (attrib_list) {
- while (attrib_list[i * 2] != None) {
- *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 0];
- *attrib_ptr++ = (CARD32) attrib_list[i * 2 + 1];
- i++;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-static void
-indirect_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
-{
- xGLXVendorPrivateReq *req;
- GLXContext gc = __glXGetCurrentContext();
- CARD32 *drawable_ptr;
- INT32 *buffer_ptr;
- CARD8 opcode;
-
- opcode = __glXSetupForCommand(dpy);
- if (!opcode)
- return;
-
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate, sizeof(CARD32) + sizeof(INT32), req);
- req->reqType = opcode;
- req->glxCode = X_GLXVendorPrivate;
- req->vendorCode = X_GLXvop_ReleaseTexImageEXT;
- req->contextTag = gc->currentContextTag;
-
- drawable_ptr = (CARD32 *) (req + 1);
- buffer_ptr = (INT32 *) (drawable_ptr + 1);
-
- *drawable_ptr = drawable;
- *buffer_ptr = buffer;
-
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-static const struct glx_context_vtable indirect_context_vtable = {
- indirect_destroy_context,
- indirect_wait_gl,
- indirect_wait_x,
- indirect_use_x_font,
- indirect_bind_tex_image,
- indirect_release_tex_image,
-};
-
/*@{*/
static void
__glXBindTexImageEXT(Display * dpy,
GLXDrawable drawable, int buffer, const int *attrib_list)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
if (gc == NULL || gc->vtable->bind_tex_image == NULL)
return;
static void
__glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
{
- GLXContext gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
if (gc == NULL || gc->vtable->release_tex_image == NULL)
return;