#endif
}
+static void
+dri2_bind_tex_image(Display * dpy,
+ GLXDrawable drawable,
+ int buffer, const int *attrib_list)
+{
+ GLXContext gc = __glXGetCurrentContext();
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+ if (pdraw != NULL) {
+ if (pdraw->psc->texBuffer->base.version >= 2 &&
+ pdraw->psc->texBuffer->setTexBuffer2 != NULL) {
+ (*pdraw->psc->texBuffer->setTexBuffer2) (gc->__driContext,
+ pdraw->textureTarget,
+ pdraw->textureFormat,
+ pdraw->driDrawable);
+ }
+ else {
+ (*pdraw->psc->texBuffer->setTexBuffer) (gc->__driContext,
+ pdraw->textureTarget,
+ pdraw->driDrawable);
+ }
+ }
+}
+
+static void
+dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
+{
+}
+
+static const struct glx_context_vtable dri2_context_vtable = {
+ dri2_bind_tex_image,
+ dri2_release_tex_image,
+};
+
static __GLXDRIscreen *
dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
__GLXdisplayPrivate * priv)
psp->copySubBuffer = dri2CopySubBuffer;
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
+ psc->direct_context_vtable = &dri2_context_vtable;
+
Xfree(driverName);
Xfree(deviceName);
__GLXattribute **stackPointer;
} __GLXattributeMachine;
+struct glx_context_vtable {
+ void (*bind_tex_image)(Display * dpy,
+ GLXDrawable drawable,
+ int buffer, const int *attrib_list);
+ void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
+
+};
+
/**
* GLX state that needs to be kept on the client. One of these records
* exist for each context that has been made current by this client.
unsigned long thread_id;
char gl_extension_bits[__GL_EXT_BYTES];
+
+ const struct glx_context_vtable *vtable;
};
#define __glXSetError(gc,code) \
*/
char *effectiveGLXexts;
+ /**
+ * Context vtable to use for direct contexts on this screen
+ */
+ const struct glx_context_vtable *direct_context_vtable;
+
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
/**
* Per screen direct rendering interface functions and data.
static const char __glXGLXClientVendorName[] = "Mesa Project and SGI";
static const char __glXGLXClientVersion[] = "1.4";
-
-
-/****************************************************************************/
+static const struct glx_context_vtable glx_indirect_context_vtable;
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
unsigned code, int renderType, int screen)
{
GLXContext gc;
-#ifdef GLX_DIRECT_RENDERING
-#ifdef GLX_USE_APPLEGL
+ __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
+#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_APPLEGL)
int errorcode;
bool x11error;
-#else
- __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-#endif
#endif
if (dpy == NULL)
}
#endif
+ if (gc->driContext != NULL)
+ gc->vtable = psc->direct_context_vtable;
+ else
+ gc->vtable = &glx_indirect_context_vtable;
+
LockDisplay(dpy);
switch (code) {
case X_GLXCreateContext: {
/**
* GLX_EXT_texture_from_pixmap
*/
-/*@{*/
static void
-__glXBindTexImageEXT(Display * dpy,
- GLXDrawable drawable, int buffer, const int *attrib_list)
+glx_indirect_bind_tex_image(Display * dpy,
+ GLXDrawable drawable,
+ int buffer, const int *attrib_list)
{
xGLXVendorPrivateReq *req;
GLXContext gc = __glXGetCurrentContext();
CARD8 opcode;
unsigned int i;
- if (gc == NULL)
- return;
-
i = 0;
if (attrib_list) {
while (attrib_list[i * 2] != None)
i++;
}
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- if (gc->driContext) {
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
-
- if (pdraw != NULL) {
- if (pdraw->psc->texBuffer->base.version >= 2 &&
- pdraw->psc->texBuffer->setTexBuffer2 != NULL) {
- (*pdraw->psc->texBuffer->setTexBuffer2) (gc->__driContext,
- pdraw->textureTarget,
- pdraw->textureFormat,
- pdraw->driDrawable);
- }
- else {
- (*pdraw->psc->texBuffer->setTexBuffer) (gc->__driContext,
- pdraw->textureTarget,
- pdraw->driDrawable);
- }
- }
- return;
- }
-#endif
-
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return;
}
static void
-__glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
+glx_indirect_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
{
xGLXVendorPrivateReq *req;
GLXContext gc = __glXGetCurrentContext();
INT32 *buffer_ptr;
CARD8 opcode;
- if ((gc == NULL) || GC_IS_DIRECT(gc))
- return;
-
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return;
SyncHandle();
}
+static const struct glx_context_vtable glx_indirect_context_vtable = {
+ glx_indirect_bind_tex_image,
+ glx_indirect_release_tex_image,
+};
+
+/*@{*/
+static void
+__glXBindTexImageEXT(Display * dpy,
+ GLXDrawable drawable, int buffer, const int *attrib_list)
+{
+ GLXContext gc = __glXGetCurrentContext();
+
+ if (gc == NULL || gc->vtable->bind_tex_image == NULL)
+ return;
+
+ gc->vtable->bind_tex_image(dpy, drawable, buffer, attrib_list);
+}
+
+static void
+__glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
+{
+ GLXContext gc = __glXGetCurrentContext();
+
+ if (gc == NULL || gc->vtable->release_tex_image == NULL)
+ return;
+
+ gc->vtable->release_tex_image(dpy, drawable, buffer);
+}
+
/*@}*/
#endif /* GLX_USE_APPLEGL */