}
static void
-dri2WaitX(__GLXDRIdrawable *pdraw)
+dri2_wait_x(__GLXcontext *gc)
{
- struct dri2_drawable *priv = (struct dri2_drawable *) pdraw;
+ struct dri2_drawable *priv = (struct dri2_drawable *)
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
- if (!priv->have_fake_front)
+ if (priv == NULL || !priv->have_fake_front)
return;
dri2_copy_drawable(priv, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
}
static void
-dri2WaitGL(__GLXDRIdrawable * pdraw)
+dri2_wait_gl(__GLXcontext *gc)
{
- struct dri2_drawable *priv = (struct dri2_drawable *) pdraw;
+ struct dri2_drawable *priv = (struct dri2_drawable *)
+ GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL);
- if (!priv->have_fake_front)
+ if (priv == NULL || !priv->have_fake_front)
return;
dri2_copy_drawable(priv, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
if (!pdp->invalidateAvailable)
dri2InvalidateBuffers(priv->dpy, pdraw->base.drawable);
- dri2WaitGL(loaderPrivate);
+ dri2_copy_drawable(pdraw, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
}
}
static const struct glx_context_vtable dri2_context_vtable = {
+ dri2_wait_gl,
+ dri2_wait_x,
+ DRI_glXUseXFont,
dri2_bind_tex_image,
dri2_release_tex_image,
};
psp->createContext = dri2CreateContext;
psp->createDrawable = dri2CreateDrawable;
psp->swapBuffers = dri2SwapBuffers;
- psp->waitGL = dri2WaitGL;
- psp->waitX = dri2WaitX;
psp->getDrawableMSC = NULL;
psp->waitForMSC = NULL;
psp->waitForSBC = NULL;
#define containerOf(ptr, type, member) \
(type *)( (char *)ptr - offsetof(type,member) )
-extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
+extern void DRI_glXUseXFont(GLXContext CC,
+ Font font, int first, int count, int listbase);
#endif
int64_t divisor, int64_t remainder);
void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
int x, int y, int width, int height);
- void (*waitX)(__GLXDRIdrawable *pdraw);
- void (*waitGL)(__GLXDRIdrawable *pdraw);
int (*getDrawableMSC)(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
int64_t *ust, int64_t *msc, int64_t *sbc);
int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc,
} __GLXattributeMachine;
struct glx_context_vtable {
+ void (*wait_gl)(__GLXcontext *ctx);
+ void (*wait_x)(__GLXcontext *ctx);
+ void (*use_x_font)(__GLXcontext *ctx,
+ Font font, int first, int count, int listBase);
void (*bind_tex_image)(Display * dpy,
GLXDrawable drawable,
int buffer, const int *attrib_list);
return rv;
}
-/*
-** Put a barrier in the token stream that forces the GL to finish its
-** work before X can proceed.
-*/
-PUBLIC void
-glXWaitGL(void)
+static void
+indirect_wait_gl(__GLXcontext *gc)
{
-#ifndef GLX_USE_APPLEGL
xGLXWaitGLReq *req;
-#endif
- GLXContext gc = __glXGetCurrentContext();
Display *dpy = gc->currentDpy;
- if (!dpy)
- return;
-
/* Flush any pending commands out */
__glXFlushRenderBuffer(gc, gc->pc);
-#ifdef GLX_USE_APPLEGL
- glFinish();
-#else
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- if (gc->driContext) {
- int screen;
- __GLXDRIdrawable *pdraw =
- GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
-
- if (pdraw != NULL) {
- __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
- glFlush();
- if (psc->driScreen->waitGL != NULL)
- (*psc->driScreen->waitGL) (pdraw);
- }
- return;
- }
-#endif
/* Send the glXWaitGL request */
LockDisplay(dpy);
req->contextTag = gc->currentContextTag;
UnlockDisplay(dpy);
SyncHandle();
-#endif /* GLX_USE_APPLEGL */
}
/*
-** Put a barrier in the token stream that forces X to finish its
-** work before GL can proceed.
+** Put a barrier in the token stream that forces the GL to finish its
+** work before X can proceed.
*/
PUBLIC void
-glXWaitX(void)
+glXWaitGL(void)
{
-#ifndef GLX_USE_APPLEGL
- xGLXWaitXReq *req;
-#endif
GLXContext gc = __glXGetCurrentContext();
- Display *dpy = gc->currentDpy;
- if (!dpy)
- return;
+ if (gc && gc->vtable->use_x_font)
+ 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);
-#ifdef GLX_USE_APPLEGL
- apple_glx_waitx(dpy, gc->driContext);
-#else
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- if (gc->driContext) {
- int screen;
- __GLXDRIdrawable *pdraw =
- GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
-
- if (pdraw != NULL) {
- __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
- if (psc->driScreen->waitX != NULL)
- (*psc->driScreen->waitX) (pdraw);
- }
- else
- XSync(dpy, False);
- return;
- }
-#endif
-
- /*
- ** Send the glXWaitX request.
- */
LockDisplay(dpy);
GetReq(GLXWaitX, req);
req->reqType = gc->majorOpcode;
req->contextTag = gc->currentContextTag;
UnlockDisplay(dpy);
SyncHandle();
-#endif /* GLX_USE_APPLEGL */
}
+/*
+** Put a barrier in the token stream that forces X to finish its
+** work before GL can proceed.
+*/
PUBLIC void
-glXUseXFont(Font font, int first, int count, int listBase)
+glXWaitX(void)
{
-#ifndef GLX_USE_APPLEGL
- xGLXUseXFontReq *req;
-#endif
GLXContext gc = __glXGetCurrentContext();
- Display *dpy = gc->currentDpy;
- if (!dpy)
- return;
+ if (gc && gc->vtable->use_x_font)
+ 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 */
- (void) __glXFlushRenderBuffer(gc, gc->pc);
-#ifdef GLX_USE_APPLEGL
- DRI_glXUseXFont(font, first, count, listBase);
-#else
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- if (gc->driContext) {
- DRI_glXUseXFont(font, first, count, listBase);
- return;
- }
-#endif
+ __glXFlushRenderBuffer(gc, gc->pc);
/* Send the glXUseFont request */
LockDisplay(dpy);
req->listBase = listBase;
UnlockDisplay(dpy);
SyncHandle();
-#endif /* GLX_USE_APPLEGL */
+}
+
+#ifdef GLX_USE_APPLEGL
+
+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_wait_gl,
+ applegl_wait_x,
+ DRI_glXUseXFont,
+ NULL, /* bind_tex_image, */
+ NULL, /* release_tex_image, */
+};
+
+#endif
+
+PUBLIC void
+glXUseXFont(Font font, int first, int count, int listBase)
+{
+ GLXContext gc = __glXGetCurrentContext();
+
+ if (gc && gc->vtable->use_x_font)
+ gc->vtable->use_x_font(gc, font, first, count, listBase);
}
/************************************************************************/
}
static const struct glx_context_vtable indirect_context_vtable = {
+ indirect_wait_gl,
+ indirect_wait_x,
+ indirect_use_x_font,
indirect_bind_tex_image,
indirect_release_tex_image,
};