summaryrefslogtreecommitdiff
path: root/src/glx/x11
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-10-27 15:40:33 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-10-27 15:40:33 +1100
commit70a06e03d45f3d2e1cd1d430ba83c4b22471373c (patch)
tree399cc450107d78041a53b61773635560472ae08a /src/glx/x11
parent295d6f8e8f03192320aa8d4ed767427dd06071a5 (diff)
parent02c9009bb842cd8a47bc36ea274ef54ff47e1528 (diff)
Merge remote branch 'origin/gallium-0.2' into gallium-0.2
Diffstat (limited to 'src/glx/x11')
-rw-r--r--src/glx/x11/XF86dri.c1003
-rw-r--r--src/glx/x11/clientattrib.c160
-rw-r--r--src/glx/x11/compsize.c246
-rw-r--r--src/glx/x11/dri2.c93
-rw-r--r--src/glx/x11/dri2.h15
-rw-r--r--src/glx/x11/dri2_glx.c43
-rw-r--r--src/glx/x11/dri_common.c3
-rw-r--r--src/glx/x11/dri_common.h18
-rw-r--r--src/glx/x11/dri_glx.c10
-rw-r--r--src/glx/x11/drisw_glx.c593
-rw-r--r--src/glx/x11/eval.c143
-rw-r--r--src/glx/x11/glcontextmodes.c619
-rw-r--r--src/glx/x11/glcontextmodes.h31
-rw-r--r--src/glx/x11/glx_pbuffer.c385
-rw-r--r--src/glx/x11/glx_query.c74
-rw-r--r--src/glx/x11/glxclient.h5
-rw-r--r--src/glx/x11/glxcmds.c8
-rw-r--r--src/glx/x11/glxcurrent.c550
-rw-r--r--src/glx/x11/glxext.c1406
-rw-r--r--src/glx/x11/glxextensions.c362
-rw-r--r--src/glx/x11/glxextensions.h57
-rw-r--r--src/glx/x11/glxhash.c552
-rw-r--r--src/glx/x11/glxhash.h17
-rw-r--r--src/glx/x11/indirect_init.h1
-rw-r--r--src/glx/x11/indirect_texture_compression.c507
-rw-r--r--src/glx/x11/indirect_transpose_matrix.c59
-rw-r--r--src/glx/x11/indirect_vertex_array.c2794
-rw-r--r--src/glx/x11/indirect_vertex_array.h44
-rw-r--r--src/glx/x11/indirect_vertex_array_priv.h110
-rw-r--r--src/glx/x11/indirect_vertex_program.c329
-rw-r--r--src/glx/x11/indirect_window_pos.c71
-rw-r--r--src/glx/x11/packrender.h243
-rw-r--r--src/glx/x11/packsingle.h215
-rw-r--r--src/glx/x11/pixel.c723
-rw-r--r--src/glx/x11/pixelstore.c526
-rw-r--r--src/glx/x11/render2.c569
-rw-r--r--src/glx/x11/renderpix.c214
-rw-r--r--src/glx/x11/single2.c1400
-rw-r--r--src/glx/x11/singlepix.c284
-rw-r--r--src/glx/x11/vertarr.c222
-rw-r--r--src/glx/x11/xf86dri.h106
-rw-r--r--src/glx/x11/xf86dristr.h440
-rw-r--r--src/glx/x11/xfont.c424
43 files changed, 8074 insertions, 7600 deletions
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c
index cd0adc3930..4faa8bbfb1 100644
--- a/src/glx/x11/XF86dri.c
+++ b/src/glx/x11/XF86dri.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -68,27 +69,28 @@ static char xf86dri_extension_name[] = XF86DRINAME;
* *
*****************************************************************************/
-static int close_display(Display *dpy, XExtCodes *extCodes);
+static int close_display(Display * dpy, XExtCodes * extCodes);
static /* const */ XExtensionHooks xf86dri_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
};
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86dri_info,
- xf86dri_extension_name,
- &xf86dri_extension_hooks,
- 0, NULL)
+static
+XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
+ xf86dri_extension_name,
+ &xf86dri_extension_hooks, 0, NULL)
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info)
+static
+XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
/*****************************************************************************
@@ -96,7 +98,6 @@ static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info)
* public XFree86-DRI Extension routines *
* *
*****************************************************************************/
-
#if 0
#include <stdio.h>
#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg);
@@ -104,550 +105,534 @@ static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info)
#define TRACE(msg)
#endif
-
-PUBLIC Bool XF86DRIQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
+PUBLIC Bool
+XF86DRIQueryExtension(Display * dpy, int *event_basep,
+ int *error_basep)
{
- XExtDisplayInfo *info = find_display (dpy);
-
- TRACE("QueryExtension...");
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- TRACE("QueryExtension... return True");
- return True;
- } else {
- TRACE("QueryExtension... return False");
- return False;
- }
+ XExtDisplayInfo *info = find_display(dpy);
+
+ TRACE("QueryExtension...");
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ TRACE("QueryExtension... return True");
+ return True;
+ }
+ else {
+ TRACE("QueryExtension... return False");
+ return False;
+ }
}
-PUBLIC Bool XF86DRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
- Display* dpy;
- int* majorVersion;
- int* minorVersion;
- int* patchVersion;
+PUBLIC Bool
+XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+ int *patchVersion)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIQueryVersionReply rep;
- xXF86DRIQueryVersionReq *req;
-
- TRACE("QueryVersion...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return False");
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- *patchVersion = rep.patchVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIQueryVersionReply rep;
+ xXF86DRIQueryVersionReq *req;
+
+ TRACE("QueryVersion...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIQueryVersion;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryVersion... return False");
+ return False;
+ }
+ *majorVersion = rep.majorVersion;
+ *minorVersion = rep.minorVersion;
+ *patchVersion = rep.patchVersion;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryVersion... return True");
+ return True;
}
-PUBLIC Bool XF86DRIQueryDirectRenderingCapable(dpy, screen, isCapable)
- Display* dpy;
- int screen;
- Bool* isCapable;
+PUBLIC Bool
+XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
+ Bool * isCapable)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIQueryDirectRenderingCapableReply rep;
- xXF86DRIQueryDirectRenderingCapableReq *req;
-
- TRACE("QueryDirectRenderingCapable...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryDirectRenderingCapable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return False");
- return False;
- }
- *isCapable = rep.isCapable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIQueryDirectRenderingCapableReply rep;
+ xXF86DRIQueryDirectRenderingCapableReq *req;
+
+ TRACE("QueryDirectRenderingCapable...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIQueryDirectRenderingCapable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryDirectRenderingCapable... return False");
+ return False;
+ }
+ *isCapable = rep.isCapable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryDirectRenderingCapable... return True");
+ return True;
}
-PUBLIC Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString)
- Display* dpy;
- int screen;
- drm_handle_t * hSAREA;
- char **busIdString;
+PUBLIC Bool
+XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
+ char **busIdString)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIOpenConnectionReply rep;
- xXF86DRIOpenConnectionReq *req;
-
- TRACE("OpenConnection...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIOpenConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIOpenConnection;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
-
- *hSAREA = rep.hSAREALow;
- if (sizeof(drm_handle_t) == 8) {
- int shift = 32; /* var to prevent warning on next line */
- *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
- }
-
- if (rep.length) {
- if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
- _XEatData(dpy, ((rep.busIdStringLength+3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
- _XReadPad(dpy, *busIdString, rep.busIdStringLength);
- } else {
- *busIdString = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIOpenConnectionReply rep;
+ xXF86DRIOpenConnectionReq *req;
+
+ TRACE("OpenConnection...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIOpenConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIOpenConnection;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return False");
+ return False;
+ }
+
+ *hSAREA = rep.hSAREALow;
+ if (sizeof(drm_handle_t) == 8) {
+ int shift = 32; /* var to prevent warning on next line */
+ *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
+ }
+
+ if (rep.length) {
+ if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) {
+ _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return False");
+ return False;
+ }
+ _XReadPad(dpy, *busIdString, rep.busIdStringLength);
+ }
+ else {
+ *busIdString = NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return True");
+ return True;
}
-PUBLIC Bool XF86DRIAuthConnection(dpy, screen, magic)
- Display* dpy;
- int screen;
- drm_magic_t magic;
+PUBLIC Bool
+XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIAuthConnectionReq *req;
- xXF86DRIAuthConnectionReply rep;
-
- TRACE("AuthConnection...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIAuthConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIAuthConnection;
- req->screen = screen;
- req->magic = magic;
- rep.authenticated = 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return False");
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIAuthConnectionReq *req;
+ xXF86DRIAuthConnectionReply rep;
+
+ TRACE("AuthConnection...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIAuthConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIAuthConnection;
+ req->screen = screen;
+ req->magic = magic;
+ rep.authenticated = 0;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("AuthConnection... return False");
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("AuthConnection... return True");
+ return True;
}
-PUBLIC Bool XF86DRICloseConnection(dpy, screen)
- Display* dpy;
- int screen;
+PUBLIC Bool
+XF86DRICloseConnection(Display * dpy, int screen)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRICloseConnectionReq *req;
-
- TRACE("CloseConnection...");
-
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICloseConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICloseConnection;
- req->screen = screen;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CloseConnection... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRICloseConnectionReq *req;
+
+ TRACE("CloseConnection...");
+
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICloseConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICloseConnection;
+ req->screen = screen;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CloseConnection... return True");
+ return True;
}
-PUBLIC Bool XF86DRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
- ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName)
- Display* dpy;
- int screen;
- int* ddxDriverMajorVersion;
- int* ddxDriverMinorVersion;
- int* ddxDriverPatchVersion;
- char** clientDriverName;
+PUBLIC Bool
+XF86DRIGetClientDriverName(Display * dpy, int screen,
+ int *ddxDriverMajorVersion,
+ int *ddxDriverMinorVersion,
+ int *ddxDriverPatchVersion,
+ char **clientDriverName)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIGetClientDriverNameReply rep;
- xXF86DRIGetClientDriverNameReq *req;
-
- TRACE("GetClientDriverName...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetClientDriverName, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetClientDriverName;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
-
- *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
- *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
- *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
- if (rep.length) {
- if (!(*clientDriverName = (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
- _XEatData(dpy, ((rep.clientDriverNameLength+3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
- _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
- } else {
- *clientDriverName = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIGetClientDriverNameReply rep;
+ xXF86DRIGetClientDriverNameReq *req;
+
+ TRACE("GetClientDriverName...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetClientDriverName, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetClientDriverName;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return False");
+ return False;
+ }
+
+ *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
+ *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
+ *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
+
+ if (rep.length) {
+ if (!
+ (*clientDriverName =
+ (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) {
+ _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return False");
+ return False;
+ }
+ _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
+ }
+ else {
+ *clientDriverName = NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return True");
+ return True;
}
-PUBLIC Bool XF86DRICreateContextWithConfig(dpy, screen, configID, context,
- hHWContext)
- Display* dpy;
- int screen;
- int configID;
- XID* context;
- drm_context_t * hHWContext;
+PUBLIC Bool
+XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
+ XID * context, drm_context_t * hHWContext)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRICreateContextReply rep;
- xXF86DRICreateContextReq *req;
-
- TRACE("CreateContext...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateContext;
- req->visual = configID;
- req->screen = screen;
- *context = XAllocID(dpy);
- req->context = *context;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return False");
- return False;
- }
- *hHWContext = rep.hHWContext;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReq *req;
+
+ TRACE("CreateContext...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICreateContext, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICreateContext;
+ req->visual = configID;
+ req->screen = screen;
+ *context = XAllocID(dpy);
+ req->context = *context;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateContext... return False");
+ return False;
+ }
+ *hHWContext = rep.hHWContext;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateContext... return True");
+ return True;
}
-PUBLIC Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
- Display* dpy;
- int screen;
- Visual* visual;
- XID* context;
- drm_context_t * hHWContext;
+PUBLIC Bool
+XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
+ XID * context, drm_context_t * hHWContext)
{
- return XF86DRICreateContextWithConfig( dpy, screen, visual->visualid,
- context, hHWContext );
+ return XF86DRICreateContextWithConfig(dpy, screen, visual->visualid,
+ context, hHWContext);
}
-PUBLIC Bool XF86DRIDestroyContext(Display *dpy, int screen,
- XID context )
+PUBLIC Bool
+XF86DRIDestroyContext(Display * dpy, int screen, XID context)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIDestroyContextReq *req;
-
- TRACE("DestroyContext...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyContext;
- req->screen = screen;
- req->context = context;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("DestroyContext... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIDestroyContextReq *req;
+
+ TRACE("DestroyContext...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyContext, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyContext;
+ req->screen = screen;
+ req->context = context;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("DestroyContext... return True");
+ return True;
}
-PUBLIC Bool XF86DRICreateDrawable(Display *dpy, int screen,
- XID drawable, drm_drawable_t * hHWDrawable )
+PUBLIC Bool
+XF86DRICreateDrawable(Display * dpy, int screen,
+ XID drawable, drm_drawable_t * hHWDrawable)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRICreateDrawableReply rep;
- xXF86DRICreateDrawableReq *req;
-
- TRACE("CreateDrawable...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateDrawable;
- req->screen = screen;
- req->drawable = drawable;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return False");
- return False;
- }
- *hHWDrawable = rep.hHWDrawable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReq *req;
+
+ TRACE("CreateDrawable...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICreateDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICreateDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateDrawable... return False");
+ return False;
+ }
+ *hHWDrawable = rep.hHWDrawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateDrawable... return True");
+ return True;
}
-static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
+static int
+noopErrorHandler(Display * dpy, XErrorEvent * xerr)
{
- return 0;
+ return 0;
}
-PUBLIC Bool XF86DRIDestroyDrawable(Display *dpy, int screen,
- XID drawable )
+PUBLIC Bool
+XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIDestroyDrawableReq *req;
- int (*oldXErrorHandler)(Display *, XErrorEvent *);
-
- TRACE("DestroyDrawable...");
- XF86DRICheckExtension (dpy, info, False);
-
- /* This is called from the DRI driver, which used call it like this
- *
- * if (windowExists(drawable))
- * destroyDrawable(drawable);
- *
- * which is a textbook race condition - the window may disappear
- * from the server between checking for its existance and
- * destroying it. Instead we change the semantics of
- * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
- * the windows is gone, by wrapping the destroy call in an error
- * handler. */
-
- XSync(dpy, False);
- oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyDrawable;
- req->screen = screen;
- req->drawable = drawable;
- UnlockDisplay(dpy);
- SyncHandle();
-
- XSetErrorHandler(oldXErrorHandler);
-
- TRACE("DestroyDrawable... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIDestroyDrawableReq *req;
+ int (*oldXErrorHandler) (Display *, XErrorEvent *);
+
+ TRACE("DestroyDrawable...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ /* This is called from the DRI driver, which used call it like this
+ *
+ * if (windowExists(drawable))
+ * destroyDrawable(drawable);
+ *
+ * which is a textbook race condition - the window may disappear
+ * from the server between checking for its existance and
+ * destroying it. Instead we change the semantics of
+ * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+ * the windows is gone, by wrapping the destroy call in an error
+ * handler. */
+
+ XSync(dpy, False);
+ oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSetErrorHandler(oldXErrorHandler);
+
+ TRACE("DestroyDrawable... return True");
+ return True;
}
-PUBLIC Bool XF86DRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable,
- unsigned int* index, unsigned int* stamp,
- int* X, int* Y, int* W, int* H,
- int* numClipRects, drm_clip_rect_t ** pClipRects,
- int* backX, int* backY,
- int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
+PUBLIC Bool
+XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+ unsigned int *index, unsigned int *stamp,
+ int *X, int *Y, int *W, int *H,
+ int *numClipRects, drm_clip_rect_t ** pClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects,
+ drm_clip_rect_t ** pBackClipRects)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIGetDrawableInfoReply rep;
- xXF86DRIGetDrawableInfoReq *req;
- int total_rects;
-
- TRACE("GetDrawableInfo...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDrawableInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDrawableInfo;
- req->screen = screen;
- req->drawable = drawable;
-
- if (!_XReply(dpy, (xReply *)&rep, 1, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
- *index = rep.drawableTableIndex;
- *stamp = rep.drawableTableStamp;
- *X = (int)rep.drawableX;
- *Y = (int)rep.drawableY;
- *W = (int)rep.drawableWidth;
- *H = (int)rep.drawableHeight;
- *numClipRects = rep.numClipRects;
- total_rects = *numClipRects;
-
- *backX = rep.backX;
- *backY = rep.backY;
- *numBackClipRects = rep.numBackClipRects;
- total_rects += *numBackClipRects;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReq *req;
+ int total_rects;
+
+ TRACE("GetDrawableInfo...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetDrawableInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetDrawableInfo;
+ req->screen = screen;
+ req->drawable = drawable;
+
+ if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return False");
+ return False;
+ }
+ *index = rep.drawableTableIndex;
+ *stamp = rep.drawableTableStamp;
+ *X = (int) rep.drawableX;
+ *Y = (int) rep.drawableY;
+ *W = (int) rep.drawableWidth;
+ *H = (int) rep.drawableHeight;
+ *numClipRects = rep.numClipRects;
+ total_rects = *numClipRects;
+
+ *backX = rep.backX;
+ *backY = rep.backY;
+ *numBackClipRects = rep.numBackClipRects;
+ total_rects += *numBackClipRects;
#if 0
- /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
- * backwards compatibility (Because of the >> 2 shift) but the fix
- * enables multi-threaded apps to work.
- */
- if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
- SIZEOF(xGenericReply) +
- total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) {
- _XEatData(dpy, rep.length);
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
+ /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
+ * backwards compatibility (Because of the >> 2 shift) but the fix
+ * enables multi-threaded apps to work.
+ */
+ if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
+ SIZEOF(xGenericReply) +
+ total_rects * sizeof(drm_clip_rect_t)) +
+ 3) & ~3) >> 2)) {
+ _XEatData(dpy, rep.length);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return False");
+ return False;
+ }
#endif
- if (*numClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
- *pClipRects = (drm_clip_rect_t *)Xcalloc(len, 1);
- if (*pClipRects)
- _XRead(dpy, (char*)*pClipRects, len);
- } else {
- *pClipRects = NULL;
- }
-
- if (*numBackClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
- *pBackClipRects = (drm_clip_rect_t *)Xcalloc(len, 1);
- if (*pBackClipRects)
- _XRead(dpy, (char*)*pBackClipRects, len);
- } else {
- *pBackClipRects = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return True");
- return True;
+ if (*numClipRects) {
+ int len = sizeof(drm_clip_rect_t) * (*numClipRects);
+
+ *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
+ if (*pClipRects)
+ _XRead(dpy, (char *) *pClipRects, len);
+ }
+ else {
+ *pClipRects = NULL;
+ }
+
+ if (*numBackClipRects) {
+ int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
+
+ *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
+ if (*pBackClipRects)
+ _XRead(dpy, (char *) *pBackClipRects, len);
+ }
+ else {
+ *pBackClipRects = NULL;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return True");
+ return True;
}
-PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer,
- fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate)
- Display* dpy;
- int screen;
- drm_handle_t * hFrameBuffer;
- int* fbOrigin;
- int* fbSize;
- int* fbStride;
- int* devPrivateSize;
- void** pDevPrivate;
+PUBLIC Bool
+XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
+ int *fbOrigin, int *fbSize, int *fbStride,
+ int *devPrivateSize, void **pDevPrivate)
{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86DRIGetDeviceInfoReply rep;
- xXF86DRIGetDeviceInfoReq *req;
-
- TRACE("GetDeviceInfo...");
- XF86DRICheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDeviceInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDeviceInfo;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
-
- *hFrameBuffer = rep.hFrameBufferLow;
- if (sizeof(drm_handle_t) == 8) {
- int shift = 32; /* var to prevent warning on next line */
- *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
- }
-
- *fbOrigin = rep.framebufferOrigin;
- *fbSize = rep.framebufferSize;
- *fbStride = rep.framebufferStride;
- *devPrivateSize = rep.devPrivateSize;
-
- if (rep.length) {
- if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
- _XEatData(dpy, ((rep.devPrivateSize+3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
- _XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize);
- } else {
- *pDevPrivate = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return True");
- return True;
+ XExtDisplayInfo *info = find_display(dpy);
+ xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReq *req;
+
+ TRACE("GetDeviceInfo...");
+ XF86DRICheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetDeviceInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetDeviceInfo;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return False");
+ return False;
+ }
+
+ *hFrameBuffer = rep.hFrameBufferLow;
+ if (sizeof(drm_handle_t) == 8) {
+ int shift = 32; /* var to prevent warning on next line */
+ *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
+ }
+
+ *fbOrigin = rep.framebufferOrigin;
+ *fbSize = rep.framebufferSize;
+ *fbStride = rep.framebufferStride;
+ *devPrivateSize = rep.devPrivateSize;
+
+ if (rep.length) {
+ if (!(*pDevPrivate = (void *) Xcalloc(rep.devPrivateSize, 1))) {
+ _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return False");
+ return False;
+ }
+ _XRead(dpy, (char *) *pDevPrivate, rep.devPrivateSize);
+ }
+ else {
+ *pDevPrivate = NULL;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return True");
+ return True;
}
-PUBLIC Bool XF86DRIOpenFullScreen(dpy, screen, drawable)
- Display* dpy;
- int screen;
- Drawable drawable;
+PUBLIC Bool
+XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable)
{
- /* This function and the underlying X protocol are deprecated.
- */
- (void) dpy;
- (void) screen;
- (void) drawable;
- return False;
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return False;
}
-PUBLIC Bool XF86DRICloseFullScreen(dpy, screen, drawable)
- Display* dpy;
- int screen;
- Drawable drawable;
+PUBLIC Bool
+XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable)
{
- /* This function and the underlying X protocol are deprecated.
- */
- (void) dpy;
- (void) screen;
- (void) drawable;
- return True;
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return True;
}
#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/clientattrib.c b/src/glx/x11/clientattrib.c
index fb45f62142..3be59c67d7 100644
--- a/src/glx/x11/clientattrib.c
+++ b/src/glx/x11/clientattrib.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -36,100 +37,107 @@
/*****************************************************************************/
static void
-do_enable_disable(GLenum array, GLboolean val )
+do_enable_disable(GLenum array, GLboolean val)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- unsigned index = 0;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ unsigned index = 0;
- if ( array == GL_TEXTURE_COORD_ARRAY ) {
- index = __glXGetActiveTextureUnit( state );
- }
+ if (array == GL_TEXTURE_COORD_ARRAY) {
+ index = __glXGetActiveTextureUnit(state);
+ }
- if ( ! __glXSetArrayEnable( state, array, index, val ) ) {
- __glXSetError(gc, GL_INVALID_ENUM);
- }
+ if (!__glXSetArrayEnable(state, array, index, val)) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ }
}
-void __indirect_glEnableClientState(GLenum array)
+void
+__indirect_glEnableClientState(GLenum array)
{
- do_enable_disable( array, GL_TRUE );
+ do_enable_disable(array, GL_TRUE);
}
-void __indirect_glDisableClientState(GLenum array)
+void
+__indirect_glDisableClientState(GLenum array)
{
- do_enable_disable( array, GL_FALSE );
+ do_enable_disable(array, GL_FALSE);
}
/************************************************************************/
-void __indirect_glPushClientAttrib(GLuint mask)
+void
+__indirect_glPushClientAttrib(GLuint mask)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- __GLXattribute **spp = gc->attributes.stackPointer, *sp;
-
- if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) {
- if (!(sp = *spp)) {
- sp = (__GLXattribute *)Xmalloc(sizeof(__GLXattribute));
- *spp = sp;
- }
- sp->mask = mask;
- gc->attributes.stackPointer = spp + 1;
- if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
- sp->storePack = state->storePack;
- sp->storeUnpack = state->storeUnpack;
- }
- if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
- __glXPushArrayState( state );
- }
- } else {
- __glXSetError(gc, GL_STACK_OVERFLOW);
- return;
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ __GLXattribute **spp = gc->attributes.stackPointer, *sp;
+
+ if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) {
+ if (!(sp = *spp)) {
+ sp = (__GLXattribute *) Xmalloc(sizeof(__GLXattribute));
+ *spp = sp;
+ }
+ sp->mask = mask;
+ gc->attributes.stackPointer = spp + 1;
+ if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
+ sp->storePack = state->storePack;
+ sp->storeUnpack = state->storeUnpack;
+ }
+ if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
+ __glXPushArrayState(state);
+ }
+ }
+ else {
+ __glXSetError(gc, GL_STACK_OVERFLOW);
+ return;
+ }
}
-void __indirect_glPopClientAttrib(void)
+void
+__indirect_glPopClientAttrib(void)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- __GLXattribute **spp = gc->attributes.stackPointer, *sp;
- GLuint mask;
-
- if (spp > &gc->attributes.stack[0]) {
- --spp;
- sp = *spp;
- assert(sp != 0);
- mask = sp->mask;
- gc->attributes.stackPointer = spp;
-
- if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
- state->storePack = sp->storePack;
- state->storeUnpack = sp->storeUnpack;
- }
- if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
- __glXPopArrayState( state );
- }
-
- sp->mask = 0;
- } else {
- __glXSetError(gc, GL_STACK_UNDERFLOW);
- return;
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ __GLXattribute **spp = gc->attributes.stackPointer, *sp;
+ GLuint mask;
+
+ if (spp > &gc->attributes.stack[0]) {
+ --spp;
+ sp = *spp;
+ assert(sp != 0);
+ mask = sp->mask;
+ gc->attributes.stackPointer = spp;
+
+ if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
+ state->storePack = sp->storePack;
+ state->storeUnpack = sp->storeUnpack;
+ }
+ if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
+ __glXPopArrayState(state);
+ }
+
+ sp->mask = 0;
+ }
+ else {
+ __glXSetError(gc, GL_STACK_UNDERFLOW);
+ return;
+ }
}
-void __glFreeAttributeState(__GLXcontext *gc)
+void
+__glFreeAttributeState(__GLXcontext * gc)
{
- __GLXattribute *sp, **spp;
-
- for (spp = &gc->attributes.stack[0];
- spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
- spp++) {
- sp = *spp;
- if (sp) {
- XFree((char *)sp);
- } else {
- break;
- }
- }
+ __GLXattribute *sp, **spp;
+
+ for (spp = &gc->attributes.stack[0];
+ spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; spp++) {
+ sp = *spp;
+ if (sp) {
+ XFree((char *) sp);
+ }
+ else {
+ break;
+ }
+ }
}
diff --git a/src/glx/x11/compsize.c b/src/glx/x11/compsize.c
index d46d3d41d1..f8f453d891 100644
--- a/src/glx/x11/compsize.c
+++ b/src/glx/x11/compsize.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -35,151 +36,156 @@
/*
** Return the number of elements per group of a specified format
*/
-GLint __glElementsPerGroup(GLenum format, GLenum type)
+GLint
+__glElementsPerGroup(GLenum format, GLenum type)
{
- /*
+ /*
** To make row length computation valid for image extraction,
** packed pixel types assume elements per group equals one.
*/
- switch(type) {
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- case GL_UNSIGNED_SHORT_8_8_APPLE:
- case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
- case GL_UNSIGNED_SHORT_15_1_MESA:
- case GL_UNSIGNED_SHORT_1_15_REV_MESA:
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_24_8_NV:
- case GL_UNSIGNED_INT_24_8_MESA:
- case GL_UNSIGNED_INT_8_24_REV_MESA:
+ switch (type) {
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+ case GL_UNSIGNED_SHORT_15_1_MESA:
+ case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_24_8_NV:
+ case GL_UNSIGNED_INT_24_8_MESA:
+ case GL_UNSIGNED_INT_8_24_REV_MESA:
return 1;
- default:
+ default:
break;
- }
+ }
- switch(format) {
- case GL_RGB:
- case GL_BGR:
- return 3;
- case GL_422_EXT:
- case GL_422_REV_EXT:
- case GL_422_AVERAGE_EXT:
- case GL_422_REV_AVERAGE_EXT:
- case GL_YCBCR_422_APPLE:
- case GL_LUMINANCE_ALPHA:
- return 2;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- return 4;
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_INTENSITY:
- return 1;
- default:
- return 0;
- }
+ switch (format) {
+ case GL_RGB:
+ case GL_BGR:
+ return 3;
+ case GL_422_EXT:
+ case GL_422_REV_EXT:
+ case GL_422_AVERAGE_EXT:
+ case GL_422_REV_AVERAGE_EXT:
+ case GL_YCBCR_422_APPLE:
+ case GL_LUMINANCE_ALPHA:
+ return 2;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ return 4;
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_INTENSITY:
+ return 1;
+ default:
+ return 0;
+ }
}
/*
** Return the number of bytes per element, based on the element type (other
** than GL_BITMAP).
*/
-GLint __glBytesPerElement(GLenum type)
+GLint
+__glBytesPerElement(GLenum type)
{
- switch(type) {
- case GL_UNSIGNED_SHORT:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- case GL_UNSIGNED_SHORT_8_8_APPLE:
- case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
- case GL_UNSIGNED_SHORT_15_1_MESA:
- case GL_UNSIGNED_SHORT_1_15_REV_MESA:
- return 2;
- case GL_UNSIGNED_BYTE:
- case GL_BYTE:
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- return 1;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_24_8_NV:
- case GL_UNSIGNED_INT_24_8_MESA:
- case GL_UNSIGNED_INT_8_24_REV_MESA:
- return 4;
- default:
- return 0;
- }
+ switch (type) {
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+ case GL_UNSIGNED_SHORT_15_1_MESA:
+ case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+ return 2;
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ return 1;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_24_8_NV:
+ case GL_UNSIGNED_INT_24_8_MESA:
+ case GL_UNSIGNED_INT_8_24_REV_MESA:
+ return 4;
+ default:
+ return 0;
+ }
}
/*
** Compute memory required for internal packed array of data of given type
** and format.
*/
-GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, GLenum target)
+GLint
+__glImageSize(GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, GLenum target)
{
- int bytes_per_row;
- int components;
+ int bytes_per_row;
+ int components;
- switch( target ) {
- case GL_PROXY_TEXTURE_1D:
- case GL_PROXY_TEXTURE_2D:
- case GL_PROXY_TEXTURE_3D:
- case GL_PROXY_TEXTURE_4D_SGIS:
- case GL_PROXY_TEXTURE_CUBE_MAP:
- case GL_PROXY_TEXTURE_RECTANGLE_ARB:
- case GL_PROXY_HISTOGRAM:
- case GL_PROXY_COLOR_TABLE:
- case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
- case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
- return 0;
- }
+ switch (target) {
+ case GL_PROXY_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_4D_SGIS:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ case GL_PROXY_TEXTURE_RECTANGLE_ARB:
+ case GL_PROXY_HISTOGRAM:
+ case GL_PROXY_COLOR_TABLE:
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
+ case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
+ case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
+ return 0;
+ }
- if (width < 0 || height < 0 || depth < 0) {
- return 0;
- }
+ if (width < 0 || height < 0 || depth < 0) {
+ return 0;
+ }
- /*
+ /*
** Zero is returned if either format or type are invalid.
*/
- components = __glElementsPerGroup(format,type);
- if (type == GL_BITMAP) {
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
- bytes_per_row = (width + 7) >> 3;
- } else {
- return 0;
- }
- } else {
- bytes_per_row = __glBytesPerElement(type) * width;
- }
+ components = __glElementsPerGroup(format, type);
+ if (type == GL_BITMAP) {
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ bytes_per_row = (width + 7) >> 3;
+ }
+ else {
+ return 0;
+ }
+ }
+ else {
+ bytes_per_row = __glBytesPerElement(type) * width;
+ }
- return bytes_per_row * height * depth * components;
+ return bytes_per_row * height * depth * components;
}
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
index 5acf7ac531..91a9c2af93 100644
--- a/src/glx/x11/dri2.c
+++ b/src/glx/x11/dri2.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright © 2008 Red Hat, Inc.
*
@@ -101,8 +102,8 @@ Bool DRI2QueryVersion(Display *dpy, int *major, int *minor)
return True;
}
-Bool DRI2Connect(Display *dpy, int screen,
- char **driverName, char **busId, unsigned int *sareaHandle)
+Bool DRI2Connect(Display *dpy, XID window,
+ char **driverName, char **deviceName)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2ConnectReply rep;
@@ -114,14 +115,15 @@ Bool DRI2Connect(Display *dpy, int screen,
GetReq(DRI2Connect, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2Connect;
- req->screen = screen;
+ req->window = window;
+ req->driverType = DRI2DriverDRI;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
- if (rep.driverNameLength == 0 && rep.busIdLength == 0) {
+ if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
UnlockDisplay(dpy);
SyncHandle();
return False;
@@ -131,7 +133,7 @@ Bool DRI2Connect(Display *dpy, int screen,
if (*driverName == NULL) {
_XEatData(dpy,
((rep.driverNameLength + 3) & ~3) +
- ((rep.busIdLength + 3) & ~3));
+ ((rep.deviceNameLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
return False;
@@ -139,16 +141,16 @@ Bool DRI2Connect(Display *dpy, int screen,
_XReadPad(dpy, *driverName, rep.driverNameLength);
(*driverName)[rep.driverNameLength] = '\0';
- *busId = Xmalloc(rep.busIdLength + 1);
- if (*busId == NULL) {
+ *deviceName = Xmalloc(rep.deviceNameLength + 1);
+ if (*deviceName == NULL) {
Xfree(*driverName);
- _XEatData(dpy, ((rep.busIdLength + 3) & ~3));
+ _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
return False;
}
- _XReadPad(dpy, *busId, rep.busIdLength);
- (*busId)[rep.busIdLength] = '\0';
+ _XReadPad(dpy, *deviceName, rep.deviceNameLength);
+ (*deviceName)[rep.deviceNameLength] = '\0';
UnlockDisplay(dpy);
SyncHandle();
@@ -156,26 +158,27 @@ Bool DRI2Connect(Display *dpy, int screen,
return True;
}
-Bool DRI2AuthConnection(Display *dpy, int screen, drm_magic_t magic)
+Bool DRI2Authenticate(Display *dpy, XID window, drm_magic_t magic)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
- xDRI2AuthConnectionReq *req;
- xDRI2AuthConnectionReply rep;
+ xDRI2AuthenticateReq *req;
+ xDRI2AuthenticateReply rep;
XextCheckExtension (dpy, info, dri2ExtensionName, False);
LockDisplay(dpy);
- GetReq(DRI2AuthConnection, req);
+ GetReq(DRI2Authenticate, req);
req->reqType = info->codes->major_opcode;
- req->dri2ReqType = X_DRI2AuthConnection;
- req->screen = screen;
+ req->dri2ReqType = X_DRI2Authenticate;
+ req->window = window;
req->magic = magic;
- rep.authenticated = 0;
+
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
+
UnlockDisplay(dpy);
SyncHandle();
@@ -198,6 +201,24 @@ void DRI2CreateDrawable(Display *dpy, XID drawable)
SyncHandle();
}
+void DRI2DestroyDrawable(Display *dpy, XID drawable)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2DestroyDrawableReq *req;
+
+ XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+ XSync(dpy, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2DestroyDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2DestroyDrawable;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
int *width, int *height,
unsigned int *attachments, int count,
@@ -256,45 +277,27 @@ DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
return buffers;
}
-void DRI2SwapBuffers(Display *dpy, XID drawable,
- int x, int y, int width, int height)
+void DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
+ CARD32 dest, CARD32 src)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
- xDRI2SwapBuffersReq *req;
- xDRI2SwapBuffersReply rep;
+ xDRI2CopyRegionReq *req;
+ xDRI2CopyRegionReply rep;
XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
LockDisplay(dpy);
- GetReq(DRI2SwapBuffers, req);
+ GetReq(DRI2CopyRegion, req);
req->reqType = info->codes->major_opcode;
- req->dri2ReqType = X_DRI2SwapBuffers;
+ req->dri2ReqType = X_DRI2CopyRegion;
req->drawable = drawable;
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
+ req->region = region;
+ req->dest = dest;
+ req->src = src;
+ req->bitmask = 0;
_XReply(dpy, (xReply *)&rep, 0, xFalse);
UnlockDisplay(dpy);
SyncHandle();
}
-
-void DRI2DestroyDrawable(Display *dpy, XID drawable)
-{
- XExtDisplayInfo *info = DRI2FindDisplay(dpy);
- xDRI2DestroyDrawableReq *req;
-
- XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
-
- XSync(dpy, False);
-
- LockDisplay(dpy);
- GetReq(DRI2DestroyDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->dri2ReqType = X_DRI2DestroyDrawable;
- req->drawable = drawable;
- UnlockDisplay(dpy);
- SyncHandle();
-}
diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h
index e57c4ce644..c1bfa664bb 100644
--- a/src/glx/x11/dri2.h
+++ b/src/glx/x11/dri2.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright © 2007,2008 Red Hat, Inc.
*
@@ -33,6 +34,9 @@
#ifndef _DRI2_H_
#define _DRI2_H_
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/dri2tokens.h>
+
typedef struct {
unsigned int attachment;
unsigned int name;
@@ -46,10 +50,10 @@ DRI2QueryExtension(Display *display, int *eventBase, int *errorBase);
extern Bool
DRI2QueryVersion(Display *display, int *major, int *minor);
extern Bool
-DRI2Connect(Display *display, int screen,
- char **driverName, char **busId, unsigned int *sareaHandle);
+DRI2Connect(Display *display, XID window,
+ char **driverName, char **deviceName);
extern Bool
-DRI2AuthConnection(Display *display, int screen, drm_magic_t magic);
+DRI2Authenticate(Display *display, XID window, drm_magic_t magic);
extern void
DRI2CreateDrawable(Display *display, XID drawable);
extern void
@@ -59,8 +63,9 @@ DRI2GetBuffers(Display *dpy, XID drawable,
int *width, int *height,
unsigned int *attachments, int count,
int *outCount);
+
extern void
-DRI2SwapBuffers(Display *dpy, XID drawable,
- int x, int y, int width, int height);
+DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
+ CARD32 dest, CARD32 src);
#endif
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index ed9054627f..bf76d1899b 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright © 2008 Red Hat, Inc.
*
@@ -38,8 +39,9 @@
#include "glxclient.h"
#include "glcontextmodes.h"
#include "xf86dri.h"
-#include "sarea.h"
#include <dlfcn.h>
+#include <fcntl.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include "xf86drm.h"
@@ -182,19 +184,35 @@ static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc,
return &pdraw->base;
}
+static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
+ int x, int y, int width, int height)
+{
+ XRectangle xrect;
+ XserverRegion region;
+
+ xrect.x = x;
+ xrect.y = y;
+ xrect.width = width;
+ xrect.height = height;
+
+ region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+ DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
+ DRI2BufferFrontLeft, DRI2BufferBackLeft);
+ XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
{
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
- DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable,
- 0, 0, priv->width, priv->height);
+ dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
}
static void dri2DestroyScreen(__GLXscreenConfigs *psc)
{
/* Free the direct rendering per screen data */
(*psc->core->destroyScreen)(psc->__driScreen);
- drmClose(psc->fd);
+ close(psc->fd);
psc->__driScreen = NULL;
}
@@ -248,8 +266,7 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
const __DRIconfig **driver_configs;
const __DRIextension **extensions;
__GLXDRIscreen *psp;
- unsigned int sareaHandle;
- char *driverName, *busID;
+ char *driverName, *deviceName;
drm_magic_t magic;
int i;
@@ -260,7 +277,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
/* Initialize per screen dynamic client GLX extensions */
psc->ext_list_first_time = GL_TRUE;
- if (!DRI2Connect(psc->dpy, screen, &driverName, &busID, &sareaHandle))
+ if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
+ &driverName, &deviceName))
return NULL;
psc->driver = driOpenDriver(driverName);
@@ -285,7 +303,7 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
goto handle_error;
}
- psc->fd = drmOpen(NULL, busID);
+ psc->fd = open(deviceName, O_RDWR);
if (psc->fd < 0) {
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
return NULL;
@@ -294,10 +312,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
if (drmGetMagic(psc->fd, &magic))
return NULL;
- if (!DRI2AuthConnection(psc->dpy, screen, magic)) {
- ErrorMessageF("failed to authenticate drm access\n");
+ if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic))
return NULL;
- }
psc->__driScreen =
psc->dri2->createNewScreen(screen, psc->fd,
@@ -316,15 +332,16 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
psp->createContext = dri2CreateContext;
psp->createDrawable = dri2CreateDrawable;
psp->swapBuffers = dri2SwapBuffers;
+ psp->copySubBuffer = dri2CopySubBuffer;
Xfree(driverName);
- Xfree(busID);
+ Xfree(deviceName);
return psp;
handle_error:
Xfree(driverName);
- Xfree(busID);
+ Xfree(deviceName);
/* FIXME: clean up here */
diff --git a/src/glx/x11/dri_common.c b/src/glx/x11/dri_common.c
index fbce6ac3e3..f6e16fa856 100644
--- a/src/glx/x11/dri_common.c
+++ b/src/glx/x11/dri_common.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright © 2008 Red Hat, Inc.
@@ -339,7 +340,7 @@ driBindExtensions(__GLXscreenConfigs *psc, int dri2)
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
- psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
+ psc->driCopySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit");
}
#endif
diff --git a/src/glx/x11/dri_common.h b/src/glx/x11/dri_common.h
index 15f6cc87b9..faa6adc10f 100644
--- a/src/glx/x11/dri_common.h
+++ b/src/glx/x11/dri_common.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright © 2008 Red Hat, Inc.
@@ -36,16 +37,17 @@
#ifndef _DRI_COMMON_H
#define _DRI_COMMON_H
-typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
+typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
-struct __GLXDRIconfigPrivateRec {
- __GLcontextModes modes;
- const __DRIconfig *driConfig;
+struct __GLXDRIconfigPrivateRec
+{
+ __GLcontextModes modes;
+ const __DRIconfig *driConfig;
};
-extern __GLcontextModes *
-driConvertConfigs(const __DRIcoreExtension *core,
- __GLcontextModes *modes, const __DRIconfig **configs);
+extern __GLcontextModes *driConvertConfigs(const __DRIcoreExtension * core,
+ __GLcontextModes * modes,
+ const __DRIconfig ** configs);
extern const __DRIsystemTimeExtension systemTimeExtension;
@@ -55,6 +57,6 @@ extern void ErrorMessageF(const char *f, ...);
extern void *driOpenDriver(const char *driverName);
-extern void driBindExtensions(__GLXscreenConfigs *psc, int dri2);
+extern void driBindExtensions(__GLXscreenConfigs * psc, int dri2);
#endif /* _DRI_COMMON_H */
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 47203f5008..7aa97b9ee9 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -574,6 +575,13 @@ static void driSwapBuffers(__GLXDRIdrawable *pdraw)
(*pdraw->psc->core->swapBuffers)(pdraw->driDrawable);
}
+static void driCopySubBuffer(__GLXDRIdrawable *pdraw,
+ int x, int y, int width, int height)
+{
+ (*pdraw->psc->driCopySubBuffer->copySubBuffer)(pdraw->driDrawable,
+ x, y, width, height);
+}
+
static void driDestroyScreen(__GLXscreenConfigs *psc)
{
/* Free the direct rendering per screen data */
@@ -641,6 +649,8 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
}
driBindExtensions(psc, 0);
+ if (psc->driCopySubBuffer)
+ psp->copySubBuffer = driCopySubBuffer;
psp->destroyScreen = driDestroyScreen;
psp->createContext = driCreateContext;
diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c
index 7bb4794f30..78ed32f497 100644
--- a/src/glx/x11/drisw_glx.c
+++ b/src/glx/x11/drisw_glx.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright 2008 George Sapountzis
*
@@ -33,395 +34,398 @@ typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
-struct __GLXDRIdisplayPrivateRec {
- __GLXDRIdisplay base;
+struct __GLXDRIdisplayPrivateRec
+{
+ __GLXDRIdisplay base;
};
-struct __GLXDRIcontextPrivateRec {
- __GLXDRIcontext base;
- __DRIcontext *driContext;
- __GLXscreenConfigs *psc;
+struct __GLXDRIcontextPrivateRec
+{
+ __GLXDRIcontext base;
+ __DRIcontext *driContext;
+ __GLXscreenConfigs *psc;
};
-struct __GLXDRIdrawablePrivateRec {
- __GLXDRIdrawable base;
+struct __GLXDRIdrawablePrivateRec
+{
+ __GLXDRIdrawable base;
- GC gc;
- GC swapgc;
+ GC gc;
+ GC swapgc;
- XVisualInfo *visinfo;
- XImage *ximage;
- int bpp;
+ XVisualInfo *visinfo;
+ XImage *ximage;
+ int bpp;
};
/**
* swrast loader functions
*/
-static Bool XCreateDrawable(__GLXDRIdrawablePrivate *pdp,
- Display *dpy, XID drawable, int visualid)
+static Bool
+XCreateDrawable(__GLXDRIdrawablePrivate * pdp,
+ Display * dpy, XID drawable, int visualid)
{
- XGCValues gcvalues;
- long visMask;
- XVisualInfo visTemp;
- int num_visuals;
-
- /* create GC's */
- pdp->gc = XCreateGC(dpy, drawable, 0, NULL);
- pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL);
-
- gcvalues.function = GXcopy;
- gcvalues.graphics_exposures = False;
- XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues);
- XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues);
- XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
-
- /* create XImage */
- visTemp.screen = DefaultScreen(dpy);
- visTemp.visualid = visualid;
- visMask = (VisualScreenMask | VisualIDMask);
- pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
-
- pdp->ximage = XCreateImage(dpy,
- pdp->visinfo->visual,
- pdp->visinfo->depth,
- ZPixmap, 0, /* format, offset */
- NULL, /* data */
- 0, 0, /* size */
- 32, /* bitmap_pad */
- 0); /* bytes_per_line */
-
- /* get the true number of bits per pixel */
- pdp->bpp = pdp->ximage->bits_per_pixel;
-
- return True;
+ XGCValues gcvalues;
+ long visMask;
+ XVisualInfo visTemp;
+ int num_visuals;
+
+ /* create GC's */
+ pdp->gc = XCreateGC(dpy, drawable, 0, NULL);
+ pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL);
+
+ gcvalues.function = GXcopy;
+ gcvalues.graphics_exposures = False;
+ XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues);
+ XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues);
+ XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
+
+ /* create XImage */
+ visTemp.screen = DefaultScreen(dpy);
+ visTemp.visualid = visualid;
+ visMask = (VisualScreenMask | VisualIDMask);
+ pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
+
+ pdp->ximage = XCreateImage(dpy, pdp->visinfo->visual, pdp->visinfo->depth, ZPixmap, 0, /* format, offset */
+ NULL, /* data */
+ 0, 0, /* size */
+ 32, /* bitmap_pad */
+ 0); /* bytes_per_line */
+
+ /* get the true number of bits per pixel */
+ pdp->bpp = pdp->ximage->bits_per_pixel;
+
+ return True;
}
-static void XDestroyDrawable(__GLXDRIdrawablePrivate *pdp,
- Display *dpy, XID drawable)
+static void
+XDestroyDrawable(__GLXDRIdrawablePrivate * pdp, Display * dpy, XID drawable)
{
- XDestroyImage(pdp->ximage);
- XFree(pdp->visinfo);
+ XDestroyImage(pdp->ximage);
+ XFree(pdp->visinfo);
- XFreeGC(dpy, pdp->gc);
- XFreeGC(dpy, pdp->swapgc);
+ XFreeGC(dpy, pdp->gc);
+ XFreeGC(dpy, pdp->swapgc);
}
static void
-swrastGetDrawableInfo(__DRIdrawable *draw,
- int *x, int *y, int *w, int *h,
- void *loaderPrivate)
+swrastGetDrawableInfo(__DRIdrawable * draw,
+ int *x, int *y, int *w, int *h, void *loaderPrivate)
{
- __GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);;
- Display *dpy = pdraw->psc->dpy;
- Drawable drawable;
+ __GLXDRIdrawablePrivate *pdp = loaderPrivate;
+ __GLXDRIdrawable *pdraw = &(pdp->base);;
+ Display *dpy = pdraw->psc->dpy;
+ Drawable drawable;
- Window root;
- Status stat;
- unsigned int bw, depth;
+ Window root;
+ Status stat;
+ unsigned int bw, depth;
- drawable = pdraw->xDrawable;
+ drawable = pdraw->xDrawable;
- stat = XGetGeometry(dpy, drawable, &root,
- x, y, (unsigned int *)w, (unsigned int *)h,
- &bw, &depth);
+ stat = XGetGeometry(dpy, drawable, &root,
+ x, y, (unsigned int *) w, (unsigned int *) h,
+ &bw, &depth);
}
static inline int
bytes_per_line(int w, int bpp, unsigned mul)
{
- unsigned mask = mul - 1;
+ unsigned mask = mul - 1;
- return ((w * bpp + mask) & ~mask) / 8;
+ return ((w * bpp + mask) & ~mask) / 8;
}
static void
-swrastPutImage(__DRIdrawable *draw, int op,
- int x, int y, int w, int h, char *data,
- void *loaderPrivate)
+swrastPutImage(__DRIdrawable * draw, int op,
+ int x, int y, int w, int h, char *data, void *loaderPrivate)
{
- __GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);;
- Display *dpy = pdraw->psc->dpy;
- Drawable drawable;
- XImage *ximage;
- GC gc;
-
- switch (op) {
- case __DRI_SWRAST_IMAGE_OP_DRAW:
- gc = pdp->gc;
- break;
- case __DRI_SWRAST_IMAGE_OP_SWAP:
- gc = pdp->swapgc;
- break;
- default:
- return;
- }
-
- drawable = pdraw->xDrawable;
-
- ximage = pdp->ximage;
- ximage->data = data;
- ximage->width = w;
- ximage->height = h;
- ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
-
- XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
-
- ximage->data = NULL;
+ __GLXDRIdrawablePrivate *pdp = loaderPrivate;
+ __GLXDRIdrawable *pdraw = &(pdp->base);;
+ Display *dpy = pdraw->psc->dpy;
+ Drawable drawable;
+ XImage *ximage;
+ GC gc;
+
+ switch (op) {
+ case __DRI_SWRAST_IMAGE_OP_DRAW:
+ gc = pdp->gc;
+ break;
+ case __DRI_SWRAST_IMAGE_OP_SWAP:
+ gc = pdp->swapgc;
+ break;
+ default:
+ return;
+ }
+
+ drawable = pdraw->xDrawable;
+
+ ximage = pdp->ximage;
+ ximage->data = data;
+ ximage->width = w;
+ ximage->height = h;
+ ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
+
+ XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
+
+ ximage->data = NULL;
}
static void
-swrastGetImage(__DRIdrawable *draw,
- int x, int y, int w, int h, char *data,
- void *loaderPrivate)
+swrastGetImage(__DRIdrawable * draw,
+ int x, int y, int w, int h, char *data, void *loaderPrivate)
{
- __GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);;
- Display *dpy = pdraw->psc->dpy;
- Drawable drawable;
- XImage *ximage;
+ __GLXDRIdrawablePrivate *pdp = loaderPrivate;
+ __GLXDRIdrawable *pdraw = &(pdp->base);;
+ Display *dpy = pdraw->psc->dpy;
+ Drawable drawable;
+ XImage *ximage;
- drawable = pdraw->xDrawable;
+ drawable = pdraw->xDrawable;
- ximage = pdp->ximage;
- ximage->data = data;
- ximage->width = w;
- ximage->height = h;
- ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
+ ximage = pdp->ximage;
+ ximage->data = data;
+ ximage->width = w;
+ ximage->height = h;
+ ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
- XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
+ XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
- ximage->data = NULL;
+ ximage->data = NULL;
}
static const __DRIswrastLoaderExtension swrastLoaderExtension = {
- { __DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION },
- swrastGetDrawableInfo,
- swrastPutImage,
- swrastGetImage
+ {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
+ swrastGetDrawableInfo,
+ swrastPutImage,
+ swrastGetImage
};
static const __DRIextension *loader_extensions[] = {
- &systemTimeExtension.base,
- &swrastLoaderExtension.base,
- NULL
+ &systemTimeExtension.base,
+ &swrastLoaderExtension.base,
+ NULL
};
/**
* GLXDRI functions
*/
-static void driDestroyContext(__GLXDRIcontext *context,
- __GLXscreenConfigs *psc, Display *dpy)
+static void
+driDestroyContext(__GLXDRIcontext * context,
+ __GLXscreenConfigs * psc, Display * dpy)
{
- __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
- const __DRIcoreExtension *core = pcp->psc->core;
+ __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+ const __DRIcoreExtension *core = pcp->psc->core;
- (*core->destroyContext)(pcp->driContext);
+ (*core->destroyContext) (pcp->driContext);
- Xfree(pcp);
+ Xfree(pcp);
}
-static Bool driBindContext(__GLXDRIcontext *context,
- __GLXDRIdrawable *draw, __GLXDRIdrawable *read)
+static Bool
+driBindContext(__GLXDRIcontext * context,
+ __GLXDRIdrawable * draw, __GLXDRIdrawable * read)
{
- __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
- const __DRIcoreExtension *core = pcp->psc->core;
+ __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+ const __DRIcoreExtension *core = pcp->psc->core;
- return (*core->bindContext)(pcp->driContext,
- draw->driDrawable,
- read->driDrawable);
+ return (*core->bindContext) (pcp->driContext,
+ draw->driDrawable, read->driDrawable);
}
-static void driUnbindContext(__GLXDRIcontext *context)
+static void
+driUnbindContext(__GLXDRIcontext * context)
{
- __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
- const __DRIcoreExtension *core = pcp->psc->core;
+ __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
+ const __DRIcoreExtension *core = pcp->psc->core;
- (*core->unbindContext)(pcp->driContext);
+ (*core->unbindContext) (pcp->driContext);
}
-static __GLXDRIcontext *driCreateContext(__GLXscreenConfigs *psc,
- const __GLcontextModes *mode,
- GLXContext gc,
- GLXContext shareList, int renderType)
+static __GLXDRIcontext *
+driCreateContext(__GLXscreenConfigs * psc,
+ const __GLcontextModes * mode,
+ GLXContext gc, GLXContext shareList, int renderType)
{
- __GLXDRIcontextPrivate *pcp, *pcp_shared;
- __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
- const __DRIcoreExtension *core = psc->core;
- __DRIcontext *shared = NULL;
-
- if (!psc || !psc->driScreen)
- return NULL;
-
- if (shareList) {
- pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
- shared = pcp_shared->driContext;
- }
-
- pcp = Xmalloc(sizeof *pcp);
- if (pcp == NULL)
- return NULL;
-
- pcp->psc = psc;
- pcp->driContext =
- (*core->createNewContext)(psc->__driScreen,
- config->driConfig, shared, pcp);
- if (pcp->driContext == NULL) {
- Xfree(pcp);
- return NULL;
- }
-
- pcp->base.destroyContext = driDestroyContext;
- pcp->base.bindContext = driBindContext;
- pcp->base.unbindContext = driUnbindContext;
-
- return &pcp->base;
+ __GLXDRIcontextPrivate *pcp, *pcp_shared;
+ __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
+ const __DRIcoreExtension *core = psc->core;
+ __DRIcontext *shared = NULL;
+
+ if (!psc || !psc->driScreen)
+ return NULL;
+
+ if (shareList) {
+ pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
+ shared = pcp_shared->driContext;
+ }
+
+ pcp = Xmalloc(sizeof *pcp);
+ if (pcp == NULL)
+ return NULL;
+
+ pcp->psc = psc;
+ pcp->driContext =
+ (*core->createNewContext) (psc->__driScreen,
+ config->driConfig, shared, pcp);
+ if (pcp->driContext == NULL) {
+ Xfree(pcp);
+ return NULL;
+ }
+
+ pcp->base.destroyContext = driDestroyContext;
+ pcp->base.bindContext = driBindContext;
+ pcp->base.unbindContext = driUnbindContext;
+
+ return &pcp->base;
}
-static void driDestroyDrawable(__GLXDRIdrawable *pdraw)
+static void
+driDestroyDrawable(__GLXDRIdrawable * pdraw)
{
- __GLXDRIdrawablePrivate *pdp = (__GLXDRIdrawablePrivate *) pdraw;
- const __DRIcoreExtension *core = pdraw->psc->core;
+ __GLXDRIdrawablePrivate *pdp = (__GLXDRIdrawablePrivate *) pdraw;
+ const __DRIcoreExtension *core = pdraw->psc->core;
- (*core->destroyDrawable)(pdraw->driDrawable);
+ (*core->destroyDrawable) (pdraw->driDrawable);
- XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
- Xfree(pdp);
+ XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
+ Xfree(pdp);
}
-static __GLXDRIdrawable *driCreateDrawable(__GLXscreenConfigs *psc,
- XID xDrawable,
- GLXDrawable drawable,
- const __GLcontextModes *modes)
+static __GLXDRIdrawable *
+driCreateDrawable(__GLXscreenConfigs * psc,
+ XID xDrawable,
+ GLXDrawable drawable, const __GLcontextModes * modes)
{
- __GLXDRIdrawable *pdraw;
- __GLXDRIdrawablePrivate *pdp;
- __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
- const __DRIswrastExtension *swrast = psc->swrast;
+ __GLXDRIdrawable *pdraw;
+ __GLXDRIdrawablePrivate *pdp;
+ __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
+ const __DRIswrastExtension *swrast = psc->swrast;
- /* Old dri can't handle GLX 1.3+ drawable constructors. */
- if (xDrawable != drawable)
- return NULL;
+ /* Old dri can't handle GLX 1.3+ drawable constructors. */
+ if (xDrawable != drawable)
+ return NULL;
- pdp = Xmalloc(sizeof(*pdp));
- if (!pdp)
- return NULL;
+ pdp = Xmalloc(sizeof(*pdp));
+ if (!pdp)
+ return NULL;
- pdraw = &(pdp->base);
- pdraw->xDrawable = xDrawable;
- pdraw->drawable = drawable;
- pdraw->psc = psc;
+ pdraw = &(pdp->base);
+ pdraw->xDrawable = xDrawable;
+ pdraw->drawable = drawable;
+ pdraw->psc = psc;
- XCreateDrawable(pdp, psc->dpy, xDrawable, modes->visualID);
+ XCreateDrawable(pdp, psc->dpy, xDrawable, modes->visualID);
- /* Create a new drawable */
- pdraw->driDrawable =
- (*swrast->createNewDrawable)(psc->__driScreen,
- config->driConfig,
- pdp);
+ /* Create a new drawable */
+ pdraw->driDrawable =
+ (*swrast->createNewDrawable) (psc->__driScreen, config->driConfig, pdp);
- if (!pdraw->driDrawable) {
- XDestroyDrawable(pdp, psc->dpy, xDrawable);
- Xfree(pdp);
- return NULL;
- }
+ if (!pdraw->driDrawable) {
+ XDestroyDrawable(pdp, psc->dpy, xDrawable);
+ Xfree(pdp);
+ return NULL;
+ }
- pdraw->destroyDrawable = driDestroyDrawable;
+ pdraw->destroyDrawable = driDestroyDrawable;
- return pdraw;
+ return pdraw;
}
-static void driSwapBuffers(__GLXDRIdrawable *pdraw)
+static void
+driSwapBuffers(__GLXDRIdrawable * pdraw)
{
- (*pdraw->psc->core->swapBuffers)(pdraw->driDrawable);
+ (*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
}
-static void driDestroyScreen(__GLXscreenConfigs *psc)
+static void
+driDestroyScreen(__GLXscreenConfigs * psc)
{
- /* Free the direct rendering per screen data */
- (*psc->core->destroyScreen)(psc->__driScreen);
- psc->__driScreen = NULL;
- if (psc->driver)
- dlclose(psc->driver);
+ /* Free the direct rendering per screen data */
+ (*psc->core->destroyScreen) (psc->__driScreen);
+ psc->__driScreen = NULL;
+ if (psc->driver)
+ dlclose(psc->driver);
}
-static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
- __GLXdisplayPrivate *priv)
+static __GLXDRIscreen *
+driCreateScreen(__GLXscreenConfigs * psc, int screen,
+ __GLXdisplayPrivate * priv)
{
- __GLXDRIscreen *psp;
- const __DRIconfig **driver_configs;
- const __DRIextension **extensions;
- const char *driverName = "swrast";
- int i;
-
- psp = Xmalloc(sizeof *psp);
- if (psp == NULL)
- return NULL;
-
- /* Initialize per screen dynamic client GLX extensions */
- psc->ext_list_first_time = GL_TRUE;
-
- psc->driver = driOpenDriver(driverName);
- if (psc->driver == NULL)
- goto handle_error;
-
- extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
- if (extensions == NULL) {
- ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
- goto handle_error;
- }
-
- for (i = 0; extensions[i]; i++) {
- if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
- psc->core = (__DRIcoreExtension *) extensions[i];
- if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
- psc->swrast = (__DRIswrastExtension *) extensions[i];
- }
-
- if (psc->core == NULL || psc->swrast == NULL) {
- ErrorMessageF("core dri extension not found\n");
- goto handle_error;
- }
-
- psc->__driScreen =
- psc->swrast->createNewScreen(screen,
- loader_extensions, &driver_configs, psc);
- if (psc->__driScreen == NULL) {
- ErrorMessageF("failed to create dri screen\n");
- goto handle_error;
- }
-
- driBindExtensions(psc, 0);
-
- psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
- psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
-
- psp->destroyScreen = driDestroyScreen;
- psp->createContext = driCreateContext;
- psp->createDrawable = driCreateDrawable;
- psp->swapBuffers = driSwapBuffers;
-
- return psp;
+ __GLXDRIscreen *psp;
+ const __DRIconfig **driver_configs;
+ const __DRIextension **extensions;
+ const char *driverName = "swrast";
+ int i;
+
+ psp = Xmalloc(sizeof *psp);
+ if (psp == NULL)
+ return NULL;
+
+ /* Initialize per screen dynamic client GLX extensions */
+ psc->ext_list_first_time = GL_TRUE;
+
+ psc->driver = driOpenDriver(driverName);
+ if (psc->driver == NULL)
+ goto handle_error;
+
+ extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
+ if (extensions == NULL) {
+ ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
+ goto handle_error;
+ }
+
+ for (i = 0; extensions[i]; i++) {
+ if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
+ psc->core = (__DRIcoreExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
+ psc->swrast = (__DRIswrastExtension *) extensions[i];
+ }
+
+ if (psc->core == NULL || psc->swrast == NULL) {
+ ErrorMessageF("core dri extension not found\n");
+ goto handle_error;
+ }
+
+ psc->__driScreen =
+ psc->swrast->createNewScreen(screen,
+ loader_extensions, &driver_configs, psc);
+ if (psc->__driScreen == NULL) {
+ ErrorMessageF("failed to create dri screen\n");
+ goto handle_error;
+ }
+
+ driBindExtensions(psc, 0);
+
+ psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
+ psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
+
+ psp->destroyScreen = driDestroyScreen;
+ psp->createContext = driCreateContext;
+ psp->createDrawable = driCreateDrawable;
+ psp->swapBuffers = driSwapBuffers;
+
+ return psp;
handle_error:
- Xfree(psp);
+ Xfree(psp);
- if (psc->driver)
- dlclose(psc->driver);
+ if (psc->driver)
+ dlclose(psc->driver);
- ErrorMessageF("reverting to indirect rendering\n");
+ ErrorMessageF("reverting to indirect rendering\n");
- return NULL;
+ return NULL;
}
/* Called from __glXFreeDisplayPrivate.
*/
-static void driDestroyDisplay(__GLXDRIdisplay *dpy)
+static void
+driDestroyDisplay(__GLXDRIdisplay * dpy)
{
- Xfree(dpy);
+ Xfree(dpy);
}
/*
@@ -429,18 +433,19 @@ static void driDestroyDisplay(__GLXDRIdisplay *dpy)
* This is called from __glXInitialize() when we are given a new
* display pointer.
*/
-_X_HIDDEN __GLXDRIdisplay *driswCreateDisplay(Display *dpy)
+_X_HIDDEN __GLXDRIdisplay *
+driswCreateDisplay(Display * dpy)
{
- __GLXDRIdisplayPrivate *pdpyp;
+ __GLXDRIdisplayPrivate *pdpyp;
- pdpyp = Xmalloc(sizeof *pdpyp);
- if (pdpyp == NULL)
- return NULL;
+ pdpyp = Xmalloc(sizeof *pdpyp);
+ if (pdpyp == NULL)
+ return NULL;
- pdpyp->base.destroyDisplay = driDestroyDisplay;
- pdpyp->base.createScreen = driCreateScreen;
+ pdpyp->base.destroyDisplay = driDestroyDisplay;
+ pdpyp->base.createScreen = driCreateScreen;
- return &pdpyp->base;
+ return &pdpyp->base;
}
#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/x11/eval.c b/src/glx/x11/eval.c
index 58075e2231..418093565c 100644
--- a/src/glx/x11/eval.c
+++ b/src/glx/x11/eval.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -36,91 +37,97 @@
** the information that the GL needs.
*/
-void __glFillMap1f(GLint k, GLint order, GLint stride,
- const GLfloat *points, GLubyte *pc)
+void
+__glFillMap1f(GLint k, GLint order, GLint stride,
+ const GLfloat * points, GLubyte * pc)
{
- if (stride == k) {
- /* Just copy the data */
- __GLX_PUT_FLOAT_ARRAY(0, points, order * k);
- } else {
- GLint i;
+ if (stride == k) {
+ /* Just copy the data */
+ __GLX_PUT_FLOAT_ARRAY(0, points, order * k);
+ }
+ else {
+ GLint i;
- for (i = 0; i < order; i++) {
- __GLX_PUT_FLOAT_ARRAY(0, points, k);
- points += stride;
- pc += k * __GLX_SIZE_FLOAT32;
- }
- }
+ for (i = 0; i < order; i++) {
+ __GLX_PUT_FLOAT_ARRAY(0, points, k);
+ points += stride;
+ pc += k * __GLX_SIZE_FLOAT32;
+ }
+ }
}
-void __glFillMap1d(GLint k, GLint order, GLint stride,
- const GLdouble *points, GLubyte *pc)
+void
+__glFillMap1d(GLint k, GLint order, GLint stride,
+ const GLdouble * points, GLubyte * pc)
{
- if (stride == k) {
- /* Just copy the data */
- __GLX_PUT_DOUBLE_ARRAY(0, points, order * k);
- } else {
- GLint i;
- for (i = 0; i < order; i++) {
- __GLX_PUT_DOUBLE_ARRAY(0, points, k);
- points += stride;
- pc += k * __GLX_SIZE_FLOAT64;
- }
- }
+ if (stride == k) {
+ /* Just copy the data */
+ __GLX_PUT_DOUBLE_ARRAY(0, points, order * k);
+ }
+ else {
+ GLint i;
+ for (i = 0; i < order; i++) {
+ __GLX_PUT_DOUBLE_ARRAY(0, points, k);
+ points += stride;
+ pc += k * __GLX_SIZE_FLOAT64;
+ }
+ }
}
-void __glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,
- GLint majorStride, GLint minorStride,
- const GLfloat *points, GLfloat *data)
+void
+__glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,
+ GLint majorStride, GLint minorStride,
+ const GLfloat * points, GLfloat * data)
{
- GLint i, j, x;
+ GLint i, j, x;
- if ((minorStride == k) && (majorStride == minorOrder*k)) {
- /* Just copy the data */
- __GLX_MEM_COPY(data, points, majorOrder * majorStride *
- __GLX_SIZE_FLOAT32);
- return;
- }
- for (i = 0; i < majorOrder; i++) {
- for (j = 0; j < minorOrder; j++) {
- for (x = 0; x < k; x++) {
- data[x] = points[x];
- }
- points += minorStride;
- data += k;
- }
- points += majorStride - minorStride * minorOrder;
- }
+ if ((minorStride == k) && (majorStride == minorOrder * k)) {
+ /* Just copy the data */
+ __GLX_MEM_COPY(data, points, majorOrder * majorStride *
+ __GLX_SIZE_FLOAT32);
+ return;
+ }
+ for (i = 0; i < majorOrder; i++) {
+ for (j = 0; j < minorOrder; j++) {
+ for (x = 0; x < k; x++) {
+ data[x] = points[x];
+ }
+ points += minorStride;
+ data += k;
+ }
+ points += majorStride - minorStride * minorOrder;
+ }
}
-void __glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,
- GLint majorStride, GLint minorStride,
- const GLdouble *points, GLdouble *data)
+void
+__glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,
+ GLint majorStride, GLint minorStride,
+ const GLdouble * points, GLdouble * data)
{
- int i,j,x;
+ int i, j, x;
- if ((minorStride == k) && (majorStride == minorOrder*k)) {
- /* Just copy the data */
- __GLX_MEM_COPY(data, points, majorOrder * majorStride *
- __GLX_SIZE_FLOAT64);
- return;
- }
+ if ((minorStride == k) && (majorStride == minorOrder * k)) {
+ /* Just copy the data */
+ __GLX_MEM_COPY(data, points, majorOrder * majorStride *
+ __GLX_SIZE_FLOAT64);
+ return;
+ }
#ifdef __GLX_ALIGN64
- x = k * __GLX_SIZE_FLOAT64;
+ x = k * __GLX_SIZE_FLOAT64;
#endif
- for (i = 0; i<majorOrder; i++) {
- for (j = 0; j<minorOrder; j++) {
+ for (i = 0; i < majorOrder; i++) {
+ for (j = 0; j < minorOrder; j++) {
#ifdef __GLX_ALIGN64
- __GLX_MEM_COPY(data, points, x);
+ __GLX_MEM_COPY(data, points, x);
#else
- for (x = 0; x<k; x++) {
- data[x] = points[x];
- }
+ for (x = 0; x < k; x++) {
+ data[x] = points[x];
+ }
#endif
- points += minorStride;
- data += k;
- }
- points += majorStride - minorStride * minorOrder;
- }
+ points += minorStride;
+ data += k;
+ }
+ points += majorStride - minorStride * minorOrder;
+ }
}
diff --git a/src/glx/x11/glcontextmodes.c b/src/glx/x11/glcontextmodes.c
index 326c8b2357..d179b7e520 100644
--- a/src/glx/x11/glcontextmodes.c
+++ b/src/glx/x11/glcontextmodes.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2003
* All Rights Reserved.
@@ -78,16 +79,16 @@
* be returned. Otherwise \c GLX_NONE will be returned.
*/
GLint
-_gl_convert_from_x_visual_type( int visualType )
+_gl_convert_from_x_visual_type(int visualType)
{
- static const int glx_visual_types[ NUM_VISUAL_TYPES ] = {
- GLX_STATIC_GRAY, GLX_GRAY_SCALE,
- GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
- GLX_TRUE_COLOR, GLX_DIRECT_COLOR
- };
-
- return ( (unsigned) visualType < NUM_VISUAL_TYPES )
- ? glx_visual_types[ visualType ] : GLX_NONE;
+ static const int glx_visual_types[NUM_VISUAL_TYPES] = {
+ GLX_STATIC_GRAY, GLX_GRAY_SCALE,
+ GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
+ GLX_TRUE_COLOR, GLX_DIRECT_COLOR
+ };
+
+ return ((unsigned) visualType < NUM_VISUAL_TYPES)
+ ? glx_visual_types[visualType] : GLX_NONE;
}
@@ -100,16 +101,16 @@ _gl_convert_from_x_visual_type( int visualType )
* be returned. Otherwise -1 will be returned.
*/
GLint
-_gl_convert_to_x_visual_type( int visualType )
+_gl_convert_to_x_visual_type(int visualType)
{
- static const int x_visual_types[ NUM_VISUAL_TYPES ] = {
- TrueColor, DirectColor,
- PseudoColor, StaticColor,
- GrayScale, StaticGray
- };
-
- return ( (unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES )
- ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
+ static const int x_visual_types[NUM_VISUAL_TYPES] = {
+ TrueColor, DirectColor,
+ PseudoColor, StaticColor,
+ GrayScale, StaticGray
+ };
+
+ return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES)
+ ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1;
}
@@ -128,76 +129,76 @@ _gl_convert_to_x_visual_type( int visualType )
* structure will be set to the \c vid of the \c __GLXvisualConfig structure.
*/
void
-_gl_copy_visual_to_context_mode( __GLcontextModes * mode,
- const __GLXvisualConfig * config )
+_gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+ const __GLXvisualConfig * config)
{
- __GLcontextModes * const next = mode->next;
-
- (void) _mesa_memset( mode, 0, sizeof( __GLcontextModes ) );
- mode->next = next;
-
- mode->visualID = config->vid;
- mode->visualType = _gl_convert_from_x_visual_type( config->class );
- mode->xRenderable = GL_TRUE;
- mode->fbconfigID = config->vid;
- mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
-
- mode->rgbMode = (config->rgba != 0);
- mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- mode->colorIndexMode = !(mode->rgbMode);
- mode->doubleBufferMode = (config->doubleBuffer != 0);
- mode->stereoMode = (config->stereo != 0);
-
- mode->haveAccumBuffer = ((config->accumRedSize +
- config->accumGreenSize +
- config->accumBlueSize +
- config->accumAlphaSize) > 0);
- mode->haveDepthBuffer = (config->depthSize > 0);
- mode->haveStencilBuffer = (config->stencilSize > 0);
-
- mode->redBits = config->redSize;
- mode->greenBits = config->greenSize;
- mode->blueBits = config->blueSize;
- mode->alphaBits = config->alphaSize;
- mode->redMask = config->redMask;
- mode->greenMask = config->greenMask;
- mode->blueMask = config->blueMask;
- mode->alphaMask = config->alphaMask;
- mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
- mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
-
- mode->accumRedBits = config->accumRedSize;
- mode->accumGreenBits = config->accumGreenSize;
- mode->accumBlueBits = config->accumBlueSize;
- mode->accumAlphaBits = config->accumAlphaSize;
- mode->depthBits = config->depthSize;
- mode->stencilBits = config->stencilSize;
-
- mode->numAuxBuffers = config->auxBuffers;
- mode->level = config->level;
-
- mode->visualRating = config->visualRating;
- mode->transparentPixel = config->transparentPixel;
- mode->transparentRed = config->transparentRed;
- mode->transparentGreen = config->transparentGreen;
- mode->transparentBlue = config->transparentBlue;
- mode->transparentAlpha = config->transparentAlpha;
- mode->transparentIndex = config->transparentIndex;
- mode->samples = config->multiSampleSize;
- mode->sampleBuffers = config->nMultiSampleBuffers;
- /* mode->visualSelectGroup = config->visualSelectGroup; ? */
-
- mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
- mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
- GL_TRUE : GL_FALSE;
- mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
- mode->bindToTextureTargets = mode->rgbMode ?
- GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
- GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
- mode->yInverted = GL_FALSE;
+ __GLcontextModes *const next = mode->next;
+
+ (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes));
+ mode->next = next;
+
+ mode->visualID = config->vid;
+ mode->visualType = _gl_convert_from_x_visual_type(config->class);
+ mode->xRenderable = GL_TRUE;
+ mode->fbconfigID = config->vid;
+ mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+
+ mode->rgbMode = (config->rgba != 0);
+ mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+
+ mode->colorIndexMode = !(mode->rgbMode);
+ mode->doubleBufferMode = (config->doubleBuffer != 0);
+ mode->stereoMode = (config->stereo != 0);
+
+ mode->haveAccumBuffer = ((config->accumRedSize +
+ config->accumGreenSize +
+ config->accumBlueSize +
+ config->accumAlphaSize) > 0);
+ mode->haveDepthBuffer = (config->depthSize > 0);
+ mode->haveStencilBuffer = (config->stencilSize > 0);
+
+ mode->redBits = config->redSize;
+ mode->greenBits = config->greenSize;
+ mode->blueBits = config->blueSize;
+ mode->alphaBits = config->alphaSize;
+ mode->redMask = config->redMask;
+ mode->greenMask = config->greenMask;
+ mode->blueMask = config->blueMask;
+ mode->alphaMask = config->alphaMask;
+ mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
+ mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
+
+ mode->accumRedBits = config->accumRedSize;
+ mode->accumGreenBits = config->accumGreenSize;
+ mode->accumBlueBits = config->accumBlueSize;
+ mode->accumAlphaBits = config->accumAlphaSize;
+ mode->depthBits = config->depthSize;
+ mode->stencilBits = config->stencilSize;
+
+ mode->numAuxBuffers = config->auxBuffers;
+ mode->level = config->level;
+
+ mode->visualRating = config->visualRating;
+ mode->transparentPixel = config->transparentPixel;
+ mode->transparentRed = config->transparentRed;
+ mode->transparentGreen = config->transparentGreen;
+ mode->transparentBlue = config->transparentBlue;
+ mode->transparentAlpha = config->transparentAlpha;
+ mode->transparentIndex = config->transparentIndex;
+ mode->samples = config->multiSampleSize;
+ mode->sampleBuffers = config->nMultiSampleBuffers;
+ /* mode->visualSelectGroup = config->visualSelectGroup; ? */
+
+ mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
+
+ mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
+ mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
+ GL_TRUE : GL_FALSE;
+ mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
+ mode->bindToTextureTargets = mode->rgbMode ?
+ GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
+ GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
+ mode->yInverted = GL_FALSE;
}
@@ -211,149 +212,149 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
* returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned.
*/
int
-_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
- int *value_return)
+_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
+ int *value_return)
{
- switch (attribute) {
- case GLX_USE_GL:
- *value_return = GL_TRUE;
- return 0;
- case GLX_BUFFER_SIZE:
- *value_return = mode->rgbBits;
- return 0;
- case GLX_RGBA:
- *value_return = mode->rgbMode;
- return 0;
- case GLX_RED_SIZE:
- *value_return = mode->redBits;
- return 0;
- case GLX_GREEN_SIZE:
- *value_return = mode->greenBits;
- return 0;
- case GLX_BLUE_SIZE:
- *value_return = mode->blueBits;
- return 0;
- case GLX_ALPHA_SIZE:
- *value_return = mode->alphaBits;
- return 0;
- case GLX_DOUBLEBUFFER:
- *value_return = mode->doubleBufferMode;
- return 0;
- case GLX_STEREO:
- *value_return = mode->stereoMode;
- return 0;
- case GLX_AUX_BUFFERS:
- *value_return = mode->numAuxBuffers;
- return 0;
- case GLX_DEPTH_SIZE:
- *value_return = mode->depthBits;
- return 0;
- case GLX_STENCIL_SIZE:
- *value_return = mode->stencilBits;
- return 0;
- case GLX_ACCUM_RED_SIZE:
- *value_return = mode->accumRedBits;
- return 0;
- case GLX_ACCUM_GREEN_SIZE:
- *value_return = mode->accumGreenBits;
- return 0;
- case GLX_ACCUM_BLUE_SIZE:
- *value_return = mode->accumBlueBits;
- return 0;
- case GLX_ACCUM_ALPHA_SIZE:
- *value_return = mode->accumAlphaBits;
- return 0;
- case GLX_LEVEL:
- *value_return = mode->level;
- return 0;
- case GLX_TRANSPARENT_TYPE_EXT:
- *value_return = mode->transparentPixel;
- return 0;
- case GLX_TRANSPARENT_RED_VALUE:
- *value_return = mode->transparentRed;
- return 0;
- case GLX_TRANSPARENT_GREEN_VALUE:
- *value_return = mode->transparentGreen;
- return 0;
- case GLX_TRANSPARENT_BLUE_VALUE:
- *value_return = mode->transparentBlue;
- return 0;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- *value_return = mode->transparentAlpha;
- return 0;
- case GLX_TRANSPARENT_INDEX_VALUE:
- *value_return = mode->transparentIndex;
- return 0;
- case GLX_X_VISUAL_TYPE:
- *value_return = mode->visualType;
- return 0;
- case GLX_CONFIG_CAVEAT:
- *value_return = mode->visualRating;
- return 0;
- case GLX_VISUAL_ID:
- *value_return = mode->visualID;
- return 0;
- case GLX_DRAWABLE_TYPE:
- *value_return = mode->drawableType;
- return 0;
- case GLX_RENDER_TYPE:
- *value_return = mode->renderType;
- return 0;
- case GLX_X_RENDERABLE:
- *value_return = mode->xRenderable;
- return 0;
- case GLX_FBCONFIG_ID:
- *value_return = mode->fbconfigID;
- return 0;
- case GLX_MAX_PBUFFER_WIDTH:
- *value_return = mode->maxPbufferWidth;
- return 0;
- case GLX_MAX_PBUFFER_HEIGHT:
- *value_return = mode->maxPbufferHeight;
- return 0;
- case GLX_MAX_PBUFFER_PIXELS:
- *value_return = mode->maxPbufferPixels;
- return 0;
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- *value_return = mode->optimalPbufferWidth;
- return 0;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- *value_return = mode->optimalPbufferHeight;
- return 0;
- case GLX_SWAP_METHOD_OML:
- *value_return = mode->swapMethod;
- return 0;
- case GLX_SAMPLE_BUFFERS_SGIS:
- *value_return = mode->sampleBuffers;
- return 0;
- case GLX_SAMPLES_SGIS:
- *value_return = mode->samples;
- return 0;
- case GLX_BIND_TO_TEXTURE_RGB_EXT:
- *value_return = mode->bindToTextureRgb;
- return 0;
- case GLX_BIND_TO_TEXTURE_RGBA_EXT:
- *value_return = mode->bindToTextureRgba;
- return 0;
- case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
- *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
- GL_FALSE;
- return 0;
- case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
- *value_return = mode->bindToTextureTargets;
- return 0;
- case GLX_Y_INVERTED_EXT:
- *value_return = mode->yInverted;
- return 0;
+ switch (attribute) {
+ case GLX_USE_GL:
+ *value_return = GL_TRUE;
+ return 0;
+ case GLX_BUFFER_SIZE:
+ *value_return = mode->rgbBits;
+ return 0;
+ case GLX_RGBA:
+ *value_return = mode->rgbMode;
+ return 0;
+ case GLX_RED_SIZE:
+ *value_return = mode->redBits;
+ return 0;
+ case GLX_GREEN_SIZE:
+ *value_return = mode->greenBits;
+ return 0;
+ case GLX_BLUE_SIZE:
+ *value_return = mode->blueBits;
+ return 0;
+ case GLX_ALPHA_SIZE:
+ *value_return = mode->alphaBits;
+ return 0;
+ case GLX_DOUBLEBUFFER:
+ *value_return = mode->doubleBufferMode;
+ return 0;
+ case GLX_STEREO:
+ *value_return = mode->stereoMode;
+ return 0;
+ case GLX_AUX_BUFFERS:
+ *value_return = mode->numAuxBuffers;
+ return 0;
+ case GLX_DEPTH_SIZE:
+ *value_return = mode->depthBits;
+ return 0;
+ case GLX_STENCIL_SIZE:
+ *value_return = mode->stencilBits;
+ return 0;
+ case GLX_ACCUM_RED_SIZE:
+ *value_return = mode->accumRedBits;
+ return 0;
+ case GLX_ACCUM_GREEN_SIZE:
+ *value_return = mode->accumGreenBits;
+ return 0;
+ case GLX_ACCUM_BLUE_SIZE:
+ *value_return = mode->accumBlueBits;
+ return 0;
+ case GLX_ACCUM_ALPHA_SIZE:
+ *value_return = mode->accumAlphaBits;
+ return 0;
+ case GLX_LEVEL:
+ *value_return = mode->level;
+ return 0;
+ case GLX_TRANSPARENT_TYPE_EXT:
+ *value_return = mode->transparentPixel;
+ return 0;
+ case GLX_TRANSPARENT_RED_VALUE:
+ *value_return = mode->transparentRed;
+ return 0;
+ case GLX_TRANSPARENT_GREEN_VALUE:
+ *value_return = mode->transparentGreen;
+ return 0;
+ case GLX_TRANSPARENT_BLUE_VALUE:
+ *value_return = mode->transparentBlue;
+ return 0;
+ case GLX_TRANSPARENT_ALPHA_VALUE:
+ *value_return = mode->transparentAlpha;
+ return 0;
+ case GLX_TRANSPARENT_INDEX_VALUE:
+ *value_return = mode->transparentIndex;
+ return 0;
+ case GLX_X_VISUAL_TYPE:
+ *value_return = mode->visualType;
+ return 0;
+ case GLX_CONFIG_CAVEAT:
+ *value_return = mode->visualRating;
+ return 0;
+ case GLX_VISUAL_ID:
+ *value_return = mode->visualID;
+ return 0;
+ case GLX_DRAWABLE_TYPE:
+ *value_return = mode->drawableType;
+ return 0;
+ case GLX_RENDER_TYPE:
+ *value_return = mode->renderType;
+ return 0;
+ case GLX_X_RENDERABLE:
+ *value_return = mode->xRenderable;
+ return 0;
+ case GLX_FBCONFIG_ID:
+ *value_return = mode->fbconfigID;
+ return 0;
+ case GLX_MAX_PBUFFER_WIDTH:
+ *value_return = mode->maxPbufferWidth;
+ return 0;
+ case GLX_MAX_PBUFFER_HEIGHT:
+ *value_return = mode->maxPbufferHeight;
+ return 0;
+ case GLX_MAX_PBUFFER_PIXELS:
+ *value_return = mode->maxPbufferPixels;
+ return 0;
+ case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+ *value_return = mode->optimalPbufferWidth;
+ return 0;
+ case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+ *value_return = mode->optimalPbufferHeight;
+ return 0;
+ case GLX_SWAP_METHOD_OML:
+ *value_return = mode->swapMethod;
+ return 0;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ *value_return = mode->sampleBuffers;
+ return 0;
+ case GLX_SAMPLES_SGIS:
+ *value_return = mode->samples;
+ return 0;
+ case GLX_BIND_TO_TEXTURE_RGB_EXT:
+ *value_return = mode->bindToTextureRgb;
+ return 0;
+ case GLX_BIND_TO_TEXTURE_RGBA_EXT:
+ *value_return = mode->bindToTextureRgba;
+ return 0;
+ case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
+ *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
+ GL_FALSE;
+ return 0;
+ case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
+ *value_return = mode->bindToTextureTargets;
+ return 0;
+ case GLX_Y_INVERTED_EXT:
+ *value_return = mode->yInverted;
+ return 0;
/* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
* It is ONLY for communication between the GLX client and the GLX
* server.
*/
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- default:
- return GLX_BAD_ATTRIBUTE;
- }
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ default:
+ return GLX_BAD_ATTRIBUTE;
+ }
}
#endif /* !defined(IN_MINI_GLX) */
@@ -385,24 +386,24 @@ _gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
* extend the \c __GLcontextModes data-structure.
*/
__GLcontextModes *
-_gl_context_modes_create( unsigned count, size_t minimum_size )
+_gl_context_modes_create(unsigned count, size_t minimum_size)
{
- const size_t size = (minimum_size > sizeof( __GLcontextModes ))
- ? minimum_size : sizeof( __GLcontextModes );
- __GLcontextModes * base = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- next = & base;
- for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) _mesa_malloc( size );
- if ( *next == NULL ) {
- _gl_context_modes_destroy( base );
- base = NULL;
- break;
+ const size_t size = (minimum_size > sizeof(__GLcontextModes))
+ ? minimum_size : sizeof(__GLcontextModes);
+ __GLcontextModes *base = NULL;
+ __GLcontextModes **next;
+ unsigned i;
+
+ next = &base;
+ for (i = 0; i < count; i++) {
+ *next = (__GLcontextModes *) _mesa_malloc(size);
+ if (*next == NULL) {
+ _gl_context_modes_destroy(base);
+ base = NULL;
+ break;
}
-
- (void) _mesa_memset( *next, 0, size );
+
+ (void) _mesa_memset(*next, 0, size);
(*next)->visualID = GLX_DONT_CARE;
(*next)->visualType = GLX_DONT_CARE;
(*next)->visualRating = GLX_NONE;
@@ -421,7 +422,7 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
(*next)->bindToTextureTargets = GLX_DONT_CARE;
(*next)->yInverted = GLX_DONT_CARE;
- next = & ((*next)->next);
+ next = &((*next)->next);
}
return base;
@@ -436,12 +437,12 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
* in the list will be freed.
*/
void
-_gl_context_modes_destroy( __GLcontextModes * modes )
+_gl_context_modes_destroy(__GLcontextModes * modes)
{
- while ( modes != NULL ) {
- __GLcontextModes * const next = modes->next;
+ while (modes != NULL) {
+ __GLcontextModes *const next = modes->next;
- _mesa_free( modes );
+ _mesa_free(modes);
modes = next;
}
}
@@ -457,27 +458,27 @@ _gl_context_modes_destroy( __GLcontextModes * modes )
*/
__GLcontextModes *
-_gl_context_modes_find_visual(__GLcontextModes *modes, int vid)
+_gl_context_modes_find_visual(__GLcontextModes * modes, int vid)
{
- __GLcontextModes *m;
+ __GLcontextModes *m;
- for (m = modes; m != NULL; m = m->next)
- if (m->visualID == vid)
- return m;
+ for (m = modes; m != NULL; m = m->next)
+ if (m->visualID == vid)
+ return m;
- return NULL;
+ return NULL;
}
__GLcontextModes *
-_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid)
+_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid)
{
- __GLcontextModes *m;
+ __GLcontextModes *m;
- for (m = modes; m != NULL; m = m->next)
- if (m->fbconfigID == fbid)
- return m;
+ for (m = modes; m != NULL; m = m->next)
+ if (m->fbconfigID == fbid)
+ return m;
- return NULL;
+ return NULL;
}
/**
@@ -490,61 +491,55 @@ _gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid)
* returned otherwise.
*/
GLboolean
-_gl_context_modes_are_same( const __GLcontextModes * a,
- const __GLcontextModes * b )
+_gl_context_modes_are_same(const __GLcontextModes * a,
+ const __GLcontextModes * b)
{
- return( (a->rgbMode == b->rgbMode) &&
- (a->floatMode == b->floatMode) &&
- (a->colorIndexMode == b->colorIndexMode) &&
- (a->doubleBufferMode == b->doubleBufferMode) &&
- (a->stereoMode == b->stereoMode) &&
- (a->redBits == b->redBits) &&
- (a->greenBits == b->greenBits) &&
- (a->blueBits == b->blueBits) &&
- (a->alphaBits == b->alphaBits) &&
-#if 0 /* For some reason these don't get set on the client-side in libGL. */
- (a->redMask == b->redMask) &&
- (a->greenMask == b->greenMask) &&
- (a->blueMask == b->blueMask) &&
- (a->alphaMask == b->alphaMask) &&
+ return ((a->rgbMode == b->rgbMode) &&
+ (a->floatMode == b->floatMode) &&
+ (a->colorIndexMode == b->colorIndexMode) &&
+ (a->doubleBufferMode == b->doubleBufferMode) &&
+ (a->stereoMode == b->stereoMode) &&
+ (a->redBits == b->redBits) &&
+ (a->greenBits == b->greenBits) &&
+ (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) &&
+#if 0 /* For some reason these don't get set on the client-side in libGL. */
+ (a->redMask == b->redMask) &&
+ (a->greenMask == b->greenMask) &&
+ (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) &&
#endif
- (a->rgbBits == b->rgbBits) &&
- (a->indexBits == b->indexBits) &&
- (a->accumRedBits == b->accumRedBits) &&
- (a->accumGreenBits == b->accumGreenBits) &&
- (a->accumBlueBits == b->accumBlueBits) &&
- (a->accumAlphaBits == b->accumAlphaBits) &&
- (a->depthBits == b->depthBits) &&
- (a->stencilBits == b->stencilBits) &&
- (a->numAuxBuffers == b->numAuxBuffers) &&
- (a->level == b->level) &&
- (a->pixmapMode == b->pixmapMode) &&
- (a->visualRating == b->visualRating) &&
-
- (a->transparentPixel == b->transparentPixel) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
- ((a->transparentRed == b->transparentRed) &&
- (a->transparentGreen == b->transparentGreen) &&
- (a->transparentBlue == b->transparentBlue) &&
- (a->transparentAlpha == b->transparentAlpha))) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
- (a->transparentIndex == b->transparentIndex)) &&
-
- (a->sampleBuffers == b->sampleBuffers) &&
- (a->samples == b->samples) &&
- ((a->drawableType & b->drawableType) != 0) &&
- (a->renderType == b->renderType) &&
- (a->maxPbufferWidth == b->maxPbufferWidth) &&
- (a->maxPbufferHeight == b->maxPbufferHeight) &&
- (a->maxPbufferPixels == b->maxPbufferPixels) &&
- (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
- (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
- (a->swapMethod == b->swapMethod) &&
- (a->bindToTextureRgb == b->bindToTextureRgb) &&
- (a->bindToTextureRgba == b->bindToTextureRgba) &&
- (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
- (a->bindToTextureTargets == b->bindToTextureTargets) &&
- (a->yInverted == b->yInverted) );
+ (a->rgbBits == b->rgbBits) &&
+ (a->indexBits == b->indexBits) &&
+ (a->accumRedBits == b->accumRedBits) &&
+ (a->accumGreenBits == b->accumGreenBits) &&
+ (a->accumBlueBits == b->accumBlueBits) &&
+ (a->accumAlphaBits == b->accumAlphaBits) &&
+ (a->depthBits == b->depthBits) &&
+ (a->stencilBits == b->stencilBits) &&
+ (a->numAuxBuffers == b->numAuxBuffers) &&
+ (a->level == b->level) &&
+ (a->pixmapMode == b->pixmapMode) &&
+ (a->visualRating == b->visualRating) &&
+ (a->transparentPixel == b->transparentPixel) &&
+ ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
+ ((a->transparentRed == b->transparentRed) &&
+ (a->transparentGreen == b->transparentGreen) &&
+ (a->transparentBlue == b->transparentBlue) &&
+ (a->transparentAlpha == b->transparentAlpha))) &&
+ ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
+ (a->transparentIndex == b->transparentIndex)) &&
+ (a->sampleBuffers == b->sampleBuffers) &&
+ (a->samples == b->samples) &&
+ ((a->drawableType & b->drawableType) != 0) &&
+ (a->renderType == b->renderType) &&
+ (a->maxPbufferWidth == b->maxPbufferWidth) &&
+ (a->maxPbufferHeight == b->maxPbufferHeight) &&
+ (a->maxPbufferPixels == b->maxPbufferPixels) &&
+ (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
+ (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
+ (a->swapMethod == b->swapMethod) &&
+ (a->bindToTextureRgb == b->bindToTextureRgb) &&
+ (a->bindToTextureRgba == b->bindToTextureRgba) &&
+ (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
+ (a->bindToTextureTargets == b->bindToTextureTargets) &&
+ (a->yInverted == b->yInverted));
}
diff --git a/src/glx/x11/glcontextmodes.h b/src/glx/x11/glcontextmodes.h
index afd09cd7fb..caf6a0daa5 100644
--- a/src/glx/x11/glcontextmodes.h
+++ b/src/glx/x11/glcontextmodes.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2003
* All Rights Reserved.
@@ -33,22 +34,22 @@
#include "GL/internal/glcore.h"
#if !defined(IN_MINI_GLX)
-extern GLint _gl_convert_from_x_visual_type( int visualType );
-extern GLint _gl_convert_to_x_visual_type( int visualType );
-extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
- const __GLXvisualConfig * config );
-extern int _gl_get_context_mode_data( const __GLcontextModes *mode,
- int attribute, int *value_return );
+extern GLint _gl_convert_from_x_visual_type(int visualType);
+extern GLint _gl_convert_to_x_visual_type(int visualType);
+extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+ const __GLXvisualConfig * config);
+extern int _gl_get_context_mode_data(const __GLcontextModes * mode,
+ int attribute, int *value_return);
#endif /* !defined(IN_MINI_GLX) */
-extern __GLcontextModes * _gl_context_modes_create( unsigned count,
- size_t minimum_size );
-extern void _gl_context_modes_destroy( __GLcontextModes * modes );
-extern __GLcontextModes *
- _gl_context_modes_find_visual(__GLcontextModes *modes, int vid);
-extern __GLcontextModes *
- _gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid);
-extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a,
- const __GLcontextModes * b );
+extern __GLcontextModes *_gl_context_modes_create(unsigned count,
+ size_t minimum_size);
+extern void _gl_context_modes_destroy(__GLcontextModes * modes);
+extern __GLcontextModes *_gl_context_modes_find_visual(__GLcontextModes *
+ modes, int vid);
+extern __GLcontextModes *_gl_context_modes_find_fbconfig(__GLcontextModes *
+ modes, int fbid);
+extern GLboolean _gl_context_modes_are_same(const __GLcontextModes * a,
+ const __GLcontextModes * b);
#endif /* GLCONTEXTMODES_H */
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c
index fb2610a490..4b3c7f2202 100644
--- a/src/glx/x11/glx_pbuffer.c
+++ b/src/glx/x11/glx_pbuffer.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
@@ -54,14 +55,14 @@
* This function needs to be modified to work with direct-rendering drivers.
*/
static void
-ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
- const CARD32 * attribs, size_t num_attribs )
+ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
+ const CARD32 * attribs, size_t num_attribs)
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
- CARD32 * output;
+ CARD32 *output;
CARD8 opcode;
- if ( (dpy == NULL) || (drawable == 0) ) {
+ if ((dpy == NULL) || (drawable == 0)) {
return;
}
@@ -71,10 +72,10 @@ ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
LockDisplay(dpy);
- if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
+ if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
xGLXChangeDrawableAttributesReq *req;
- GetReqExtra( GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req );
+ GetReqExtra(GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req);
output = (CARD32 *) (req + 1);
req->reqType = opcode;
@@ -85,7 +86,7 @@ ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
else {
xGLXVendorPrivateWithReplyReq *vpreq;
- GetReqExtra( GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq );
+ GetReqExtra(GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq);
output = (CARD32 *) (vpreq + 1);
vpreq->reqType = opcode;
@@ -96,7 +97,7 @@ ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
output++;
}
- (void) memcpy( output, attribs, sizeof( CARD32 ) * 2 * num_attribs );
+ (void) memcpy(output, attribs, sizeof(CARD32) * 2 * num_attribs);
UnlockDisplay(dpy);
SyncHandle();
@@ -119,12 +120,12 @@ ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
* This function needs to be modified to work with direct-rendering drivers.
*/
static void
-DestroyPbuffer( Display * dpy, GLXDrawable drawable )
+DestroyPbuffer(Display * dpy, GLXDrawable drawable)
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
CARD8 opcode;
- if ( (dpy == NULL) || (drawable == 0) ) {
+ if ((dpy == NULL) || (drawable == 0)) {
return;
}
@@ -134,19 +135,19 @@ DestroyPbuffer( Display * dpy, GLXDrawable drawable )
LockDisplay(dpy);
- if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
- xGLXDestroyPbufferReq * req;
+ if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+ xGLXDestroyPbufferReq *req;
- GetReq( GLXDestroyPbuffer, req );
+ GetReq(GLXDestroyPbuffer, req);
req->reqType = opcode;
req->glxCode = X_GLXDestroyPbuffer;
req->pbuffer = (GLXPbuffer) drawable;
}
else {
xGLXVendorPrivateWithReplyReq *vpreq;
- CARD32 * data;
+ CARD32 *data;
- GetReqExtra( GLXVendorPrivateWithReply, 4, vpreq );
+ GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
data = (CARD32 *) (vpreq + 1);
data[0] = (CARD32) drawable;
@@ -164,29 +165,30 @@ DestroyPbuffer( Display * dpy, GLXDrawable drawable )
#ifdef GLX_DIRECT_RENDERING
-extern __GLXDRIdrawable *
-GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int * const scrn_num);
+extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
+ GLXDrawable drawable,
+ int *const scrn_num);
static GLenum
determineTextureTarget(const int *attribs, int numAttribs)
{
- GLenum target = 0;
- int i;
-
- for (i = 0; i < numAttribs; i++) {
- if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
- switch (attribs[2 * i + 1]) {
- case GLX_TEXTURE_2D_EXT:
- target = GL_TEXTURE_2D;
- break;
- case GLX_TEXTURE_RECTANGLE_EXT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- }
- }
- }
-
- return target;
+ GLenum target = 0;
+ int i;
+
+ for (i = 0; i < numAttribs; i++) {
+ if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
+ switch (attribs[2 * i + 1]) {
+ case GLX_TEXTURE_2D_EXT:
+ target = GL_TEXTURE_2D;
+ break;
+ case GLX_TEXTURE_RECTANGLE_EXT:
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ break;
+ }
+ }
+ }
+
+ return target;
}
#endif
@@ -209,24 +211,24 @@ determineTextureTarget(const int *attribs, int numAttribs)
* This function needs to be modified to work with direct-rendering drivers.
*/
static int
-GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
- int attribute, unsigned int *value )
+GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
+ int attribute, unsigned int *value)
{
__GLXdisplayPrivate *priv;
xGLXGetDrawableAttributesReply reply;
- CARD32 * data;
+ CARD32 *data;
CARD8 opcode;
unsigned int length;
unsigned int i;
unsigned int num_attributes;
- if ( (dpy == NULL) || (drawable == 0) ) {
+ if ((dpy == NULL) || (drawable == 0)) {
return 0;
}
priv = __glXInitialize(dpy);
GLboolean use_glx_1_3 = ((priv->majorVersion > 1)
- || (priv->minorVersion >= 3));
+ || (priv->minorVersion >= 3));
*value = 0;
@@ -237,10 +239,10 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
LockDisplay(dpy);
- if ( use_glx_1_3 ) {
+ if (use_glx_1_3) {
xGLXGetDrawableAttributesReq *req;
- GetReqExtra( GLXGetDrawableAttributes, 4, req );
+ GetReqExtra(GLXGetDrawableAttributes, 4, req);
req->reqType = opcode;
req->glxCode = X_GLXGetDrawableAttributes;
req->drawable = drawable;
@@ -248,7 +250,7 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
else {
xGLXVendorPrivateWithReplyReq *vpreq;
- GetReqExtra( GLXVendorPrivateWithReply, 4, vpreq );
+ GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
data = (CARD32 *) (vpreq + 1);
data[0] = (CARD32) drawable;
@@ -257,48 +259,47 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
}
- _XReply(dpy, (xReply*) &reply, 0, False);
+ _XReply(dpy, (xReply *) & reply, 0, False);
- if (reply.type == X_Error)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
+ if (reply.type == X_Error) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 0;
}
length = reply.length;
- if (length)
- {
- num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
- data = (CARD32 *) Xmalloc( length * sizeof(CARD32) );
- if ( data == NULL ) {
- /* Throw data on the floor */
- _XEatData(dpy, length);
- } else {
- _XRead(dpy, (char *)data, length * sizeof(CARD32) );
-
- /* Search the set of returned attributes for the attribute requested by
- * the caller.
- */
- for ( i = 0 ; i < num_attributes ; i++ ) {
- if ( data[i*2] == attribute ) {
- *value = data[ (i*2) + 1 ];
- break;
- }
- }
+ if (length) {
+ num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
+ data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
+ if (data == NULL) {
+ /* Throw data on the floor */
+ _XEatData(dpy, length);
+ }
+ else {
+ _XRead(dpy, (char *) data, length * sizeof(CARD32));
+
+ /* Search the set of returned attributes for the attribute requested by
+ * the caller.
+ */
+ for (i = 0; i < num_attributes; i++) {
+ if (data[i * 2] == attribute) {
+ *value = data[(i * 2) + 1];
+ break;
+ }
+ }
#ifdef GLX_DIRECT_RENDERING
- {
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+ {
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
- if (pdraw != NULL && !pdraw->textureTarget)
- pdraw->textureTarget = determineTextureTarget((const int *)data,
- num_attributes);
- }
+ if (pdraw != NULL && !pdraw->textureTarget)
+ pdraw->textureTarget =
+ determineTextureTarget((const int *) data, num_attributes);
+ }
#endif
- Xfree( data );
- }
+ Xfree(data);
+ }
}
UnlockDisplay(dpy);
@@ -314,19 +315,18 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
* This function needs to be modified to work with direct-rendering drivers.
*/
static GLXDrawable
-CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
- Drawable drawable, const int *attrib_list,
- CARD8 glxCode )
+CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
+ Drawable drawable, const int *attrib_list, CARD8 glxCode)
{
- xGLXCreateWindowReq * req;
- CARD32 * data;
+ xGLXCreateWindowReq *req;
+ CARD32 *data;
unsigned int i;
CARD8 opcode;
i = 0;
if (attrib_list) {
- while (attrib_list[i * 2] != None)
- i++;
+ while (attrib_list[i * 2] != None)
+ i++;
}
opcode = __glXSetupForCommand(dpy);
@@ -334,7 +334,7 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
return None;
LockDisplay(dpy);
- GetReqExtra( GLXCreateWindow, 8 * i, req );
+ GetReqExtra(GLXCreateWindow, 8 * i, req);
data = (CARD32 *) (req + 1);
req->reqType = opcode;
@@ -345,40 +345,40 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
req->glxwindow = (GLXWindow) XAllocID(dpy);
req->numAttribs = (CARD32) i;
- memcpy( data, attrib_list, 8 * i );
-
+ memcpy(data, attrib_list, 8 * i);
+
UnlockDisplay(dpy);
SyncHandle();
-
+
#ifdef GLX_DIRECT_RENDERING
do {
- /* FIXME: Maybe delay __DRIdrawable creation until the drawable
- * is actually bound to a context... */
-
- __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- __GLXDRIdrawable *pdraw;
- __GLXscreenConfigs *psc;
-
- psc = &priv->screenConfigs[fbconfig->screen];
- if (psc->driScreen == NULL)
- break;
- pdraw = psc->driScreen->createDrawable(psc, drawable,
- req->glxwindow, fbconfig);
- if (pdraw == NULL) {
- fprintf(stderr, "failed to create drawable\n");
- break;
- }
-
- if (__glxHashInsert(psc->drawHash, req->glxwindow, pdraw)) {
- (*pdraw->destroyDrawable)(pdraw);
- return None; /* FIXME: Check what we're supposed to do here... */
- }
-
- pdraw->textureTarget = determineTextureTarget(attrib_list, i);
+ /* FIXME: Maybe delay __DRIdrawable creation until the drawable
+ * is actually bound to a context... */
+
+ __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ __GLXDRIdrawable *pdraw;
+ __GLXscreenConfigs *psc;
+
+ psc = &priv->screenConfigs[fbconfig->screen];
+ if (psc->driScreen == NULL)
+ break;
+ pdraw = psc->driScreen->createDrawable(psc, drawable,
+ req->glxwindow, fbconfig);
+ if (pdraw == NULL) {
+ fprintf(stderr, "failed to create drawable\n");
+ break;
+ }
+
+ if (__glxHashInsert(psc->drawHash, req->glxwindow, pdraw)) {
+ (*pdraw->destroyDrawable) (pdraw);
+ return None; /* FIXME: Check what we're supposed to do here... */
+ }
+
+ pdraw->textureTarget = determineTextureTarget(attrib_list, i);
} while (0);
#endif
- return (GLXDrawable)req->glxwindow;
+ return (GLXDrawable) req->glxwindow;
}
@@ -389,12 +389,12 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
* This function needs to be modified to work with direct-rendering drivers.
*/
static void
-DestroyDrawable( Display * dpy, GLXDrawable drawable, CARD32 glxCode )
+DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode)
{
- xGLXDestroyPbufferReq * req;
+ xGLXDestroyPbufferReq *req;
CARD8 opcode;
- if ( (dpy == NULL) || (drawable == 0) ) {
+ if ((dpy == NULL) || (drawable == 0)) {
return;
}
@@ -405,7 +405,7 @@ DestroyDrawable( Display * dpy, GLXDrawable drawable, CARD32 glxCode )
LockDisplay(dpy);
- GetReqExtra( GLXDestroyPbuffer, 4, req );
+ GetReqExtra(GLXDestroyPbuffer, 4, req);
req->reqType = opcode;
req->glxCode = glxCode;
req->pbuffer = (GLXPbuffer) drawable;
@@ -415,15 +415,15 @@ DestroyDrawable( Display * dpy, GLXDrawable drawable, CARD32 glxCode )
#ifdef GLX_DIRECT_RENDERING
{
- int screen;
- __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
- __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
-
- if (pdraw != NULL) {
- (*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(psc->drawHash, drawable);
- }
+ int screen;
+ __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+ __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
+
+ if (pdraw != NULL) {
+ (*pdraw->destroyDrawable) (pdraw);
+ __glxHashDelete(psc->drawHash, drawable);
+ }
}
#endif
@@ -445,20 +445,20 @@ DestroyDrawable( Display * dpy, GLXDrawable drawable, CARD32 glxCode )
* This function needs to be modified to work with direct-rendering drivers.
*/
static GLXDrawable
-CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
- unsigned int width, unsigned int height,
- const int *attrib_list, GLboolean size_in_attribs )
+CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig,
+ unsigned int width, unsigned int height,
+ const int *attrib_list, GLboolean size_in_attribs)
{
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
GLXDrawable id = 0;
- CARD32 * data;
+ CARD32 *data;
CARD8 opcode;
- unsigned int i;
+ unsigned int i;
i = 0;
if (attrib_list) {
- while (attrib_list[i * 2])
- i++;
+ while (attrib_list[i * 2])
+ i++;
}
opcode = __glXSetupForCommand(dpy);
@@ -468,11 +468,11 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
LockDisplay(dpy);
id = XAllocID(dpy);
- if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
- xGLXCreatePbufferReq * req;
+ if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+ xGLXCreatePbufferReq *req;
unsigned int extra = (size_in_attribs) ? 0 : 2;
- GetReqExtra( GLXCreatePbuffer, (8 * (i + extra)), req );
+ GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req);
data = (CARD32 *) (req + 1);
req->reqType = opcode;
@@ -482,18 +482,18 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
req->pbuffer = (GLXPbuffer) id;
req->numAttribs = (CARD32) (i + extra);
- if ( ! size_in_attribs ) {
- data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
- data[(2 * i) + 1] = width;
- data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
- data[(2 * i) + 3] = height;
- data += 4;
+ if (!size_in_attribs) {
+ data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
+ data[(2 * i) + 1] = width;
+ data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
+ data[(2 * i) + 3] = height;
+ data += 4;
}
}
else {
xGLXVendorPrivateReq *vpreq;
- GetReqExtra( GLXVendorPrivate, 20 + (8 * i), vpreq );
+ GetReqExtra(GLXVendorPrivate, 20 + (8 * i), vpreq);
data = (CARD32 *) (vpreq + 1);
vpreq->reqType = opcode;
@@ -508,7 +508,7 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
data += 5;
}
- (void) memcpy( data, attrib_list, sizeof(CARD32) * 2 * i );
+ (void) memcpy(data, attrib_list, sizeof(CARD32) * 2 * i);
UnlockDisplay(dpy);
SyncHandle();
@@ -521,13 +521,13 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
* Create a new pbuffer.
*/
PUBLIC GLXPbufferSGIX
-glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config,
- unsigned int width, unsigned int height,
- int *attrib_list)
+glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
+ unsigned int width, unsigned int height,
+ int *attrib_list)
{
- return (GLXPbufferSGIX) CreatePbuffer( dpy, (__GLcontextModes *) config,
- width, height,
- attrib_list, GL_FALSE );
+ return (GLXPbufferSGIX) CreatePbuffer(dpy, (__GLcontextModes *) config,
+ width, height,
+ attrib_list, GL_FALSE);
}
@@ -535,7 +535,7 @@ glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config,
* Create a new pbuffer.
*/
PUBLIC GLXPbuffer
-glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
+glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
{
int i, width, height;
@@ -545,17 +545,16 @@ glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
for (i = 0; attrib_list[i * 2]; i++) {
switch (attrib_list[i * 2]) {
case GLX_PBUFFER_WIDTH:
- width = attrib_list[i * 2 + 1];
- break;
+ width = attrib_list[i * 2 + 1];
+ break;
case GLX_PBUFFER_HEIGHT:
- height = attrib_list[i * 2 + 1];
- break;
+ height = attrib_list[i * 2 + 1];
+ break;
}
}
- return (GLXPbuffer) CreatePbuffer( dpy, (__GLcontextModes *) config,
- width, height,
- attrib_list, GL_TRUE );
+ return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
+ width, height, attrib_list, GL_TRUE);
}
@@ -563,9 +562,9 @@ glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
* Destroy an existing pbuffer.
*/
PUBLIC void
-glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
+glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
{
- DestroyPbuffer( dpy, pbuf );
+ DestroyPbuffer(dpy, pbuf);
}
@@ -573,10 +572,10 @@ glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
* Query an attribute of a drawable.
*/
PUBLIC void
-glXQueryDrawable(Display *dpy, GLXDrawable drawable,
- int attribute, unsigned int *value)
+glXQueryDrawable(Display * dpy, GLXDrawable drawable,
+ int attribute, unsigned int *value)
{
- GetDrawableAttribute( dpy, drawable, attribute, value );
+ GetDrawableAttribute(dpy, drawable, attribute, value);
}
@@ -584,10 +583,10 @@ glXQueryDrawable(Display *dpy, GLXDrawable drawable,
* Query an attribute of a pbuffer.
*/
PUBLIC int
-glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX drawable,
- int attribute, unsigned int *value)
+glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
+ int attribute, unsigned int *value)
{
- return GetDrawableAttribute( dpy, drawable, attribute, value );
+ return GetDrawableAttribute(dpy, drawable, attribute, value);
}
@@ -595,14 +594,14 @@ glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX drawable,
* Select the event mask for a drawable.
*/
PUBLIC void
-glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
+glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
{
CARD32 attribs[2];
attribs[0] = (CARD32) GLX_EVENT_MASK;
attribs[1] = (CARD32) mask;
- ChangeDrawableAttribute( dpy, drawable, attribs, 1 );
+ ChangeDrawableAttribute(dpy, drawable, attribs, 1);
}
@@ -610,7 +609,7 @@ glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
* Get the selected event mask for a drawable.
*/
PUBLIC void
-glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
+glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
{
unsigned int value;
@@ -620,56 +619,56 @@ glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
* we could just type-cast the pointer, but why?
*/
- GetDrawableAttribute( dpy, drawable, GLX_EVENT_MASK_SGIX, & value );
+ GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
*mask = value;
}
PUBLIC GLXPixmap
-glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
- const int *attrib_list )
+glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
+ const int *attrib_list)
{
- return CreateDrawable( dpy, (__GLcontextModes *) config,
- (Drawable) pixmap, attrib_list,
- X_GLXCreatePixmap );
+ return CreateDrawable(dpy, (__GLcontextModes *) config,
+ (Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
}
PUBLIC GLXWindow
-glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
- const int *attrib_list )
+glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
+ const int *attrib_list)
{
- return CreateDrawable( dpy, (__GLcontextModes *) config,
- (Drawable) win, attrib_list,
- X_GLXCreateWindow );
+ return CreateDrawable(dpy, (__GLcontextModes *) config,
+ (Drawable) win, attrib_list, X_GLXCreateWindow);
}
PUBLIC void
-glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
+glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
{
- DestroyDrawable( dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap );
+ DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
}
PUBLIC void
-glXDestroyWindow(Display *dpy, GLXWindow win)
+glXDestroyWindow(Display * dpy, GLXWindow win)
{
- DestroyDrawable( dpy, (GLXDrawable) win, X_GLXDestroyWindow );
+ DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
}
-PUBLIC GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
- (Display *dpy, GLXPbufferSGIX pbuf),
- (dpy, pbuf),
- glXDestroyPbuffer)
+PUBLIC
+GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
+ (Display * dpy, GLXPbufferSGIX pbuf),
+ (dpy, pbuf), glXDestroyPbuffer)
-PUBLIC GLX_ALIAS_VOID(glXSelectEventSGIX,
- (Display *dpy, GLXDrawable drawable, unsigned long mask),
- (dpy, drawable, mask),
- glXSelectEvent)
+PUBLIC
+GLX_ALIAS_VOID(glXSelectEventSGIX,
+ (Display * dpy, GLXDrawable drawable,
+ unsigned long mask), (dpy, drawable, mask),
+ glXSelectEvent)
-PUBLIC GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
- (Display *dpy, GLXDrawable drawable, unsigned long *mask),
- (dpy, drawable, mask),
- glXGetSelectedEvent)
+PUBLIC
+GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
+ (Display * dpy, GLXDrawable drawable,
+ unsigned long *mask), (dpy, drawable, mask),
+ glXGetSelectedEvent)
diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c
index e93cd2afd4..9664243d8e 100644
--- a/src/glx/x11/glx_query.c
+++ b/src/glx/x11/glx_query.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
@@ -39,12 +40,13 @@
* an identical binary layout. The only difference between them is the
* meaning of the \c for_whom field and the value of the \c glxCode.
*/
-typedef struct GLXGenericGetString {
- CARD8 reqType;
- CARD8 glxCode;
- CARD16 length B16;
- CARD32 for_whom B32;
- CARD32 name B32;
+typedef struct GLXGenericGetString
+{
+ CARD8 reqType;
+ CARD8 glxCode;
+ CARD16 length B16;
+ CARD32 for_whom B32;
+ CARD32 name B32;
} xGLXGenericGetStringReq;
/* These defines are only needed to make the GetReq macro happy.
@@ -57,46 +59,46 @@ typedef struct GLXGenericGetString {
* This routine will allocate the necessay space for the string.
*/
char *
-__glXGetStringFromServer( Display * dpy, int opcode, CARD32 glxCode,
- CARD32 for_whom, CARD32 name )
+__glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
+ CARD32 for_whom, CARD32 name)
{
- xGLXGenericGetStringReq *req;
- xGLXSingleReply reply;
- int length;
- int numbytes;
- char * buf;
+ xGLXGenericGetStringReq *req;
+ xGLXSingleReply reply;
+ int length;
+ int numbytes;
+ char *buf;
- LockDisplay( dpy );
+ LockDisplay(dpy);
- /* All of the GLX protocol requests for getting a string from the server
- * look the same. The exact meaning of the for_whom field is usually
- * either the screen number (for glXQueryServerString) or the context tag
- * (for GLXSingle).
- */
+ /* All of the GLX protocol requests for getting a string from the server
+ * look the same. The exact meaning of the for_whom field is usually
+ * either the screen number (for glXQueryServerString) or the context tag
+ * (for GLXSingle).
+ */
- GetReq( GLXGenericGetString, req );
- req->reqType = opcode;
- req->glxCode = glxCode;
- req->for_whom = for_whom;
- req->name = name;
+ GetReq(GLXGenericGetString, req);
+ req->reqType = opcode;
+ req->glxCode = glxCode;
+ req->for_whom = for_whom;
+ req->name = name;
- _XReply( dpy, (xReply *) & reply, 0, False );
+ _XReply(dpy, (xReply *) & reply, 0, False);
- length = reply.length * 4;
- numbytes = reply.size;
+ length = reply.length * 4;
+ numbytes = reply.size;
- buf = (char *) Xmalloc( numbytes );
- if ( buf != NULL ) {
- _XRead( dpy, buf, numbytes );
- length -= numbytes;
- }
+ buf = (char *) Xmalloc(numbytes);
+ if (buf != NULL) {
+ _XRead(dpy, buf, numbytes);
+ length -= numbytes;
+ }
- _XEatData( dpy, length );
+ _XEatData(dpy, length);
- UnlockDisplay( dpy );
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- return buf;
+ return buf;
}
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index ac44e950a7..80f28332b7 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -137,6 +138,8 @@ struct __GLXDRIscreenRec {
const __GLcontextModes *modes);
void (*swapBuffers)(__GLXDRIdrawable *pdraw);
+ void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
+ int x, int y, int width, int height);
};
struct __GLXDRIcontextRec {
@@ -492,7 +495,7 @@ struct __GLXscreenConfigsRec {
__GLXDRIscreen *driScreen;
#ifdef __DRI_COPY_SUB_BUFFER
- const __DRIcopySubBufferExtension *copySubBuffer;
+ const __DRIcopySubBufferExtension *driCopySubBuffer;
#endif
#ifdef __DRI_SWAP_CONTROL
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index cac39a5904..ff04853e93 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -2498,10 +2499,9 @@ static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable,
int screen;
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
if ( pdraw != NULL ) {
- __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
- if (psc->copySubBuffer != NULL) {
- (*psc->copySubBuffer->copySubBuffer)(pdraw->driDrawable,
- x, y, width, height);
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+ if (psc->driScreen->copySubBuffer != NULL) {
+ (*psc->driScreen->copySubBuffer)(pdraw, x, y, width, height);
}
return;
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
index 67fba59a3f..89be63c5fa 100644
--- a/src/glx/x11/glxcurrent.c
+++ b/src/glx/x11/glxcurrent.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -55,11 +56,11 @@ static GLubyte dummyBuffer[__GLX_BUFFER_LIMIT_SIZE];
** the dummy context structure.
*/
static __GLXcontext dummyContext = {
- &dummyBuffer[0],
- &dummyBuffer[0],
- &dummyBuffer[0],
- &dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
- sizeof(dummyBuffer),
+ &dummyBuffer[0],
+ &dummyBuffer[0],
+ &dummyBuffer[0],
+ &dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
+ sizeof(dummyBuffer),
};
@@ -79,7 +80,8 @@ static __GLapi *IndirectAPI = NULL;
static GLboolean TSDinitialized = GL_FALSE;
static xthread_key_t ContextTSD;
-_X_HIDDEN __GLXcontext *__glXGetCurrentContext(void)
+_X_HIDDEN __GLXcontext *
+__glXGetCurrentContext(void)
{
if (!TSDinitialized) {
xthread_key_create(&ContextTSD, NULL);
@@ -96,7 +98,8 @@ _X_HIDDEN __GLXcontext *__glXGetCurrentContext(void)
}
}
-_X_HIDDEN void __glXSetCurrentContext(__GLXcontext *c)
+_X_HIDDEN void
+__glXSetCurrentContext(__GLXcontext * c)
{
if (!TSDinitialized) {
xthread_key_create(&ContextTSD, NULL);
@@ -122,12 +125,13 @@ _X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
* \b never be \c NULL. This is important! Because of this
* \c __glXGetCurrentContext can be implemented as trivial macro.
*/
-__thread void * __glX_tls_Context __attribute__((tls_model("initial-exec")))
- = &dummyContext;
+__thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
+ = &dummyContext;
-_X_HIDDEN void __glXSetCurrentContext( __GLXcontext * c )
+_X_HIDDEN void
+__glXSetCurrentContext(__GLXcontext * c)
{
- __glX_tls_Context = (c != NULL) ? c : &dummyContext;
+ __glX_tls_Context = (c != NULL) ? c : &dummyContext;
}
# else
@@ -150,28 +154,31 @@ static pthread_key_t ContextTSD;
* initialize the per-thread data key. This is ideally done using the
* \c pthread_once mechanism.
*/
-static void init_thread_data( void )
+static void
+init_thread_data(void)
{
- if ( pthread_key_create( & ContextTSD, NULL ) != 0 ) {
- perror( "pthread_key_create" );
- exit( -1 );
- }
+ if (pthread_key_create(&ContextTSD, NULL) != 0) {
+ perror("pthread_key_create");
+ exit(-1);
+ }
}
-_X_HIDDEN void __glXSetCurrentContext( __GLXcontext * c )
+_X_HIDDEN void
+__glXSetCurrentContext(__GLXcontext * c)
{
- pthread_once( & once_control, init_thread_data );
- pthread_setspecific( ContextTSD, c );
+ pthread_once(&once_control, init_thread_data);
+ pthread_setspecific(ContextTSD, c);
}
-_X_HIDDEN __GLXcontext * __glXGetCurrentContext( void )
+_X_HIDDEN __GLXcontext *
+__glXGetCurrentContext(void)
{
- void * v;
+ void *v;
- pthread_once( & once_control, init_thread_data );
+ pthread_once(&once_control, init_thread_data);
- v = pthread_getspecific( ContextTSD );
- return (v == NULL) ? & dummyContext : (__GLXcontext *) v;
+ v = pthread_getspecific(ContextTSD);
+ return (v == NULL) ? &dummyContext : (__GLXcontext *) v;
}
# endif /* defined( GLX_USE_TLS ) */
@@ -188,32 +195,36 @@ _X_HIDDEN __GLXcontext *__glXcurrentContext = &dummyContext;
#endif
-_X_HIDDEN void __glXSetCurrentContextNull(void)
+_X_HIDDEN void
+__glXSetCurrentContextNull(void)
{
- __glXSetCurrentContext(&dummyContext);
+ __glXSetCurrentContext(&dummyContext);
#ifdef GLX_DIRECT_RENDERING
- _glapi_set_dispatch(NULL); /* no-op functions */
+ _glapi_set_dispatch(NULL); /* no-op functions */
#endif
}
/************************************************************************/
-PUBLIC GLXContext glXGetCurrentContext(void)
+PUBLIC GLXContext
+glXGetCurrentContext(void)
{
- GLXContext cx = __glXGetCurrentContext();
-
- if (cx == &dummyContext) {
- return NULL;
- } else {
- return cx;
- }
+ GLXContext cx = __glXGetCurrentContext();
+
+ if (cx == &dummyContext) {
+ return NULL;
+ }
+ else {
+ return cx;
+ }
}
-PUBLIC GLXDrawable glXGetCurrentDrawable(void)
+PUBLIC GLXDrawable
+glXGetCurrentDrawable(void)
{
- GLXContext gc = __glXGetCurrentContext();
- return gc->currentDrawable;
+ GLXContext gc = __glXGetCurrentContext();
+ return gc->currentDrawable;
}
@@ -233,107 +244,109 @@ PUBLIC GLXDrawable glXGetCurrentDrawable(void)
* \warning
* This function assumes that \c dpy is locked with \c LockDisplay on entry.
*/
-static Bool SendMakeCurrentRequest(Display *dpy, CARD8 opcode,
- GLXContextID gc_id, GLXContextTag gc_tag,
- GLXDrawable draw, GLXDrawable read,
- xGLXMakeCurrentReply *reply)
+static Bool
+SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
+ GLXContextID gc_id, GLXContextTag gc_tag,
+ GLXDrawable draw, GLXDrawable read,
+ xGLXMakeCurrentReply * reply)
{
- Bool ret;
-
-
- LockDisplay(dpy);
-
- if (draw == read) {
- xGLXMakeCurrentReq *req;
-
- GetReq(GLXMakeCurrent,req);
- req->reqType = opcode;
- req->glxCode = X_GLXMakeCurrent;
- req->drawable = draw;
- req->context = gc_id;
- req->oldContextTag = gc_tag;
- }
- else {
- __GLXdisplayPrivate *priv = __glXInitialize(dpy);
-
- /* If the server can support the GLX 1.3 version, we should
- * perfer that. Not only that, some servers support GLX 1.3 but
- * not the SGI extension.
- */
-
- if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
- xGLXMakeContextCurrentReq *req;
-
- GetReq(GLXMakeContextCurrent,req);
- req->reqType = opcode;
- req->glxCode = X_GLXMakeContextCurrent;
- req->drawable = draw;
- req->readdrawable = read;
- req->context = gc_id;
- req->oldContextTag = gc_tag;
- }
- else {
- xGLXVendorPrivateWithReplyReq *vpreq;
- xGLXMakeCurrentReadSGIReq *req;
-
- GetReqExtra(GLXVendorPrivateWithReply,
- sz_xGLXMakeCurrentReadSGIReq-sz_xGLXVendorPrivateWithReplyReq,vpreq);
- req = (xGLXMakeCurrentReadSGIReq *)vpreq;
- req->reqType = opcode;
- req->glxCode = X_GLXVendorPrivateWithReply;
- req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
- req->drawable = draw;
- req->readable = read;
- req->context = gc_id;
- req->oldContextTag = gc_tag;
- }
- }
-
- ret = _XReply(dpy, (xReply*) reply, 0, False);
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ret;
+ Bool ret;
+
+
+ LockDisplay(dpy);
+
+ if (draw == read) {
+ xGLXMakeCurrentReq *req;
+
+ GetReq(GLXMakeCurrent, req);
+ req->reqType = opcode;
+ req->glxCode = X_GLXMakeCurrent;
+ req->drawable = draw;
+ req->context = gc_id;
+ req->oldContextTag = gc_tag;
+ }
+ else {
+ __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+
+ /* If the server can support the GLX 1.3 version, we should
+ * perfer that. Not only that, some servers support GLX 1.3 but
+ * not the SGI extension.
+ */
+
+ if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+ xGLXMakeContextCurrentReq *req;
+
+ GetReq(GLXMakeContextCurrent, req);
+ req->reqType = opcode;
+ req->glxCode = X_GLXMakeContextCurrent;
+ req->drawable = draw;
+ req->readdrawable = read;
+ req->context = gc_id;
+ req->oldContextTag = gc_tag;
+ }
+ else {
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXMakeCurrentReadSGIReq *req;
+
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXMakeCurrentReadSGIReq -
+ sz_xGLXVendorPrivateWithReplyReq, vpreq);
+ req = (xGLXMakeCurrentReadSGIReq *) vpreq;
+ req->reqType = opcode;
+ req->glxCode = X_GLXVendorPrivateWithReply;
+ req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+ req->drawable = draw;
+ req->readable = read;
+ req->context = gc_id;
+ req->oldContextTag = gc_tag;
+ }
+ }
+
+ ret = _XReply(dpy, (xReply *) reply, 0, False);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return ret;
}
#ifdef GLX_DIRECT_RENDERING
static __GLXDRIdrawable *
-FetchDRIDrawable(Display *dpy,
- GLXDrawable glxDrawable, GLXContext gc, Bool pre13)
+FetchDRIDrawable(Display * dpy,
+ GLXDrawable glxDrawable, GLXContext gc, Bool pre13)
{
- __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- __GLXDRIdrawable *pdraw;
- __GLXscreenConfigs *psc;
- XID drawable;
-
- if (priv == NULL)
- return NULL;
-
- psc = &priv->screenConfigs[gc->screen];
- if (psc->drawHash == NULL)
- return NULL;
-
- if (__glxHashLookup(psc->drawHash, glxDrawable, (void *) &pdraw) == 0)
- return pdraw;
-
- /* If this is glXMakeCurrent (pre GLX 1.3) we allow creating the
- * GLX drawable on the fly. Otherwise we pass None as the X
- * drawable */
- if (pre13)
- drawable = glxDrawable;
- else
- drawable = None;
-
- pdraw = psc->driScreen->createDrawable(psc, drawable,
- glxDrawable, gc->mode);
- if (__glxHashInsert(psc->drawHash, glxDrawable, pdraw)) {
- (*pdraw->destroyDrawable)(pdraw);
- return NULL;
- }
-
- return pdraw;
+ __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ __GLXDRIdrawable *pdraw;
+ __GLXscreenConfigs *psc;
+ XID drawable;
+
+ if (priv == NULL)
+ return NULL;
+
+ psc = &priv->screenConfigs[gc->screen];
+ if (psc->drawHash == NULL)
+ return NULL;
+
+ if (__glxHashLookup(psc->drawHash, glxDrawable, (void *) &pdraw) == 0)
+ return pdraw;
+
+ /* If this is glXMakeCurrent (pre GLX 1.3) we allow creating the
+ * GLX drawable on the fly. Otherwise we pass None as the X
+ * drawable */
+ if (pre13)
+ drawable = glxDrawable;
+ else
+ drawable = None;
+
+ pdraw = psc->driScreen->createDrawable(psc, drawable,
+ glxDrawable, gc->mode);
+ if (__glxHashInsert(psc->drawHash, glxDrawable, pdraw)) {
+ (*pdraw->destroyDrawable) (pdraw);
+ return NULL;
+ }
+
+ return pdraw;
}
#endif /* GLX_DIRECT_RENDERING */
@@ -343,170 +356,177 @@ FetchDRIDrawable(Display *dpy,
*
* \note This is in this file so that it can access dummyContext.
*/
-static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
- GLXDrawable read, GLXContext gc,
- Bool pre13)
+static Bool
+MakeContextCurrent(Display * dpy, GLXDrawable draw,
+ GLXDrawable read, GLXContext gc, Bool pre13)
{
- xGLXMakeCurrentReply reply;
- const GLXContext oldGC = __glXGetCurrentContext();
- const CARD8 opcode = __glXSetupForCommand(dpy);
- const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
+ xGLXMakeCurrentReply reply;
+ const GLXContext oldGC = __glXGetCurrentContext();
+ const CARD8 opcode = __glXSetupForCommand(dpy);
+ const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
? opcode : __glXSetupForCommand(oldGC->currentDpy);
- Bool bindReturnValue;
+ Bool bindReturnValue;
- if (!opcode || !oldOpcode) {
- return GL_FALSE;
- }
+ if (!opcode || !oldOpcode) {
+ return GL_FALSE;
+ }
- /* Make sure that the new context has a nonzero ID. In the request,
- * a zero context ID is used only to mean that we bind to no current
- * context.
- */
- if ((gc != NULL) && (gc->xid == None)) {
- return GL_FALSE;
- }
+ /* Make sure that the new context has a nonzero ID. In the request,
+ * a zero context ID is used only to mean that we bind to no current
+ * context.
+ */
+ if ((gc != NULL) && (gc->xid == None)) {
+ return GL_FALSE;
+ }
- _glapi_check_multithread();
+ _glapi_check_multithread();
#ifdef GLX_DIRECT_RENDERING
- /* Bind the direct rendering context to the drawable */
- if (gc && gc->driContext) {
- __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc, pre13);
- __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc, pre13);
-
- bindReturnValue =
- (gc->driContext->bindContext) (gc->driContext, pdraw, pread);
- } else
+ /* Bind the direct rendering context to the drawable */
+ if (gc && gc->driContext) {
+ __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc, pre13);
+ __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc, pre13);
+
+ bindReturnValue =
+ (gc->driContext->bindContext) (gc->driContext, pdraw, pread);
+ }
+ else
#endif
- {
- /* Send a glXMakeCurrent request to bind the new context. */
- bindReturnValue =
- SendMakeCurrentRequest(dpy, opcode, gc ? gc->xid : None,
- ((dpy != oldGC->currentDpy) || oldGC->isDirect)
- ? None : oldGC->currentContextTag,
- draw, read, &reply);
- }
+ {
+ /* Send a glXMakeCurrent request to bind the new context. */
+ bindReturnValue =
+ SendMakeCurrentRequest(dpy, opcode, gc ? gc->xid : None,
+ ((dpy != oldGC->currentDpy)
+ || oldGC->isDirect)
+ ? None : oldGC->currentContextTag, draw, read,
+ &reply);
+ }
- if (!bindReturnValue) {
- return False;
- }
+ if (!bindReturnValue) {
+ return False;
+ }
#ifdef GLX_DIRECT_RENDERING
- if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
- !oldGC->isDirect && oldGC != &dummyContext) {
+ if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
+ !oldGC->isDirect && oldGC != &dummyContext) {
#else
- if ((dpy != oldGC->currentDpy) && oldGC != &dummyContext) {
+ if ((dpy != oldGC->currentDpy) && oldGC != &dummyContext) {
#endif
- xGLXMakeCurrentReply dummy_reply;
-
- /* We are either switching from one dpy to another and have to
- * send a request to the previous dpy to unbind the previous
- * context, or we are switching away from a indirect context to
- * a direct context and have to send a request to the dpy to
- * unbind the previous context.
- */
- (void) SendMakeCurrentRequest(oldGC->currentDpy, oldOpcode, None,
- oldGC->currentContextTag, None, None,
- & dummy_reply);
- }
+ xGLXMakeCurrentReply dummy_reply;
+
+ /* We are either switching from one dpy to another and have to
+ * send a request to the previous dpy to unbind the previous
+ * context, or we are switching away from a indirect context to
+ * a direct context and have to send a request to the dpy to
+ * unbind the previous context.
+ */
+ (void) SendMakeCurrentRequest(oldGC->currentDpy, oldOpcode, None,
+ oldGC->currentContextTag, None, None,
+ &dummy_reply);
+ }
#ifdef GLX_DIRECT_RENDERING
- else if (oldGC->driContext) {
- oldGC->driContext->unbindContext(oldGC->driContext);
- }
+ else if (oldGC->driContext) {
+ oldGC->driContext->unbindContext(oldGC->driContext);
+ }
#endif
- /* Update our notion of what is current */
- __glXLock();
- if (gc == oldGC) {
- /* Even though the contexts are the same the drawable might have
- * changed. Note that gc cannot be the dummy, and that oldGC
- * cannot be NULL, therefore if they are the same, gc is not
- * NULL and not the dummy.
- */
- gc->currentDrawable = draw;
- gc->currentReadable = read;
- } else {
- if (oldGC != &dummyContext) {
- /* Old current context is no longer current to anybody */
- oldGC->currentDpy = 0;
- oldGC->currentDrawable = None;
- oldGC->currentReadable = None;
- oldGC->currentContextTag = 0;
-
- if (oldGC->xid == None) {
- /* We are switching away from a context that was
- * previously destroyed, so we need to free the memory
- * for the old handle.
- */
+ /* Update our notion of what is current */
+ __glXLock();
+ if (gc == oldGC) {
+ /* Even though the contexts are the same the drawable might have
+ * changed. Note that gc cannot be the dummy, and that oldGC
+ * cannot be NULL, therefore if they are the same, gc is not
+ * NULL and not the dummy.
+ */
+ gc->currentDrawable = draw;
+ gc->currentReadable = read;
+ }
+ else {
+ if (oldGC != &dummyContext) {
+ /* Old current context is no longer current to anybody */
+ oldGC->currentDpy = 0;
+ oldGC->currentDrawable = None;
+ oldGC->currentReadable = None;
+ oldGC->currentContextTag = 0;
+
+ if (oldGC->xid == None) {
+ /* We are switching away from a context that was
+ * previously destroyed, so we need to free the memory
+ * for the old handle.
+ */
#ifdef GLX_DIRECT_RENDERING
- /* Destroy the old direct rendering context */
- if (oldGC->driContext) {
- oldGC->driContext->destroyContext(oldGC->driContext,
- oldGC->psc,
- oldGC->createDpy);
- oldGC->driContext = NULL;
- }
+ /* Destroy the old direct rendering context */
+ if (oldGC->driContext) {
+ oldGC->driContext->destroyContext(oldGC->driContext,
+ oldGC->psc,
+ oldGC->createDpy);
+ oldGC->driContext = NULL;
+ }
#endif
- __glXFreeContext(oldGC);
- }
- }
- if (gc) {
- __glXSetCurrentContext(gc);
-
- gc->currentDpy = dpy;
- gc->currentDrawable = draw;
- gc->currentReadable = read;
-
-#ifdef GLX_DIRECT_RENDERING
- if (!gc->driContext) {
+ __glXFreeContext(oldGC);
+ }
+ }
+ if (gc) {
+ __glXSetCurrentContext(gc);
+
+ gc->currentDpy = dpy;
+ gc->currentDrawable = draw;
+ gc->currentReadable = read;
+
+#ifdef GLX_DIRECT_RENDERING
+ if (!gc->driContext) {
#endif
- if (!IndirectAPI)
- IndirectAPI = __glXNewIndirectAPI();
- _glapi_set_dispatch(IndirectAPI);
+ if (!IndirectAPI)
+ IndirectAPI = __glXNewIndirectAPI();
+ _glapi_set_dispatch(IndirectAPI);
#ifdef GLX_USE_APPLEGL
- do {
- extern void XAppleDRIUseIndirectDispatch(void);
- XAppleDRIUseIndirectDispatch();
- } while (0);
+ do {
+ extern void XAppleDRIUseIndirectDispatch(void);
+ XAppleDRIUseIndirectDispatch();
+ } while (0);
#endif
- __GLXattribute *state =
- (__GLXattribute *)(gc->client_state_private);
-
- gc->currentContextTag = reply.contextTag;
- if (state->array_state == NULL) {
- (void) glGetString(GL_EXTENSIONS);
- (void) glGetString(GL_VERSION);
- __glXInitVertexArrayState(gc);
- }
-#ifdef GLX_DIRECT_RENDERING
- }
- else {
- gc->currentContextTag = -1;
- }
+ __GLXattribute *state =
+ (__GLXattribute *) (gc->client_state_private);
+
+ gc->currentContextTag = reply.contextTag;
+ if (state->array_state == NULL) {
+ (void) glGetString(GL_EXTENSIONS);
+ (void) glGetString(GL_VERSION);
+ __glXInitVertexArrayState(gc);
+ }
+#ifdef GLX_DIRECT_RENDERING
+ }
+ else {
+ gc->currentContextTag = -1;
+ }
#endif
- } else {
- __glXSetCurrentContextNull();
- }
- }
- __glXUnlock();
- return GL_TRUE;
+ }
+ else {
+ __glXSetCurrentContextNull();
+ }
+ }
+ __glXUnlock();
+ return GL_TRUE;
}
-PUBLIC Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
+PUBLIC Bool
+glXMakeCurrent(Display * dpy, GLXDrawable draw, GLXContext gc)
{
- return MakeContextCurrent(dpy, draw, draw, gc, True);
+ return MakeContextCurrent(dpy, draw, draw, gc, True);
}
-PUBLIC GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
- (Display *dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
- (dpy, d, r, ctx, False), MakeContextCurrent)
+PUBLIC
+GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
+ (Display * dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
+ (dpy, d, r, ctx, False), MakeContextCurrent)
-PUBLIC GLX_ALIAS(Bool, glXMakeContextCurrent,
- (Display *dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
- (dpy, d, r, ctx, False), MakeContextCurrent)
+ PUBLIC GLX_ALIAS(Bool, glXMakeContextCurrent,
+ (Display * dpy, GLXDrawable d, GLXDrawable r,
+ GLXContext ctx), (dpy, d, r, ctx, False),
+ MakeContextCurrent)
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index eaf1ec2dfd..0b7a7af731 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -35,7 +36,7 @@
* Direct rendering support added by Precision Insight, Inc.
*
* \author Kevin E. Martin <kevin@precisioninsight.com>
- */
+ */
#include <assert.h>
#include "glxclient.h"
@@ -53,20 +54,20 @@
#ifdef DEBUG
-void __glXDumpDrawBuffer(__GLXcontext *ctx);
+void __glXDumpDrawBuffer(__GLXcontext * ctx);
#endif
#ifdef USE_SPARC_ASM
static void _glx_mesa_init_sparc_glapi_relocs(void);
static int _mesa_sparc_needs_init = 1;
-#define INIT_MESA_SPARC { \
- if(_mesa_sparc_needs_init) { \
+#define INIT_MESA_SPARC do { \
+ if (_mesa_sparc_needs_init) { \
_glx_mesa_init_sparc_glapi_relocs(); \
- _mesa_sparc_needs_init = 0; \
- } \
-}
+ _mesa_sparc_needs_init = 0; \
+ } \
+ } while(0)
#else
-#define INIT_MESA_SPARC
+#define INIT_MESA_SPARC do { } while(0)
#endif
/*
@@ -81,133 +82,135 @@ static char *__glXExtensionName = GLX_EXTENSION_NAME;
XExtensionInfo *__glXExtensionInfo = NULL;
static /* const */ char *error_list[] = {
- "GLXBadContext",
- "GLXBadContextState",
- "GLXBadDrawable",
- "GLXBadPixmap",
- "GLXBadContextTag",
- "GLXBadCurrentWindow",
- "GLXBadRenderRequest",
- "GLXBadLargeRequest",
- "GLXUnsupportedPrivateRequest",
- "GLXBadFBConfig",
- "GLXBadPbuffer",
- "GLXBadCurrentDrawable",
- "GLXBadWindow",
+ "GLXBadContext",
+ "GLXBadContextState",
+ "GLXBadDrawable",
+ "GLXBadPixmap",
+ "GLXBadContextTag",
+ "GLXBadCurrentWindow",
+ "GLXBadRenderRequest",
+ "GLXBadLargeRequest",
+ "GLXUnsupportedPrivateRequest",
+ "GLXBadFBConfig",
+ "GLXBadPbuffer",
+ "GLXBadCurrentDrawable",
+ "GLXBadWindow",
};
-static int __glXCloseDisplay(Display *dpy, XExtCodes *codes)
+static int
+__glXCloseDisplay(Display * dpy, XExtCodes * codes)
{
- GLXContext gc;
+ GLXContext gc;
- gc = __glXGetCurrentContext();
- if (dpy == gc->currentDpy) {
- __glXSetCurrentContextNull();
- __glXFreeContext(gc);
- }
+ gc = __glXGetCurrentContext();
+ if (dpy == gc->currentDpy) {
+ __glXSetCurrentContextNull();
+ __glXFreeContext(gc);
+ }
- return XextRemoveDisplay(__glXExtensionInfo, dpy);
+ return XextRemoveDisplay(__glXExtensionInfo, dpy);
}
-static XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
- __GLX_NUMBER_ERRORS, error_list)
-
-static /* const */ XExtensionHooks __glXExtensionHooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- __glXCloseDisplay, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- __glXErrorString, /* error_string */
-};
+static
+XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
+ __GLX_NUMBER_ERRORS, error_list)
+
+ static /* const */ XExtensionHooks __glXExtensionHooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ __glXCloseDisplay, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ __glXErrorString, /* error_string */
+ };
static
XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
- __glXExtensionName, &__glXExtensionHooks,
- __GLX_NUMBER_EVENTS, NULL)
+ __glXExtensionName, &__glXExtensionHooks,
+ __GLX_NUMBER_EVENTS, NULL)
/************************************************************************/
-
/*
** Free the per screen configs data as well as the array of
** __glXScreenConfigs.
*/
-static void FreeScreenConfigs(__GLXdisplayPrivate *priv)
+ static void FreeScreenConfigs(__GLXdisplayPrivate * priv)
{
- __GLXscreenConfigs *psc;
- GLint i, screens;
-
- /* Free screen configuration information */
- psc = priv->screenConfigs;
- screens = ScreenCount(priv->dpy);
- for (i = 0; i < screens; i++, psc++) {
- if (psc->configs) {
- _gl_context_modes_destroy( psc->configs );
- if (psc->effectiveGLXexts)
- Xfree(psc->effectiveGLXexts);
- psc->configs = NULL; /* NOTE: just for paranoia */
- }
- if (psc->visuals) {
- _gl_context_modes_destroy( psc->visuals );
- psc->visuals = NULL; /* NOTE: just for paranoia */
- }
- Xfree((char*) psc->serverGLXexts);
+ __GLXscreenConfigs *psc;
+ GLint i, screens;
+
+ /* Free screen configuration information */
+ psc = priv->screenConfigs;
+ screens = ScreenCount(priv->dpy);
+ for (i = 0; i < screens; i++, psc++) {
+ if (psc->configs) {
+ _gl_context_modes_destroy(psc->configs);
+ if (psc->effectiveGLXexts)
+ Xfree(psc->effectiveGLXexts);
+ psc->configs = NULL; /* NOTE: just for paranoia */
+ }
+ if (psc->visuals) {
+ _gl_context_modes_destroy(psc->visuals);
+ psc->visuals = NULL; /* NOTE: just for paranoia */
+ }
+ Xfree((char *) psc->serverGLXexts);
#ifdef GLX_DIRECT_RENDERING
- if (psc->driScreen) {
- psc->driScreen->destroyScreen(psc);
- __glxHashDestroy(psc->drawHash);
- XFree(psc->driScreen);
- psc->driScreen = NULL;
- }
+ if (psc->driScreen) {
+ psc->driScreen->destroyScreen(psc);
+ __glxHashDestroy(psc->drawHash);
+ XFree(psc->driScreen);
+ psc->driScreen = NULL;
+ }
#endif
- }
- XFree((char*) priv->screenConfigs);
- priv->screenConfigs = NULL;
+ }
+ XFree((char *) priv->screenConfigs);
+ priv->screenConfigs = NULL;
}
/*
** Release the private memory referred to in a display private
** structure. The caller will free the extension structure.
*/
-static int __glXFreeDisplayPrivate(XExtData *extension)
+static int
+__glXFreeDisplayPrivate(XExtData * extension)
{
- __GLXdisplayPrivate *priv;
-
- priv = (__GLXdisplayPrivate*) extension->private_data;
- FreeScreenConfigs(priv);
- if(priv->serverGLXvendor) {
- Xfree((char*)priv->serverGLXvendor);
- priv->serverGLXvendor = 0x0; /* to protect against double free's */
- }
- if(priv->serverGLXversion) {
- Xfree((char*)priv->serverGLXversion);
- priv->serverGLXversion = 0x0; /* to protect against double free's */
- }
+ __GLXdisplayPrivate *priv;
+
+ priv = (__GLXdisplayPrivate *) extension->private_data;
+ FreeScreenConfigs(priv);
+ if (priv->serverGLXvendor) {
+ Xfree((char *) priv->serverGLXvendor);
+ priv->serverGLXvendor = 0x0; /* to protect against double free's */
+ }
+ if (priv->serverGLXversion) {
+ Xfree((char *) priv->serverGLXversion);
+ priv->serverGLXversion = 0x0; /* to protect against double free's */
+ }
#ifdef GLX_DIRECT_RENDERING
- /* Free the direct rendering per display data */
- if (priv->driswDisplay)
- (*priv->driswDisplay->destroyDisplay)(priv->driswDisplay);
- priv->driswDisplay = NULL;
-
- if (priv->driDisplay)
- (*priv->driDisplay->destroyDisplay)(priv->driDisplay);
- priv->driDisplay = NULL;
-
- if (priv->dri2Display)
- (*priv->dri2Display->destroyDisplay)(priv->dri2Display);
- priv->dri2Display = NULL;
+ /* Free the direct rendering per display data */
+ if (priv->driswDisplay)
+ (*priv->driswDisplay->destroyDisplay) (priv->driswDisplay);
+ priv->driswDisplay = NULL;
+
+ if (priv->driDisplay)
+ (*priv->driDisplay->destroyDisplay) (priv->driDisplay);
+ priv->driDisplay = NULL;
+
+ if (priv->dri2Display)
+ (*priv->dri2Display->destroyDisplay) (priv->dri2Display);
+ priv->dri2Display = NULL;
#endif
- Xfree((char*) priv);
- return 0;
+ Xfree((char *) priv);
+ return 0;
}
/************************************************************************/
@@ -216,72 +219,73 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
** Query the version of the GLX extension. This procedure works even if
** the client extension is not completely set up.
*/
-static Bool QueryVersion(Display *dpy, int opcode, int *major, int *minor)
+static Bool
+QueryVersion(Display * dpy, int opcode, int *major, int *minor)
{
- xGLXQueryVersionReq *req;
- xGLXQueryVersionReply reply;
-
- /* Send the glXQueryVersion request */
- LockDisplay(dpy);
- GetReq(GLXQueryVersion,req);
- req->reqType = opcode;
- req->glxCode = X_GLXQueryVersion;
- req->majorVersion = GLX_MAJOR_VERSION;
- req->minorVersion = GLX_MINOR_VERSION;
- _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (reply.majorVersion != GLX_MAJOR_VERSION) {
- /*
- ** The server does not support the same major release as this
- ** client.
- */
- return GL_FALSE;
- }
- *major = reply.majorVersion;
- *minor = min(reply.minorVersion, GLX_MINOR_VERSION);
- return GL_TRUE;
+ xGLXQueryVersionReq *req;
+ xGLXQueryVersionReply reply;
+
+ /* Send the glXQueryVersion request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryVersion, req);
+ req->reqType = opcode;
+ req->glxCode = X_GLXQueryVersion;
+ req->majorVersion = GLX_MAJOR_VERSION;
+ req->minorVersion = GLX_MINOR_VERSION;
+ _XReply(dpy, (xReply *) & reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (reply.majorVersion != GLX_MAJOR_VERSION) {
+ /*
+ ** The server does not support the same major release as this
+ ** client.
+ */
+ return GL_FALSE;
+ }
+ *major = reply.majorVersion;
+ *minor = min(reply.minorVersion, GLX_MINOR_VERSION);
+ return GL_TRUE;
}
-_X_HIDDEN void
-__glXInitializeVisualConfigFromTags( __GLcontextModes *config, int count,
- const INT32 *bp, Bool tagged_only,
- Bool fbconfig_style_tags )
+_X_HIDDEN void
+__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
+ const INT32 * bp, Bool tagged_only,
+ Bool fbconfig_style_tags)
{
- int i;
+ int i;
- if (!tagged_only) {
- /* Copy in the first set of properties */
- config->visualID = *bp++;
+ if (!tagged_only) {
+ /* Copy in the first set of properties */
+ config->visualID = *bp++;
- config->visualType = _gl_convert_from_x_visual_type( *bp++ );
+ config->visualType = _gl_convert_from_x_visual_type(*bp++);
- config->rgbMode = *bp++;
+ config->rgbMode = *bp++;
- config->redBits = *bp++;
- config->greenBits = *bp++;
- config->blueBits = *bp++;
- config->alphaBits = *bp++;
- config->accumRedBits = *bp++;
- config->accumGreenBits = *bp++;
- config->accumBlueBits = *bp++;
- config->accumAlphaBits = *bp++;
+ config->redBits = *bp++;
+ config->greenBits = *bp++;
+ config->blueBits = *bp++;
+ config->alphaBits = *bp++;
+ config->accumRedBits = *bp++;
+ config->accumGreenBits = *bp++;
+ config->accumBlueBits = *bp++;
+ config->accumAlphaBits = *bp++;
- config->doubleBufferMode = *bp++;
- config->stereoMode = *bp++;
+ config->doubleBufferMode = *bp++;
+ config->stereoMode = *bp++;
- config->rgbBits = *bp++;
- config->depthBits = *bp++;
- config->stencilBits = *bp++;
- config->numAuxBuffers = *bp++;
- config->level = *bp++;
+ config->rgbBits = *bp++;
+ config->depthBits = *bp++;
+ config->stencilBits = *bp++;
+ config->numAuxBuffers = *bp++;
+ config->level = *bp++;
- count -= __GLX_MIN_CONFIG_PROPS;
- }
+ count -= __GLX_MIN_CONFIG_PROPS;
+ }
- /*
+ /*
** Additional properties may be in a list at the end
** of the reply. They are in pairs of property type
** and property value.
@@ -290,491 +294,498 @@ __glXInitializeVisualConfigFromTags( __GLcontextModes *config, int count,
#define FETCH_OR_SET(tag) \
config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1
- for (i = 0; i < count; i += 2 ) {
- switch(*bp++) {
- case GLX_RGBA:
- FETCH_OR_SET( rgbMode );
- break;
- case GLX_BUFFER_SIZE:
- config->rgbBits = *bp++;
- break;
- case GLX_LEVEL:
- config->level = *bp++;
- break;
- case GLX_DOUBLEBUFFER:
- FETCH_OR_SET( doubleBufferMode );
- break;
- case GLX_STEREO:
- FETCH_OR_SET( stereoMode );
- break;
- case GLX_AUX_BUFFERS:
- config->numAuxBuffers = *bp++;
- break;
- case GLX_RED_SIZE:
- config->redBits = *bp++;
- break;
- case GLX_GREEN_SIZE:
- config->greenBits = *bp++;
- break;
- case GLX_BLUE_SIZE:
- config->blueBits = *bp++;
- break;
- case GLX_ALPHA_SIZE:
- config->alphaBits = *bp++;
- break;
- case GLX_DEPTH_SIZE:
- config->depthBits = *bp++;
- break;
- case GLX_STENCIL_SIZE:
- config->stencilBits = *bp++;
- break;
- case GLX_ACCUM_RED_SIZE:
- config->accumRedBits = *bp++;
- break;
- case GLX_ACCUM_GREEN_SIZE:
- config->accumGreenBits = *bp++;
- break;
- case GLX_ACCUM_BLUE_SIZE:
- config->accumBlueBits = *bp++;
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- config->accumAlphaBits = *bp++;
- break;
- case GLX_VISUAL_CAVEAT_EXT:
- config->visualRating = *bp++;
- break;
- case GLX_X_VISUAL_TYPE:
- config->visualType = *bp++;
- break;
- case GLX_TRANSPARENT_TYPE:
- config->transparentPixel = *bp++;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE:
- config->transparentIndex = *bp++;
- break;
- case GLX_TRANSPARENT_RED_VALUE:
- config->transparentRed = *bp++;
- break;
- case GLX_TRANSPARENT_GREEN_VALUE:
- config->transparentGreen = *bp++;
- break;
- case GLX_TRANSPARENT_BLUE_VALUE:
- config->transparentBlue = *bp++;
- break;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- config->transparentAlpha = *bp++;
- break;
- case GLX_VISUAL_ID:
- config->visualID = *bp++;
- break;
- case GLX_DRAWABLE_TYPE:
- config->drawableType = *bp++;
- break;
- case GLX_RENDER_TYPE:
- config->renderType = *bp++;
- break;
- case GLX_X_RENDERABLE:
- config->xRenderable = *bp++;
- break;
- case GLX_FBCONFIG_ID:
- config->fbconfigID = *bp++;
- break;
- case GLX_MAX_PBUFFER_WIDTH:
- config->maxPbufferWidth = *bp++;
- break;
- case GLX_MAX_PBUFFER_HEIGHT:
- config->maxPbufferHeight = *bp++;
- break;
- case GLX_MAX_PBUFFER_PIXELS:
- config->maxPbufferPixels = *bp++;
- break;
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- config->optimalPbufferWidth = *bp++;
- break;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- config->optimalPbufferHeight = *bp++;
- break;
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- config->visualSelectGroup = *bp++;
- break;
- case GLX_SWAP_METHOD_OML:
- config->swapMethod = *bp++;
- break;
- case GLX_SAMPLE_BUFFERS_SGIS:
- config->sampleBuffers = *bp++;
- break;
- case GLX_SAMPLES_SGIS:
- config->samples = *bp++;
- break;
- case GLX_BIND_TO_TEXTURE_RGB_EXT:
- config->bindToTextureRgb = *bp++;
- break;
- case GLX_BIND_TO_TEXTURE_RGBA_EXT:
- config->bindToTextureRgba = *bp++;
- break;
- case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
- config->bindToMipmapTexture = *bp++;
- break;
- case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
- config->bindToTextureTargets = *bp++;
- break;
- case GLX_Y_INVERTED_EXT:
- config->yInverted = *bp++;
- break;
- case None:
- i = count;
- break;
- default:
- break;
- }
- }
-
- config->renderType = (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- config->haveAccumBuffer = ((config->accumRedBits +
- config->accumGreenBits +
- config->accumBlueBits +
- config->accumAlphaBits) > 0);
- config->haveDepthBuffer = (config->depthBits > 0);
- config->haveStencilBuffer = (config->stencilBits > 0);
+ for (i = 0; i < count; i += 2) {
+ switch (*bp++) {
+ case GLX_RGBA:
+ FETCH_OR_SET(rgbMode);
+ break;
+ case GLX_BUFFER_SIZE:
+ config->rgbBits = *bp++;
+ break;
+ case GLX_LEVEL:
+ config->level = *bp++;
+ break;
+ case GLX_DOUBLEBUFFER:
+ FETCH_OR_SET(doubleBufferMode);
+ break;
+ case GLX_STEREO:
+ FETCH_OR_SET(stereoMode);
+ break;
+ case GLX_AUX_BUFFERS:
+ config->numAuxBuffers = *bp++;
+ break;
+ case GLX_RED_SIZE:
+ config->redBits = *bp++;
+ break;
+ case GLX_GREEN_SIZE:
+ config->greenBits = *bp++;
+ break;
+ case GLX_BLUE_SIZE:
+ config->blueBits = *bp++;
+ break;
+ case GLX_ALPHA_SIZE:
+ config->alphaBits = *bp++;
+ break;
+ case GLX_DEPTH_SIZE:
+ config->depthBits = *bp++;
+ break;
+ case GLX_STENCIL_SIZE:
+ config->stencilBits = *bp++;
+ break;
+ case GLX_ACCUM_RED_SIZE:
+ config->accumRedBits = *bp++;
+ break;
+ case GLX_ACCUM_GREEN_SIZE:
+ config->accumGreenBits = *bp++;
+ break;
+ case GLX_ACCUM_BLUE_SIZE:
+ config->accumBlueBits = *bp++;
+ break;
+ case GLX_ACCUM_ALPHA_SIZE:
+ config->accumAlphaBits = *bp++;
+ break;
+ case GLX_VISUAL_CAVEAT_EXT:
+ config->visualRating = *bp++;
+ break;
+ case GLX_X_VISUAL_TYPE:
+ config->visualType = *bp++;
+ break;
+ case GLX_TRANSPARENT_TYPE:
+ config->transparentPixel = *bp++;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE:
+ config->transparentIndex = *bp++;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE:
+ config->transparentRed = *bp++;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE:
+ config->transparentGreen = *bp++;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE:
+ config->transparentBlue = *bp++;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE:
+ config->transparentAlpha = *bp++;
+ break;
+ case GLX_VISUAL_ID:
+ config->visualID = *bp++;
+ break;
+ case GLX_DRAWABLE_TYPE:
+ config->drawableType = *bp++;
+ break;
+ case GLX_RENDER_TYPE:
+ config->renderType = *bp++;
+ break;
+ case GLX_X_RENDERABLE:
+ config->xRenderable = *bp++;
+ break;
+ case GLX_FBCONFIG_ID:
+ config->fbconfigID = *bp++;
+ break;
+ case GLX_MAX_PBUFFER_WIDTH:
+ config->maxPbufferWidth = *bp++;
+ break;
+ case GLX_MAX_PBUFFER_HEIGHT:
+ config->maxPbufferHeight = *bp++;
+ break;
+ case GLX_MAX_PBUFFER_PIXELS:
+ config->maxPbufferPixels = *bp++;
+ break;
+ case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+ config->optimalPbufferWidth = *bp++;
+ break;
+ case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+ config->optimalPbufferHeight = *bp++;
+ break;
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = *bp++;
+ break;
+ case GLX_SWAP_METHOD_OML:
+ config->swapMethod = *bp++;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->sampleBuffers = *bp++;
+ break;
+ case GLX_SAMPLES_SGIS:
+ config->samples = *bp++;
+ break;
+ case GLX_BIND_TO_TEXTURE_RGB_EXT:
+ config->bindToTextureRgb = *bp++;
+ break;
+ case GLX_BIND_TO_TEXTURE_RGBA_EXT:
+ config->bindToTextureRgba = *bp++;
+ break;
+ case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
+ config->bindToMipmapTexture = *bp++;
+ break;
+ case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
+ config->bindToTextureTargets = *bp++;
+ break;
+ case GLX_Y_INVERTED_EXT:
+ config->yInverted = *bp++;
+ break;
+ case None:
+ i = count;
+ break;
+ default:
+ break;
+ }
+ }
+
+ config->renderType =
+ (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+
+ config->haveAccumBuffer = ((config->accumRedBits +
+ config->accumGreenBits +
+ config->accumBlueBits +
+ config->accumAlphaBits) > 0);
+ config->haveDepthBuffer = (config->depthBits > 0);
+ config->haveStencilBuffer = (config->stencilBits > 0);
}
static __GLcontextModes *
-createConfigsFromProperties(Display *dpy, int nvisuals, int nprops,
- int screen, GLboolean tagged_only)
+createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
+ int screen, GLboolean tagged_only)
{
- INT32 buf[__GLX_TOTAL_CONFIG], *props;
- unsigned prop_size;
- __GLcontextModes *modes, *m;
- int i;
-
- if (nprops == 0)
- return NULL;
-
- /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
-
- /* Check number of properties */
- if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
- return NULL;
-
- /* Allocate memory for our config structure */
- modes = _gl_context_modes_create(nvisuals, sizeof(__GLcontextModes));
- if (!modes)
- return NULL;
-
- prop_size = nprops * __GLX_SIZE_INT32;
- if (prop_size <= sizeof(buf))
- props = buf;
- else
- props = Xmalloc(prop_size);
-
- /* Read each config structure and convert it into our format */
- m = modes;
- for (i = 0; i < nvisuals; i++) {
- _XRead(dpy, (char *)props, prop_size);
- /* Older X servers don't send this so we default it here. */
- m->drawableType = GLX_WINDOW_BIT;
- __glXInitializeVisualConfigFromTags(m, nprops, props,
- tagged_only, GL_TRUE);
- m->screen = screen;
- m = m->next;
- }
-
- if (props != buf)
- Xfree(props);
-
- return modes;
+ INT32 buf[__GLX_TOTAL_CONFIG], *props;
+ unsigned prop_size;
+ __GLcontextModes *modes, *m;
+ int i;
+
+ if (nprops == 0)
+ return NULL;
+
+ /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
+
+ /* Check number of properties */
+ if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
+ return NULL;
+
+ /* Allocate memory for our config structure */
+ modes = _gl_context_modes_create(nvisuals, sizeof(__GLcontextModes));
+ if (!modes)
+ return NULL;
+
+ prop_size = nprops * __GLX_SIZE_INT32;
+ if (prop_size <= sizeof(buf))
+ props = buf;
+ else
+ props = Xmalloc(prop_size);
+
+ /* Read each config structure and convert it into our format */
+ m = modes;
+ for (i = 0; i < nvisuals; i++) {
+ _XRead(dpy, (char *) props, prop_size);
+ /* Older X servers don't send this so we default it here. */
+ m->drawableType = GLX_WINDOW_BIT;
+ __glXInitializeVisualConfigFromTags(m, nprops, props,
+ tagged_only, GL_TRUE);
+ m->screen = screen;
+ m = m->next;
+ }
+
+ if (props != buf)
+ Xfree(props);
+
+ return modes;
}
static GLboolean
-getVisualConfigs(Display *dpy, __GLXdisplayPrivate *priv, int screen)
+getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
{
- xGLXGetVisualConfigsReq *req;
- __GLXscreenConfigs *psc;
- xGLXGetVisualConfigsReply reply;
-
- LockDisplay(dpy);
-
- psc = priv->screenConfigs + screen;
- psc->visuals = NULL;
- GetReq(GLXGetVisualConfigs, req);
- req->reqType = priv->majorOpcode;
- req->glxCode = X_GLXGetVisualConfigs;
- req->screen = screen;
-
- if (!_XReply(dpy, (xReply*) &reply, 0, False))
- goto out;
-
- psc->visuals = createConfigsFromProperties(dpy,
- reply.numVisuals,
- reply.numProps,
- screen, GL_FALSE);
+ xGLXGetVisualConfigsReq *req;
+ __GLXscreenConfigs *psc;
+ xGLXGetVisualConfigsReply reply;
+
+ LockDisplay(dpy);
+
+ psc = priv->screenConfigs + screen;
+ psc->visuals = NULL;
+ GetReq(GLXGetVisualConfigs, req);
+ req->reqType = priv->majorOpcode;
+ req->glxCode = X_GLXGetVisualConfigs;
+ req->screen = screen;
+
+ if (!_XReply(dpy, (xReply *) & reply, 0, False))
+ goto out;
+
+ psc->visuals = createConfigsFromProperties(dpy,
+ reply.numVisuals,
+ reply.numProps,
+ screen, GL_FALSE);
out:
- UnlockDisplay(dpy);
- return psc->visuals != NULL;
+ UnlockDisplay(dpy);
+ return psc->visuals != NULL;
}
static GLboolean
-getFBConfigs(Display *dpy, __GLXdisplayPrivate *priv, int screen)
+getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
{
- xGLXGetFBConfigsReq *fb_req;
- xGLXGetFBConfigsSGIXReq *sgi_req;
- xGLXVendorPrivateWithReplyReq *vpreq;
- xGLXGetFBConfigsReply reply;
- __GLXscreenConfigs *psc;
-
- psc = priv->screenConfigs + screen;
- psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode,
- X_GLXQueryServerString,
- screen, GLX_EXTENSIONS);
-
- LockDisplay(dpy);
-
- psc->configs = NULL;
- if (atof(priv->serverGLXversion) >= 1.3) {
- GetReq(GLXGetFBConfigs, fb_req);
- fb_req->reqType = priv->majorOpcode;
- fb_req->glxCode = X_GLXGetFBConfigs;
- fb_req->screen = screen;
- } else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
- GetReqExtra(GLXVendorPrivateWithReply,
- sz_xGLXGetFBConfigsSGIXReq +
- sz_xGLXVendorPrivateWithReplyReq, vpreq);
- sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
- sgi_req->reqType = priv->majorOpcode;
- sgi_req->glxCode = X_GLXVendorPrivateWithReply;
- sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
- sgi_req->screen = screen;
- } else
- goto out;
-
- if (!_XReply(dpy, (xReply*) &reply, 0, False))
- goto out;
-
- psc->configs = createConfigsFromProperties(dpy,
- reply.numFBConfigs,
- reply.numAttribs * 2,
- screen, GL_TRUE);
+ xGLXGetFBConfigsReq *fb_req;
+ xGLXGetFBConfigsSGIXReq *sgi_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXGetFBConfigsReply reply;
+ __GLXscreenConfigs *psc;
+
+ psc = priv->screenConfigs + screen;
+ psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode,
+ X_GLXQueryServerString,
+ screen, GLX_EXTENSIONS);
+
+ LockDisplay(dpy);
+
+ psc->configs = NULL;
+ if (atof(priv->serverGLXversion) >= 1.3) {
+ GetReq(GLXGetFBConfigs, fb_req);
+ fb_req->reqType = priv->majorOpcode;
+ fb_req->glxCode = X_GLXGetFBConfigs;
+ fb_req->screen = screen;
+ }
+ else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXGetFBConfigsSGIXReq +
+ sz_xGLXVendorPrivateWithReplyReq, vpreq);
+ sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
+ sgi_req->reqType = priv->majorOpcode;
+ sgi_req->glxCode = X_GLXVendorPrivateWithReply;
+ sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
+ sgi_req->screen = screen;
+ }
+ else
+ goto out;
+
+ if (!_XReply(dpy, (xReply *) & reply, 0, False))
+ goto out;
+
+ psc->configs = createConfigsFromProperties(dpy,
+ reply.numFBConfigs,
+ reply.numAttribs * 2,
+ screen, GL_TRUE);
out:
- UnlockDisplay(dpy);
- return psc->configs != NULL;
+ UnlockDisplay(dpy);
+ return psc->configs != NULL;
}
/*
** Allocate the memory for the per screen configs for each screen.
** If that works then fetch the per screen configs data.
*/
-static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
+static Bool
+AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
{
- __GLXscreenConfigs *psc;
- GLint i, screens;
+ __GLXscreenConfigs *psc;
+ GLint i, screens;
- /*
+ /*
** First allocate memory for the array of per screen configs.
*/
- screens = ScreenCount(dpy);
- psc = (__GLXscreenConfigs*) Xmalloc(screens * sizeof(__GLXscreenConfigs));
- if (!psc) {
- return GL_FALSE;
- }
- memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
- priv->screenConfigs = psc;
-
- priv->serverGLXversion = __glXGetStringFromServer(dpy, priv->majorOpcode,
- X_GLXQueryServerString,
- 0, GLX_VERSION);
- if ( priv->serverGLXversion == NULL ) {
- FreeScreenConfigs(priv);
- return GL_FALSE;
- }
-
- for (i = 0; i < screens; i++, psc++) {
- getVisualConfigs(dpy, priv, i);
- getFBConfigs(dpy, priv, i);
+ screens = ScreenCount(dpy);
+ psc = (__GLXscreenConfigs *) Xmalloc(screens * sizeof(__GLXscreenConfigs));
+ if (!psc) {
+ return GL_FALSE;
+ }
+ memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
+ priv->screenConfigs = psc;
+
+ priv->serverGLXversion = __glXGetStringFromServer(dpy, priv->majorOpcode,
+ X_GLXQueryServerString,
+ 0, GLX_VERSION);
+ if (priv->serverGLXversion == NULL) {
+ FreeScreenConfigs(priv);
+ return GL_FALSE;
+ }
+
+ for (i = 0; i < screens; i++, psc++) {
+ getVisualConfigs(dpy, priv, i);
+ getFBConfigs(dpy, priv, i);
#ifdef GLX_DIRECT_RENDERING
- psc->scr = i;
- psc->dpy = dpy;
- psc->drawHash = __glxHashCreate();
- if (psc->drawHash == NULL)
- continue;
+ psc->scr = i;
+ psc->dpy = dpy;
+ psc->drawHash = __glxHashCreate();
+ if (psc->drawHash == NULL)
+ continue;
- if (priv->dri2Display)
- psc->driScreen = (*priv->dri2Display->createScreen)(psc, i, priv);
+ if (priv->dri2Display)
+ psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv);
- if (psc->driScreen == NULL && priv->driDisplay)
- psc->driScreen = (*priv->driDisplay->createScreen)(psc, i, priv);
+ if (psc->driScreen == NULL && priv->driDisplay)
+ psc->driScreen = (*priv->driDisplay->createScreen) (psc, i, priv);
- if (psc->driScreen == NULL && priv->driswDisplay)
- psc->driScreen = (*priv->driswDisplay->createScreen)(psc, i, priv);
+ if (psc->driScreen == NULL && priv->driswDisplay)
+ psc->driScreen = (*priv->driswDisplay->createScreen) (psc, i, priv);
- if (psc->driScreen == NULL) {
- __glxHashDestroy(psc->drawHash);
- psc->drawHash = NULL;
- }
+ if (psc->driScreen == NULL) {
+ __glxHashDestroy(psc->drawHash);
+ psc->drawHash = NULL;
+ }
#endif
- }
- SyncHandle();
- return GL_TRUE;
+ }
+ SyncHandle();
+ return GL_TRUE;
}
/*
** Initialize the client side extension code.
*/
-_X_HIDDEN __GLXdisplayPrivate *__glXInitialize(Display* dpy)
+_X_HIDDEN __GLXdisplayPrivate *
+__glXInitialize(Display * dpy)
{
- XExtDisplayInfo *info = __glXFindDisplay(dpy);
- XExtData **privList, *private, *found;
- __GLXdisplayPrivate *dpyPriv;
- XEDataObject dataObj;
- int major, minor;
+ XExtDisplayInfo *info = __glXFindDisplay(dpy);
+ XExtData **privList, *private, *found;
+ __GLXdisplayPrivate *dpyPriv;
+ XEDataObject dataObj;
+ int major, minor;
#ifdef GLX_DIRECT_RENDERING
- Bool glx_direct, glx_accel;
+ Bool glx_direct, glx_accel;
#endif
#if defined(USE_XTHREADS)
- {
- static int firstCall = 1;
- if (firstCall) {
- /* initialize the GLX mutexes */
- xmutex_init(&__glXmutex);
- firstCall = 0;
- }
- }
+ {
+ static int firstCall = 1;
+ if (firstCall) {
+ /* initialize the GLX mutexes */
+ xmutex_init(&__glXmutex);
+ firstCall = 0;
+ }
+ }
#endif
- INIT_MESA_SPARC
- /* The one and only long long lock */
- __glXLock();
-
- if (!XextHasExtension(info)) {
- /* No GLX extension supported by this server. Oh well. */
- __glXUnlock();
- XMissingExtension(dpy, __glXExtensionName);
- return 0;
- }
-
- /* See if a display private already exists. If so, return it */
- dataObj.display = dpy;
- privList = XEHeadOfExtensionList(dataObj);
- found = XFindOnExtensionList(privList, info->codes->extension);
- if (found) {
- __glXUnlock();
- return (__GLXdisplayPrivate *) found->private_data;
- }
-
- /* See if the versions are compatible */
- if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) {
- /* The client and server do not agree on versions. Punt. */
- __glXUnlock();
- return 0;
- }
-
- /*
+ INIT_MESA_SPARC;
+ /* The one and only long long lock */
+ __glXLock();
+
+ if (!XextHasExtension(info)) {
+ /* No GLX extension supported by this server. Oh well. */
+ __glXUnlock();
+ XMissingExtension(dpy, __glXExtensionName);
+ return 0;
+ }
+
+ /* See if a display private already exists. If so, return it */
+ dataObj.display = dpy;
+ privList = XEHeadOfExtensionList(dataObj);
+ found = XFindOnExtensionList(privList, info->codes->extension);
+ if (found) {
+ __glXUnlock();
+ return (__GLXdisplayPrivate *) found->private_data;
+ }
+
+ /* See if the versions are compatible */
+ if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) {
+ /* The client and server do not agree on versions. Punt. */
+ __glXUnlock();
+ return 0;
+ }
+
+ /*
** Allocate memory for all the pieces needed for this buffer.
*/
- private = (XExtData *) Xmalloc(sizeof(XExtData));
- if (!private) {
- __glXUnlock();
- return 0;
- }
- dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
- if (!dpyPriv) {
- __glXUnlock();
- Xfree((char*) private);
- return 0;
- }
-
- /*
+ private = (XExtData *) Xmalloc(sizeof(XExtData));
+ if (!private) {
+ __glXUnlock();
+ return 0;
+ }
+ dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
+ if (!dpyPriv) {
+ __glXUnlock();
+ Xfree((char *) private);
+ return 0;
+ }
+
+ /*
** Init the display private and then read in the screen config
** structures from the server.
*/
- dpyPriv->majorOpcode = info->codes->major_opcode;
- dpyPriv->majorVersion = major;
- dpyPriv->minorVersion = minor;
- dpyPriv->dpy = dpy;
+ dpyPriv->majorOpcode = info->codes->major_opcode;
+ dpyPriv->majorVersion = major;
+ dpyPriv->minorVersion = minor;
+ dpyPriv->dpy = dpy;
- dpyPriv->serverGLXvendor = 0x0;
- dpyPriv->serverGLXversion = 0x0;
+ dpyPriv->serverGLXvendor = 0x0;
+ dpyPriv->serverGLXversion = 0x0;
#ifdef GLX_DIRECT_RENDERING
- glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
- glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
+ glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
+ glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
- /*
+ /*
** Initialize the direct rendering per display data and functions.
** Note: This _must_ be done before calling any other DRI routines
** (e.g., those called in AllocAndFetchScreenConfigs).
*/
- if (glx_direct && glx_accel) {
- dpyPriv->dri2Display = dri2CreateDisplay(dpy);
- dpyPriv->driDisplay = driCreateDisplay(dpy);
- }
- if (glx_direct)
- dpyPriv->driswDisplay = driswCreateDisplay(dpy);
+ if (glx_direct && glx_accel) {
+ dpyPriv->dri2Display = dri2CreateDisplay(dpy);
+ dpyPriv->driDisplay = driCreateDisplay(dpy);
+ }
+ if (glx_direct)
+ dpyPriv->driswDisplay = driswCreateDisplay(dpy);
#endif
- if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
- __glXUnlock();
- Xfree((char*) dpyPriv);
- Xfree((char*) private);
- return 0;
- }
+ if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
+ __glXUnlock();
+ Xfree((char *) dpyPriv);
+ Xfree((char *) private);
+ return 0;
+ }
- /*
+ /*
** Fill in the private structure. This is the actual structure that
** hangs off of the Display structure. Our private structure is
** referred to by this structure. Got that?
*/
- private->number = info->codes->extension;
- private->next = 0;
- private->free_private = __glXFreeDisplayPrivate;
- private->private_data = (char *) dpyPriv;
- XAddToExtensionList(privList, private);
-
- if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) {
- __glXClientInfo(dpy, dpyPriv->majorOpcode);
- }
- __glXUnlock();
-
- return dpyPriv;
+ private->number = info->codes->extension;
+ private->next = 0;
+ private->free_private = __glXFreeDisplayPrivate;
+ private->private_data = (char *) dpyPriv;
+ XAddToExtensionList(privList, private);
+
+ if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) {
+ __glXClientInfo(dpy, dpyPriv->majorOpcode);
+ }
+ __glXUnlock();
+
+ return dpyPriv;
}
/*
** Setup for sending a GLX command on dpy. Make sure the extension is
** initialized. Try to avoid calling __glXInitialize as its kinda slow.
*/
-_X_HIDDEN CARD8 __glXSetupForCommand(Display *dpy)
+_X_HIDDEN CARD8
+__glXSetupForCommand(Display * dpy)
{
- GLXContext gc;
- __GLXdisplayPrivate *priv;
-
- /* If this thread has a current context, flush its rendering commands */
- gc = __glXGetCurrentContext();
- if (gc->currentDpy) {
- /* Flush rendering buffer of the current context, if any */
- (void) __glXFlushRenderBuffer(gc, gc->pc);
-
- if (gc->currentDpy == dpy) {
- /* Use opcode from gc because its right */
- INIT_MESA_SPARC
- return gc->majorOpcode;
- } else {
- /*
- ** Have to get info about argument dpy because it might be to
- ** a different server
- */
- }
- }
-
- /* Forced to lookup extension via the slow initialize route */
- priv = __glXInitialize(dpy);
- if (!priv) {
- return 0;
- }
- return priv->majorOpcode;
+ GLXContext gc;
+ __GLXdisplayPrivate *priv;
+
+ /* If this thread has a current context, flush its rendering commands */
+ gc = __glXGetCurrentContext();
+ if (gc->currentDpy) {
+ /* Flush rendering buffer of the current context, if any */
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+
+ if (gc->currentDpy == dpy) {
+ /* Use opcode from gc because its right */
+ INIT_MESA_SPARC;
+ return gc->majorOpcode;
+ }
+ else {
+ /*
+ ** Have to get info about argument dpy because it might be to
+ ** a different server
+ */
+ }
+ }
+
+ /* Forced to lookup extension via the slow initialize route */
+ priv = __glXInitialize(dpy);
+ if (!priv) {
+ return 0;
+ }
+ return priv->majorOpcode;
}
/**
@@ -787,37 +798,38 @@ _X_HIDDEN CARD8 __glXSetupForCommand(Display *dpy)
* Modify this function to use \c ctx->pc instead of the explicit
* \c pc parameter.
*/
-_X_HIDDEN GLubyte *__glXFlushRenderBuffer(__GLXcontext *ctx, GLubyte *pc)
+_X_HIDDEN GLubyte *
+__glXFlushRenderBuffer(__GLXcontext * ctx, GLubyte * pc)
{
- Display * const dpy = ctx->currentDpy;
+ Display *const dpy = ctx->currentDpy;
#ifdef USE_XCB
- xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_connection_t *c = XGetXCBConnection(dpy);
#else
- xGLXRenderReq *req;
+ xGLXRenderReq *req;
#endif /* USE_XCB */
- const GLint size = pc - ctx->buf;
+ const GLint size = pc - ctx->buf;
- if ( (dpy != NULL) && (size > 0) ) {
+ if ((dpy != NULL) && (size > 0)) {
#ifdef USE_XCB
- xcb_glx_render(c, ctx->currentContextTag, size,
- (const uint8_t *)ctx->buf);
+ xcb_glx_render(c, ctx->currentContextTag, size,
+ (const uint8_t *) ctx->buf);
#else
- /* Send the entire buffer as an X request */
- LockDisplay(dpy);
- GetReq(GLXRender,req);
- req->reqType = ctx->majorOpcode;
- req->glxCode = X_GLXRender;
- req->contextTag = ctx->currentContextTag;
- req->length += (size + 3) >> 2;
- _XSend(dpy, (char *)ctx->buf, size);
- UnlockDisplay(dpy);
- SyncHandle();
+ /* Send the entire buffer as an X request */
+ LockDisplay(dpy);
+ GetReq(GLXRender, req);
+ req->reqType = ctx->majorOpcode;
+ req->glxCode = X_GLXRender;
+ req->contextTag = ctx->currentContextTag;
+ req->length += (size + 3) >> 2;
+ _XSend(dpy, (char *) ctx->buf, size);
+ UnlockDisplay(dpy);
+ SyncHandle();
#endif
- }
+ }
- /* Reset pointer and return it */
- ctx->pc = ctx->buf;
- return ctx->pc;
+ /* Reset pointer and return it */
+ ctx->pc = ctx->buf;
+ return ctx->pc;
}
@@ -837,35 +849,36 @@ _X_HIDDEN GLubyte *__glXFlushRenderBuffer(__GLXcontext *ctx, GLubyte *pc)
* \param data Command data.
* \param dataLen Size, in bytes, of the command data.
*/
-_X_HIDDEN void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber,
- GLint totalRequests,
- const GLvoid * data, GLint dataLen)
+_X_HIDDEN void
+__glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
+ GLint totalRequests, const GLvoid * data, GLint dataLen)
{
- Display *dpy = gc->currentDpy;
+ Display *dpy = gc->currentDpy;
#ifdef USE_XCB
- xcb_connection_t *c = XGetXCBConnection(dpy);
- xcb_glx_render_large(c, gc->currentContextTag, requestNumber, totalRequests, dataLen, data);
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_glx_render_large(c, gc->currentContextTag, requestNumber,
+ totalRequests, dataLen, data);
#else
- xGLXRenderLargeReq *req;
-
- if ( requestNumber == 1 ) {
- LockDisplay(dpy);
- }
-
- GetReq(GLXRenderLarge,req);
- req->reqType = gc->majorOpcode;
- req->glxCode = X_GLXRenderLarge;
- req->contextTag = gc->currentContextTag;
- req->length += (dataLen + 3) >> 2;
- req->requestNumber = requestNumber;
- req->requestTotal = totalRequests;
- req->dataBytes = dataLen;
- Data(dpy, data, dataLen);
-
- if ( requestNumber == totalRequests ) {
- UnlockDisplay(dpy);
- SyncHandle();
- }
+ xGLXRenderLargeReq *req;
+
+ if (requestNumber == 1) {
+ LockDisplay(dpy);
+ }
+
+ GetReq(GLXRenderLarge, req);
+ req->reqType = gc->majorOpcode;
+ req->glxCode = X_GLXRenderLarge;
+ req->contextTag = gc->currentContextTag;
+ req->length += (dataLen + 3) >> 2;
+ req->requestNumber = requestNumber;
+ req->requestTotal = totalRequests;
+ req->dataBytes = dataLen;
+ Data(dpy, data, dataLen);
+
+ if (requestNumber == totalRequests) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
#endif /* USE_XCB */
}
@@ -885,65 +898,69 @@ _X_HIDDEN void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber,
* \param data Command data.
* \param dataLen Size, in bytes, of the command data.
*/
-_X_HIDDEN void __glXSendLargeCommand(__GLXcontext *ctx,
- const GLvoid *header, GLint headerLen,
- const GLvoid *data, GLint dataLen)
+_X_HIDDEN void
+__glXSendLargeCommand(__GLXcontext * ctx,
+ const GLvoid * header, GLint headerLen,
+ const GLvoid * data, GLint dataLen)
{
- GLint maxSize;
- GLint totalRequests, requestNumber;
+ GLint maxSize;
+ GLint totalRequests, requestNumber;
- /*
+ /*
** Calculate the maximum amount of data can be stuffed into a single
** packet. sz_xGLXRenderReq is added because bufSize is the maximum
** packet size minus sz_xGLXRenderReq.
*/
- maxSize = (ctx->bufSize + sz_xGLXRenderReq) - sz_xGLXRenderLargeReq;
- totalRequests = 1 + (dataLen / maxSize);
- if (dataLen % maxSize) totalRequests++;
+ maxSize = (ctx->bufSize + sz_xGLXRenderReq) - sz_xGLXRenderLargeReq;
+ totalRequests = 1 + (dataLen / maxSize);
+ if (dataLen % maxSize)
+ totalRequests++;
- /*
+ /*
** Send all of the command, except the large array, as one request.
*/
- assert( headerLen <= maxSize );
- __glXSendLargeChunk(ctx, 1, totalRequests, header, headerLen);
+ assert(headerLen <= maxSize);
+ __glXSendLargeChunk(ctx, 1, totalRequests, header, headerLen);
- /*
+ /*
** Send enough requests until the whole array is sent.
*/
- for ( requestNumber = 2 ; requestNumber <= (totalRequests - 1) ; requestNumber++ ) {
- __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, maxSize);
- data = (const GLvoid *) (((const GLubyte *) data) + maxSize);
- dataLen -= maxSize;
- assert( dataLen > 0 );
- }
-
- assert( dataLen <= maxSize );
- __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, dataLen);
+ for (requestNumber = 2; requestNumber <= (totalRequests - 1);
+ requestNumber++) {
+ __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, maxSize);
+ data = (const GLvoid *) (((const GLubyte *) data) + maxSize);
+ dataLen -= maxSize;
+ assert(dataLen > 0);
+ }
+
+ assert(dataLen <= maxSize);
+ __glXSendLargeChunk(ctx, requestNumber, totalRequests, data, dataLen);
}
/************************************************************************/
#ifdef DEBUG
-_X_HIDDEN void __glXDumpDrawBuffer(__GLXcontext *ctx)
+_X_HIDDEN void
+__glXDumpDrawBuffer(__GLXcontext * ctx)
{
- GLubyte *p = ctx->buf;
- GLubyte *end = ctx->pc;
- GLushort opcode, length;
-
- while (p < end) {
- /* Fetch opcode */
- opcode = *((GLushort*) p);
- length = *((GLushort*) (p + 2));
- printf("%2x: %5d: ", opcode, length);
- length -= 4;
- p += 4;
- while (length > 0) {
- printf("%08x ", *((unsigned *) p));
- p += 4;
- length -= 4;
- }
- printf("\n");
- }
+ GLubyte *p = ctx->buf;
+ GLubyte *end = ctx->pc;
+ GLushort opcode, length;
+
+ while (p < end) {
+ /* Fetch opcode */
+ opcode = *((GLushort *) p);
+ length = *((GLushort *) (p + 2));
+ printf("%2x: %5d: ", opcode, length);
+ length -= 4;
+ p += 4;
+ while (length > 0) {
+ printf("%08x ", *((unsigned *) p));
+ p += 4;
+ length -= 4;
+ }
+ printf("\n");
+ }
}
#endif
@@ -970,29 +987,29 @@ extern void __glapi_sparc_icache_flush(unsigned int *);
static void
_glx_mesa_init_sparc_glapi_relocs(void)
{
- unsigned int *insn_ptr, *end_ptr;
- unsigned long disp_addr;
-
- insn_ptr = &_mesa_sparc_glapi_begin;
- end_ptr = &_mesa_sparc_glapi_end;
- disp_addr = (unsigned long) &_glapi_Dispatch;
-
- /*
- * Verbatim from Mesa sparc.c. It's needed because there doesn't
- * seem to be a better way to do this:
- *
- * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
- *
- * This code is patching in the ADDRESS of the pointer to the
- * dispatch table. Hence, it must be called exactly once, because
- * that address is not going to change.
- *
- * What it points to can change, but Mesa (and hence, we) assume
- * that there is only one pointer.
- *
- */
- while (insn_ptr < end_ptr) {
-#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )
+ unsigned int *insn_ptr, *end_ptr;
+ unsigned long disp_addr;
+
+ insn_ptr = &_mesa_sparc_glapi_begin;
+ end_ptr = &_mesa_sparc_glapi_end;
+ disp_addr = (unsigned long) &_glapi_Dispatch;
+
+ /*
+ * Verbatim from Mesa sparc.c. It's needed because there doesn't
+ * seem to be a better way to do this:
+ *
+ * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
+ *
+ * This code is patching in the ADDRESS of the pointer to the
+ * dispatch table. Hence, it must be called exactly once, because
+ * that address is not going to change.
+ *
+ * What it points to can change, but Mesa (and hence, we) assume
+ * that there is only one pointer.
+ *
+ */
+ while (insn_ptr < end_ptr) {
+#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )
/*
This code patches for 64-bit addresses. This had better
not happen for Sparc/Linux, no matter what architecture we
@@ -1001,20 +1018,19 @@ _glx_mesa_init_sparc_glapi_relocs(void)
The 'defined(__linux_64__)' is used here as a placeholder for
when we do do 64-bit usermode on sparc linux.
*/
- insn_ptr[0] |= (disp_addr >> (32 + 10));
- insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
- insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[2]);
- insn_ptr += 11;
+ insn_ptr[0] |= (disp_addr >> (32 + 10));
+ insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
+ __glapi_sparc_icache_flush(&insn_ptr[0]);
+ insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
+ insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&insn_ptr[2]);
+ insn_ptr += 11;
#else
- insn_ptr[0] |= (disp_addr >> 10);
- insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr += 5;
+ insn_ptr[0] |= (disp_addr >> 10);
+ insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
+ __glapi_sparc_icache_flush(&insn_ptr[0]);
+ insn_ptr += 5;
#endif
- }
+ }
}
-#endif /* sparc ASM in use */
-
+#endif /* sparc ASM in use */
diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c
index f2b169a0e4..92109d67bf 100644
--- a/src/glx/x11/glxextensions.c
+++ b/src/glx/x11/glxextensions.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2002, 2004
* All Rights Reserved.
@@ -48,27 +49,29 @@
#define EXT_ENABLED(bit,supported) (IS_SET( supported, bit ))
-struct extension_info {
- const char * const name;
- unsigned name_len;
+struct extension_info
+{
+ const char *const name;
+ unsigned name_len;
- unsigned char bit;
+ unsigned char bit;
/* This is the lowest version of GLX that "requires" this extension.
* For example, GLX 1.3 requires SGIX_fbconfig, SGIX_pbuffer, and
* SGI_make_current_read. If the extension is not required by any known
* version of GLX, use 0, 0.
*/
- unsigned char version_major;
- unsigned char version_minor;
- unsigned char client_support;
- unsigned char direct_support;
- unsigned char client_only; /** Is the extension client-side only? */
- unsigned char direct_only; /** Is the extension for direct
+ unsigned char version_major;
+ unsigned char version_minor;
+ unsigned char client_support;
+ unsigned char direct_support;
+ unsigned char client_only; /** Is the extension client-side only? */
+ unsigned char direct_only; /** Is the extension for direct
* contexts only?
*/
};
+/* *INDENT-OFF* */
static const struct extension_info known_glx_extensions[] = {
{ GLX(ARB_get_proc_address), VER(1,4), Y, N, Y, N },
{ GLX(ARB_multisample), VER(1,4), Y, Y, N, N },
@@ -245,14 +248,15 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(SUN_slice_accum), VER(0,0), Y, N, N, N },
{ NULL }
};
+/* *INDENT-ON* */
/* global bit-fields of available extensions and their characteristics */
static unsigned char client_glx_support[8];
static unsigned char client_glx_only[8];
static unsigned char direct_glx_only[8];
-static unsigned char client_gl_support[ __GL_EXT_BYTES ];
-static unsigned char client_gl_only[ __GL_EXT_BYTES ];
+static unsigned char client_gl_support[__GL_EXT_BYTES];
+static unsigned char client_gl_only[__GL_EXT_BYTES];
/**
* Bits representing the set of extensions that are enabled by default in all
@@ -267,12 +271,13 @@ static const unsigned gl_major = 1;
static const unsigned gl_minor = 4;
/* client extensions string */
-static const char * __glXGLXClientExtensions = NULL;
+static const char *__glXGLXClientExtensions = NULL;
-static void __glXExtensionsCtr( void );
-static void __glXExtensionsCtrScreen( __GLXscreenConfigs *psc );
-static void __glXProcessServerString( const struct extension_info * ext,
- const char * server_string, unsigned char * server_support );
+static void __glXExtensionsCtr(void);
+static void __glXExtensionsCtrScreen(__GLXscreenConfigs * psc);
+static void __glXProcessServerString(const struct extension_info *ext,
+ const char *server_string,
+ unsigned char *server_support);
/**
* Set the state of a GLX extension.
@@ -283,24 +288,24 @@ static void __glXProcessServerString( const struct extension_info * ext,
* \param supported Table in which the state of the extension is to be set.
*/
static void
-set_glx_extension( const struct extension_info * ext,
- const char * name, unsigned name_len, GLboolean state,
- unsigned char * supported )
+set_glx_extension(const struct extension_info *ext,
+ const char *name, unsigned name_len, GLboolean state,
+ unsigned char *supported)
{
- unsigned i;
+ unsigned i;
- for ( i = 0 ; ext[i].name != NULL ; i++ ) {
- if ( (name_len == ext[i].name_len)
- && (strncmp( ext[i].name, name, name_len ) == 0) ) {
- if ( state ) {
- SET_BIT( supported, ext[i].bit );
- }
- else {
- CLR_BIT( supported, ext[i].bit );
- }
+ for (i = 0; ext[i].name != NULL; i++) {
+ if ((name_len == ext[i].name_len)
+ && (strncmp(ext[i].name, name, name_len) == 0)) {
+ if (state) {
+ SET_BIT(supported, ext[i].bit);
+ }
+ else {
+ CLR_BIT(supported, ext[i].bit);
+ }
- return;
+ return;
}
}
}
@@ -321,49 +326,47 @@ set_glx_extension( const struct extension_info * ext,
* the data pointed by \c server_support must be preinitialized to zero.
*/
static void
-__glXProcessServerString( const struct extension_info * ext,
- const char * server_string,
- unsigned char * server_support )
+__glXProcessServerString(const struct extension_info *ext,
+ const char *server_string,
+ unsigned char *server_support)
{
- unsigned base;
- unsigned len;
+ unsigned base;
+ unsigned len;
- for ( base = 0 ; server_string[ base ] != NUL ; /* empty */ ) {
+ for (base = 0; server_string[base] != NUL; /* empty */ ) {
/* Determine the length of the next extension name.
*/
- for ( len = 0
- ; (server_string[ base + len ] != SEPARATOR)
- && (server_string[ base + len ] != NUL)
- ; len++ ) {
- /* empty */
+ for (len = 0; (server_string[base + len] != SEPARATOR)
+ && (server_string[base + len] != NUL);
+ len++) {
+ /* empty */
}
/* Set the bit for the extension in the server_support table.
*/
- set_glx_extension( ext, & server_string[ base ], len, GL_TRUE,
- server_support );
+ set_glx_extension(ext, &server_string[base], len, GL_TRUE,
+ server_support);
+
-
/* Advance to the next extension string. This means that we skip
* over the previous string and any trialing white-space.
*/
- for ( base += len ;
- (server_string[ base ] == SEPARATOR)
- && (server_string[ base ] != NUL)
- ; base++ ) {
- /* empty */
+ for (base += len; (server_string[base] == SEPARATOR)
+ && (server_string[base] != NUL);
+ base++) {
+ /* empty */
}
}
}
void
-__glXEnableDirectExtension(__GLXscreenConfigs *psc, const char *name)
+__glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
{
- __glXExtensionsCtr();
- __glXExtensionsCtrScreen(psc);
+ __glXExtensionsCtr();
+ __glXExtensionsCtrScreen(psc);
- set_glx_extension(known_glx_extensions,
- name, strlen(name), GL_TRUE, psc->direct_support);
+ set_glx_extension(known_glx_extensions,
+ name, strlen(name), GL_TRUE, psc->direct_support);
}
/**
@@ -371,58 +374,58 @@ __glXEnableDirectExtension(__GLXscreenConfigs *psc, const char *name)
*/
static void
-__glXExtensionsCtr( void )
+__glXExtensionsCtr(void)
{
- unsigned i;
+ unsigned i;
static GLboolean ext_list_first_time = GL_TRUE;
- if ( ext_list_first_time ) {
+ if (ext_list_first_time) {
ext_list_first_time = GL_FALSE;
- (void) memset( client_glx_support, 0, sizeof( client_glx_support ) );
- (void) memset( direct_glx_support, 0, sizeof( direct_glx_support ) );
- (void) memset( client_glx_only, 0, sizeof( client_glx_only ) );
- (void) memset( direct_glx_only, 0, sizeof( direct_glx_only ) );
+ (void) memset(client_glx_support, 0, sizeof(client_glx_support));
+ (void) memset(direct_glx_support, 0, sizeof(direct_glx_support));
+ (void) memset(client_glx_only, 0, sizeof(client_glx_only));
+ (void) memset(direct_glx_only, 0, sizeof(direct_glx_only));
- (void) memset( client_gl_support, 0, sizeof( client_gl_support ) );
- (void) memset( client_gl_only, 0, sizeof( client_gl_only ) );
+ (void) memset(client_gl_support, 0, sizeof(client_gl_support));
+ (void) memset(client_gl_only, 0, sizeof(client_gl_only));
- for ( i = 0 ; known_glx_extensions[i].name != NULL ; i++ ) {
- const unsigned bit = known_glx_extensions[i].bit;
+ for (i = 0; known_glx_extensions[i].name != NULL; i++) {
+ const unsigned bit = known_glx_extensions[i].bit;
- if ( known_glx_extensions[i].client_support ) {
- SET_BIT( client_glx_support, bit );
- }
+ if (known_glx_extensions[i].client_support) {
+ SET_BIT(client_glx_support, bit);
+ }
- if ( known_glx_extensions[i].direct_support ) {
- SET_BIT( direct_glx_support, bit );
- }
+ if (known_glx_extensions[i].direct_support) {
+ SET_BIT(direct_glx_support, bit);
+ }
- if ( known_glx_extensions[i].client_only ) {
- SET_BIT( client_glx_only, bit );
- }
+ if (known_glx_extensions[i].client_only) {
+ SET_BIT(client_glx_only, bit);
+ }
- if ( known_glx_extensions[i].direct_only ) {
- SET_BIT( direct_glx_only, bit );
- }
+ if (known_glx_extensions[i].direct_only) {
+ SET_BIT(direct_glx_only, bit);
+ }
}
- for ( i = 0 ; known_gl_extensions[i].name != NULL ; i++ ) {
- const unsigned bit = known_gl_extensions[i].bit;
+ for (i = 0; known_gl_extensions[i].name != NULL; i++) {
+ const unsigned bit = known_gl_extensions[i].bit;
- if ( known_gl_extensions[i].client_support ) {
- SET_BIT( client_gl_support, bit );
- }
+ if (known_gl_extensions[i].client_support) {
+ SET_BIT(client_gl_support, bit);
+ }
- if ( known_gl_extensions[i].client_only ) {
- SET_BIT( client_gl_only, bit );
- }
+ if (known_gl_extensions[i].client_only) {
+ SET_BIT(client_gl_only, bit);
+ }
}
-
+
#if 0
- fprintf( stderr, "[%s:%u] Maximum client library version: %u.%u\n",
- __func__, __LINE__, gl_major, gl_minor );
+ fprintf(stderr, "[%s:%u] Maximum client library version: %u.%u\n",
+ __func__, __LINE__, gl_major, gl_minor);
#endif
}
}
@@ -435,13 +438,13 @@ __glXExtensionsCtr( void )
*/
static void
-__glXExtensionsCtrScreen( __GLXscreenConfigs *psc )
+__glXExtensionsCtrScreen(__GLXscreenConfigs * psc)
{
- if (psc->ext_list_first_time) {
- psc->ext_list_first_time = GL_FALSE;
- (void) memcpy( psc->direct_support, direct_glx_support,
- sizeof( direct_glx_support ) );
- }
+ if (psc->ext_list_first_time) {
+ psc->ext_list_first_time = GL_FALSE;
+ (void) memcpy(psc->direct_support, direct_glx_support,
+ sizeof(direct_glx_support));
+ }
}
@@ -455,14 +458,14 @@ __glXExtensionsCtrScreen( __GLXscreenConfigs *psc )
* \c NULL, then \c GL_FALSE is returned.
*/
GLboolean
-__glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit )
+__glXExtensionBitIsEnabled(__GLXscreenConfigs * psc, unsigned bit)
{
GLboolean enabled = GL_FALSE;
- if ( psc != NULL ) {
+ if (psc != NULL) {
__glXExtensionsCtr();
- __glXExtensionsCtrScreen( psc );
- enabled = EXT_ENABLED( bit, psc->direct_support );
+ __glXExtensionsCtrScreen(psc);
+ enabled = EXT_ENABLED(bit, psc->direct_support);
}
return enabled;
@@ -474,12 +477,12 @@ __glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit )
*
*/
GLboolean
-__glExtensionBitIsEnabled( const __GLXcontext * gc, unsigned bit )
+__glExtensionBitIsEnabled(const __GLXcontext * gc, unsigned bit)
{
GLboolean enabled = GL_FALSE;
- if ( gc != NULL ) {
- enabled = EXT_ENABLED( bit, gc->gl_extension_bits );
+ if (gc != NULL) {
+ enabled = EXT_ENABLED(bit, gc->gl_extension_bits);
}
return enabled;
@@ -491,34 +494,34 @@ __glExtensionBitIsEnabled( const __GLXcontext * gc, unsigned bit )
* Convert a bit-field to a string of supported extensions.
*/
static char *
-__glXGetStringFromTable( const struct extension_info * ext,
- const unsigned char * supported )
+__glXGetStringFromTable(const struct extension_info *ext,
+ const unsigned char *supported)
{
- unsigned i;
- unsigned ext_str_len;
- char * ext_str;
- char * point;
+ unsigned i;
+ unsigned ext_str_len;
+ char *ext_str;
+ char *point;
ext_str_len = 0;
- for ( i = 0 ; ext[i].name != NULL ; i++ ) {
- if ( EXT_ENABLED( ext[i].bit, supported ) ) {
- ext_str_len += ext[i].name_len + 1;
+ for (i = 0; ext[i].name != NULL; i++) {
+ if (EXT_ENABLED(ext[i].bit, supported)) {
+ ext_str_len += ext[i].name_len + 1;
}
}
- ext_str = Xmalloc( ext_str_len + 1 );
- if ( ext_str != NULL ) {
+ ext_str = Xmalloc(ext_str_len + 1);
+ if (ext_str != NULL) {
point = ext_str;
- for ( i = 0 ; ext[i].name != NULL ; i++ ) {
- if ( EXT_ENABLED( ext[i].bit, supported ) ) {
- (void) memcpy( point, ext[i].name, ext[i].name_len );
- point += ext[i].name_len;
+ for (i = 0; ext[i].name != NULL; i++) {
+ if (EXT_ENABLED(ext[i].bit, supported)) {
+ (void) memcpy(point, ext[i].name, ext[i].name_len);
+ point += ext[i].name_len;
- *point = ' ';
- point++;
- }
+ *point = ' ';
+ point++;
+ }
}
*point = '\0';
@@ -532,12 +535,12 @@ __glXGetStringFromTable( const struct extension_info * ext,
* Get the string of client library supported extensions.
*/
const char *
-__glXGetClientExtensions( void )
+__glXGetClientExtensions(void)
{
- if ( __glXGLXClientExtensions == NULL ) {
+ if (__glXGLXClientExtensions == NULL) {
__glXExtensionsCtr();
- __glXGLXClientExtensions = __glXGetStringFromTable( known_glx_extensions,
- client_glx_support );
+ __glXGLXClientExtensions = __glXGetStringFromTable(known_glx_extensions,
+ client_glx_support);
}
return __glXGLXClientExtensions;
@@ -555,20 +558,20 @@ __glXGetClientExtensions( void )
*/
void
-__glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
- GLboolean display_is_direct_capable,
- int minor_version )
+__glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
+ GLboolean display_is_direct_capable,
+ int minor_version)
{
unsigned char server_support[8];
unsigned char usable[8];
- unsigned i;
+ unsigned i;
__glXExtensionsCtr();
- __glXExtensionsCtrScreen( psc );
+ __glXExtensionsCtrScreen(psc);
- (void) memset( server_support, 0, sizeof( server_support ) );
- __glXProcessServerString( known_glx_extensions,
- psc->serverGLXexts, server_support );
+ (void) memset(server_support, 0, sizeof(server_support));
+ __glXProcessServerString(known_glx_extensions,
+ psc->serverGLXexts, server_support);
/* This is a hack. Some servers support GLX 1.3 but don't export
@@ -577,20 +580,20 @@ __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
* "emulated" as well.
*/
- if ( minor_version >= 3 ) {
- SET_BIT( server_support, EXT_visual_info_bit );
- SET_BIT( server_support, EXT_visual_rating_bit );
- SET_BIT( server_support, SGI_make_current_read_bit );
- SET_BIT( server_support, SGIX_fbconfig_bit );
- SET_BIT( server_support, SGIX_pbuffer_bit );
-
+ if (minor_version >= 3) {
+ SET_BIT(server_support, EXT_visual_info_bit);
+ SET_BIT(server_support, EXT_visual_rating_bit);
+ SET_BIT(server_support, SGI_make_current_read_bit);
+ SET_BIT(server_support, SGIX_fbconfig_bit);
+ SET_BIT(server_support, SGIX_pbuffer_bit);
+
/* This one is a little iffy. GLX 1.3 doesn't incorporate all of this
* extension. However, the only part that is not strictly client-side
* is shared. That's the glXQueryContext / glXQueryContextInfoEXT
* function.
*/
- SET_BIT( server_support, EXT_import_context_bit );
+ SET_BIT(server_support, EXT_import_context_bit);
}
@@ -604,22 +607,24 @@ __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
* support it.
*/
- if ( display_is_direct_capable ) {
- for ( i = 0 ; i < 8 ; i++ ) {
- usable[i] = (client_glx_support[i] & client_glx_only[i])
- | (client_glx_support[i] & psc->direct_support[i] & server_support[i])
- | (client_glx_support[i] & psc->direct_support[i] & direct_glx_only[i]);
+ if (display_is_direct_capable) {
+ for (i = 0; i < 8; i++) {
+ usable[i] = (client_glx_support[i] & client_glx_only[i])
+ | (client_glx_support[i] & psc->
+ direct_support[i] & server_support[i])
+ | (client_glx_support[i] & psc->
+ direct_support[i] & direct_glx_only[i]);
}
}
else {
- for ( i = 0 ; i < 8 ; i++ ) {
- usable[i] = (client_glx_support[i] & client_glx_only[i])
- | (client_glx_support[i] & server_support[i]);
+ for (i = 0; i < 8; i++) {
+ usable[i] = (client_glx_support[i] & client_glx_only[i])
+ | (client_glx_support[i] & server_support[i]);
}
}
- psc->effectiveGLXexts = __glXGetStringFromTable( known_glx_extensions,
- usable );
+ psc->effectiveGLXexts = __glXGetStringFromTable(known_glx_extensions,
+ usable);
}
@@ -634,32 +639,33 @@ __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
*/
void
-__glXCalculateUsableGLExtensions( __GLXcontext * gc,
- const char * server_string,
- int major_version, int minor_version )
+__glXCalculateUsableGLExtensions(__GLXcontext * gc,
+ const char *server_string,
+ int major_version, int minor_version)
{
- unsigned char server_support[ __GL_EXT_BYTES ];
- unsigned char usable[ __GL_EXT_BYTES ];
- unsigned i;
+ unsigned char server_support[__GL_EXT_BYTES];
+ unsigned char usable[__GL_EXT_BYTES];
+ unsigned i;
__glXExtensionsCtr();
- (void) memset( server_support, 0, sizeof( server_support ) );
- __glXProcessServerString( known_gl_extensions, server_string,
- server_support );
+ (void) memset(server_support, 0, sizeof(server_support));
+ __glXProcessServerString(known_gl_extensions, server_string,
+ server_support);
/* Handle lazy servers that don't export all the extensions strings that
* are part of the GL core version that they support.
*/
- for ( i = 0 ; i < __GL_EXT_BYTES ; i++ ) {
- if ( (known_gl_extensions[i].version_major != 0)
- && ((major_version > known_gl_extensions[i].version_major)
- || ((major_version == known_gl_extensions[i].version_major)
- && (minor_version >= known_gl_extensions[i].version_minor))) ) {
- SET_BIT( server_support, known_gl_extensions[i].bit );
+ for (i = 0; i < __GL_EXT_BYTES; i++) {
+ if ((known_gl_extensions[i].version_major != 0)
+ && ((major_version > known_gl_extensions[i].version_major)
+ || ((major_version == known_gl_extensions[i].version_major)
+ && (minor_version >=
+ known_gl_extensions[i].version_minor)))) {
+ SET_BIT(server_support, known_gl_extensions[i].bit);
}
}
@@ -669,14 +675,14 @@ __glXCalculateUsableGLExtensions( __GLXcontext * gc,
* and it only needs client-side support.
*/
- for ( i = 0 ; i < __GL_EXT_BYTES ; i++ ) {
+ for (i = 0; i < __GL_EXT_BYTES; i++) {
usable[i] = (client_gl_support[i] & client_gl_only[i])
- | (client_gl_support[i] & server_support[i]);
+ | (client_gl_support[i] & server_support[i]);
}
- gc->extensions = (unsigned char *)
- __glXGetStringFromTable( known_gl_extensions, usable );
- (void) memcpy( gc->gl_extension_bits, usable, sizeof( usable ) );
+ gc->extensions = (unsigned char *)
+ __glXGetStringFromTable(known_gl_extensions, usable);
+ (void) memcpy(gc->gl_extension_bits, usable, sizeof(usable));
}
@@ -685,11 +691,11 @@ __glXCalculateUsableGLExtensions( __GLXcontext * gc,
* rendering.
*/
void
-__glXGetGLVersion( int * major_version, int * minor_version )
-{
- __glXExtensionsCtr();
- *major_version = gl_major;
- *minor_version = gl_minor;
+__glXGetGLVersion(int *major_version, int *minor_version)
+{
+ __glXExtensionsCtr();
+ *major_version = gl_major;
+ *minor_version = gl_minor;
}
@@ -699,8 +705,8 @@ __glXGetGLVersion( int * major_version, int * minor_version )
* supported by the client to the server.
*/
char *
-__glXGetClientGLExtensionString( void )
+__glXGetClientGLExtensionString(void)
{
- __glXExtensionsCtr();
- return __glXGetStringFromTable( known_gl_extensions, client_gl_support );
+ __glXExtensionsCtr();
+ return __glXGetStringFromTable(known_gl_extensions, client_gl_support);
}
diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h
index b99cebbdfa..e7998986da 100644
--- a/src/glx/x11/glxextensions.h
+++ b/src/glx/x11/glxextensions.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2002, 2004
* All Rights Reserved.
@@ -31,7 +32,8 @@
#ifndef GLX_GLXEXTENSIONS_H
#define GLX_GLXEXTENSIONS_H
-enum {
+enum
+{
ARB_get_proc_address_bit = 0,
ARB_multisample_bit,
ARB_render_texture_bit,
@@ -40,7 +42,7 @@ enum {
EXT_visual_rating_bit,
EXT_import_context_bit,
MESA_agp_offset_bit,
- MESA_allocate_memory_bit, /* Replaces MESA_agp_offset & NV_vertex_array_range */
+ MESA_allocate_memory_bit, /* Replaces MESA_agp_offset & NV_vertex_array_range */
MESA_copy_sub_buffer_bit,
MESA_depth_float_bit,
MESA_pixmap_colormap_bit,
@@ -67,7 +69,8 @@ enum {
EXT_texture_from_pixmap_bit
};
-enum {
+enum
+{
GL_ARB_depth_texture_bit = 0,
GL_ARB_draw_buffers_bit,
GL_ARB_fragment_program_bit,
@@ -230,28 +233,34 @@ enum {
struct __GLXscreenConfigsRec;
struct __GLXcontextRec;
-extern GLboolean __glXExtensionBitIsEnabled( struct __GLXscreenConfigsRec *psc, unsigned bit );
-extern const char * __glXGetClientExtensions( void );
-extern void __glXCalculateUsableExtensions( struct __GLXscreenConfigsRec *psc,
- GLboolean display_is_direct_capable, int server_minor_version );
+extern GLboolean __glXExtensionBitIsEnabled(struct __GLXscreenConfigsRec *psc,
+ unsigned bit);
+extern const char *__glXGetClientExtensions(void);
+extern void __glXCalculateUsableExtensions(struct __GLXscreenConfigsRec *psc,
+ GLboolean
+ display_is_direct_capable,
+ int server_minor_version);
-extern void __glXCalculateUsableGLExtensions( struct __GLXcontextRec * gc,
- const char * server_string, int major_version, int minor_version );
-extern void __glXGetGLVersion( int * major_version, int * minor_version );
-extern char * __glXGetClientGLExtensionString( void );
+extern void __glXCalculateUsableGLExtensions(struct __GLXcontextRec *gc,
+ const char *server_string,
+ int major_version,
+ int minor_version);
+extern void __glXGetGLVersion(int *major_version, int *minor_version);
+extern char *__glXGetClientGLExtensionString(void);
-extern GLboolean __glExtensionBitIsEnabled( const struct __GLXcontextRec * gc,
- unsigned bit );
+extern GLboolean __glExtensionBitIsEnabled(const struct __GLXcontextRec *gc,
+ unsigned bit);
extern void
-__glXEnableDirectExtension(struct __GLXscreenConfigsRec *psc, const char *name);
+__glXEnableDirectExtension(struct __GLXscreenConfigsRec *psc,
+ const char *name);
/* Source-level backwards compatibility with old drivers. They won't
* find the respective functions, though.
*/
-typedef void (* PFNGLXENABLEEXTENSIONPROC) ( const char * name,
- GLboolean force_client );
-typedef void (* PFNGLXDISABLEEXTENSIONPROC) ( const char * name );
+typedef void (*PFNGLXENABLEEXTENSIONPROC) (const char *name,
+ GLboolean force_client);
+typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
/* GLX_ALIAS should be used for functions with a non-void return type.
GLX_ALIAS_VOID is for functions with a void return type. */
@@ -261,17 +270,17 @@ typedef void (* PFNGLXDISABLEEXTENSIONPROC) ( const char * name );
#else
# if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
# define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
- return_type real_func proto_args \
- __attribute__ ((alias( # aliased_func ) ));
+ return_type real_func proto_args \
+ __attribute__ ((alias( # aliased_func ) ));
# define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
- GLX_ALIAS(void, real_func, proto_args, args, aliased_func)
+ GLX_ALIAS(void, real_func, proto_args, args, aliased_func)
# else
# define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
- return_type real_func proto_args \
- { return aliased_func args ; }
+ return_type real_func proto_args \
+ { return aliased_func args ; }
# define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
- void real_func proto_args \
- { aliased_func args ; }
+ void real_func proto_args \
+ { aliased_func args ; }
# endif /* __GNUC__ */
#endif /* GLX_NO_STATIC_EXTENSION_FUNCTIONS */
diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c
index b7b8fb2738..22d5995aa5 100644
--- a/src/glx/x11/glxhash.c
+++ b/src/glx/x11/glxhash.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/* glxhash.c -- Small hash table support for integer -> integer mapping
* Taken from libdrm.
*
@@ -80,8 +81,8 @@
#define HASH_MAGIC 0xdeadbeef
#define HASH_DEBUG 0
-#define HASH_SIZE 512 /* Good for about 100 entries */
- /* If you change this value, you probably
+#define HASH_SIZE 512 /* Good for about 100 entries */
+ /* If you change this value, you probably
have to change the HashHash hashing
function! */
@@ -92,323 +93,370 @@
#define HASH_RANDOM random()
#define HASH_RANDOM_DESTROY
-typedef struct __glxHashBucket {
- unsigned long key;
- void *value;
- struct __glxHashBucket *next;
+typedef struct __glxHashBucket
+{
+ unsigned long key;
+ void *value;
+ struct __glxHashBucket *next;
} __glxHashBucket, *__glxHashBucketPtr;
typedef struct __glxHashTable *__glxHashTablePtr;
-struct __glxHashTable {
- unsigned long magic;
- unsigned long hits; /* At top of linked list */
- unsigned long partials; /* Not at top of linked list */
- unsigned long misses; /* Not in table */
- __glxHashBucketPtr buckets[HASH_SIZE];
- int p0;
- __glxHashBucketPtr p1;
+struct __glxHashTable
+{
+ unsigned long magic;
+ unsigned long hits; /* At top of linked list */
+ unsigned long partials; /* Not at top of linked list */
+ unsigned long misses; /* Not in table */
+ __glxHashBucketPtr buckets[HASH_SIZE];
+ int p0;
+ __glxHashBucketPtr p1;
};
-static unsigned long HashHash(unsigned long key)
+static unsigned long
+HashHash(unsigned long key)
{
- unsigned long hash = 0;
- unsigned long tmp = key;
- static int init = 0;
- static unsigned long scatter[256];
- int i;
-
- if (!init) {
- HASH_RANDOM_DECL;
- HASH_RANDOM_INIT(37);
- for (i = 0; i < 256; i++) scatter[i] = HASH_RANDOM;
- HASH_RANDOM_DESTROY;
- ++init;
- }
-
- while (tmp) {
- hash = (hash << 1) + scatter[tmp & 0xff];
- tmp >>= 8;
- }
-
- hash %= HASH_SIZE;
+ unsigned long hash = 0;
+ unsigned long tmp = key;
+ static int init = 0;
+ static unsigned long scatter[256];
+ int i;
+
+ if (!init) {
+ HASH_RANDOM_DECL;
+ HASH_RANDOM_INIT(37);
+ for (i = 0; i < 256; i++)
+ scatter[i] = HASH_RANDOM;
+ HASH_RANDOM_DESTROY;
+ ++init;
+ }
+
+ while (tmp) {
+ hash = (hash << 1) + scatter[tmp & 0xff];
+ tmp >>= 8;
+ }
+
+ hash %= HASH_SIZE;
#if HASH_DEBUG
- printf( "Hash(%d) = %d\n", key, hash);
+ printf("Hash(%d) = %d\n", key, hash);
#endif
- return hash;
+ return hash;
}
-_X_HIDDEN __glxHashTable *__glxHashCreate(void)
+_X_HIDDEN __glxHashTable *
+__glxHashCreate(void)
{
- __glxHashTablePtr table;
- int i;
-
- table = HASH_ALLOC(sizeof(*table));
- if (!table) return NULL;
- table->magic = HASH_MAGIC;
- table->hits = 0;
- table->partials = 0;
- table->misses = 0;
-
- for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL;
- return table;
+ __glxHashTablePtr table;
+ int i;
+
+ table = HASH_ALLOC(sizeof(*table));
+ if (!table)
+ return NULL;
+ table->magic = HASH_MAGIC;
+ table->hits = 0;
+ table->partials = 0;
+ table->misses = 0;
+
+ for (i = 0; i < HASH_SIZE; i++)
+ table->buckets[i] = NULL;
+ return table;
}
-_X_HIDDEN int __glxHashDestroy(__glxHashTable *t)
+_X_HIDDEN int
+__glxHashDestroy(__glxHashTable * t)
{
- __glxHashTablePtr table = (__glxHashTablePtr)t;
- __glxHashBucketPtr bucket;
- __glxHashBucketPtr next;
- int i;
-
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- for (i = 0; i < HASH_SIZE; i++) {
- for (bucket = table->buckets[i]; bucket;) {
- next = bucket->next;
- HASH_FREE(bucket);
- bucket = next;
- }
- }
- HASH_FREE(table);
- return 0;
+ __glxHashTablePtr table = (__glxHashTablePtr) t;
+ __glxHashBucketPtr bucket;
+ __glxHashBucketPtr next;
+ int i;
+
+ if (table->magic != HASH_MAGIC)
+ return -1; /* Bad magic */
+
+ for (i = 0; i < HASH_SIZE; i++) {
+ for (bucket = table->buckets[i]; bucket;) {
+ next = bucket->next;
+ HASH_FREE(bucket);
+ bucket = next;
+ }
+ }
+ HASH_FREE(table);
+ return 0;
}
/* Find the bucket and organize the list so that this bucket is at the
top. */
-static __glxHashBucketPtr HashFind(__glxHashTablePtr table,
- unsigned long key, unsigned long *h)
+static __glxHashBucketPtr
+HashFind(__glxHashTablePtr table, unsigned long key, unsigned long *h)
{
- unsigned long hash = HashHash(key);
- __glxHashBucketPtr prev = NULL;
- __glxHashBucketPtr bucket;
-
- if (h) *h = hash;
-
- for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) {
- if (bucket->key == key) {
- if (prev) {
- /* Organize */
- prev->next = bucket->next;
- bucket->next = table->buckets[hash];
- table->buckets[hash] = bucket;
- ++table->partials;
- } else {
- ++table->hits;
- }
- return bucket;
- }
- prev = bucket;
- }
- ++table->misses;
- return NULL;
+ unsigned long hash = HashHash(key);
+ __glxHashBucketPtr prev = NULL;
+ __glxHashBucketPtr bucket;
+
+ if (h)
+ *h = hash;
+
+ for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) {
+ if (bucket->key == key) {
+ if (prev) {
+ /* Organize */
+ prev->next = bucket->next;
+ bucket->next = table->buckets[hash];
+ table->buckets[hash] = bucket;
+ ++table->partials;
+ }
+ else {
+ ++table->hits;
+ }
+ return bucket;
+ }
+ prev = bucket;
+ }
+ ++table->misses;
+ return NULL;
}
-_X_HIDDEN int __glxHashLookup(__glxHashTable *t,
- unsigned long key, void **value)
+_X_HIDDEN int
+__glxHashLookup(__glxHashTable * t, unsigned long key, void **value)
{
- __glxHashTablePtr table = (__glxHashTablePtr)t;
- __glxHashBucketPtr bucket;
+ __glxHashTablePtr table = (__glxHashTablePtr) t;
+ __glxHashBucketPtr bucket;
- if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */
+ if (!table || table->magic != HASH_MAGIC)
+ return -1; /* Bad magic */
- bucket = HashFind(table, key, NULL);
- if (!bucket) return 1; /* Not found */
- *value = bucket->value;
- return 0; /* Found */
+ bucket = HashFind(table, key, NULL);
+ if (!bucket)
+ return 1; /* Not found */
+ *value = bucket->value;
+ return 0; /* Found */
}
-_X_HIDDEN int __glxHashInsert(__glxHashTable *t,
- unsigned long key, void *value)
+_X_HIDDEN int
+__glxHashInsert(__glxHashTable * t, unsigned long key, void *value)
{
- __glxHashTablePtr table = (__glxHashTablePtr)t;
- __glxHashBucketPtr bucket;
- unsigned long hash;
-
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- if (HashFind(table, key, &hash)) return 1; /* Already in table */
-
- bucket = HASH_ALLOC(sizeof(*bucket));
- if (!bucket) return -1; /* Error */
- bucket->key = key;
- bucket->value = value;
- bucket->next = table->buckets[hash];
- table->buckets[hash] = bucket;
+ __glxHashTablePtr table = (__glxHashTablePtr) t;
+ __glxHashBucketPtr bucket;
+ unsigned long hash;
+
+ if (table->magic != HASH_MAGIC)
+ return -1; /* Bad magic */
+
+ if (HashFind(table, key, &hash))
+ return 1; /* Already in table */
+
+ bucket = HASH_ALLOC(sizeof(*bucket));
+ if (!bucket)
+ return -1; /* Error */
+ bucket->key = key;
+ bucket->value = value;
+ bucket->next = table->buckets[hash];
+ table->buckets[hash] = bucket;
#if HASH_DEBUG
- printf("Inserted %d at %d/%p\n", key, hash, bucket);
+ printf("Inserted %d at %d/%p\n", key, hash, bucket);
#endif
- return 0; /* Added to table */
+ return 0; /* Added to table */
}
-_X_HIDDEN int __glxHashDelete(__glxHashTable *t, unsigned long key)
+_X_HIDDEN int
+__glxHashDelete(__glxHashTable * t, unsigned long key)
{
- __glxHashTablePtr table = (__glxHashTablePtr)t;
- unsigned long hash;
- __glxHashBucketPtr bucket;
+ __glxHashTablePtr table = (__glxHashTablePtr) t;
+ unsigned long hash;
+ __glxHashBucketPtr bucket;
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
+ if (table->magic != HASH_MAGIC)
+ return -1; /* Bad magic */
- bucket = HashFind(table, key, &hash);
+ bucket = HashFind(table, key, &hash);
- if (!bucket) return 1; /* Not found */
+ if (!bucket)
+ return 1; /* Not found */
- table->buckets[hash] = bucket->next;
- HASH_FREE(bucket);
- return 0;
+ table->buckets[hash] = bucket->next;
+ HASH_FREE(bucket);
+ return 0;
}
-_X_HIDDEN int __glxHashNext(__glxHashTable *t,
- unsigned long *key, void **value)
+_X_HIDDEN int
+__glxHashNext(__glxHashTable * t, unsigned long *key, void **value)
{
- __glxHashTablePtr table = (__glxHashTablePtr)t;
-
- while (table->p0 < HASH_SIZE) {
- if (table->p1) {
- *key = table->p1->key;
- *value = table->p1->value;
- table->p1 = table->p1->next;
- return 1;
- }
- table->p1 = table->buckets[table->p0];
- ++table->p0;
- }
- return 0;
+ __glxHashTablePtr table = (__glxHashTablePtr) t;
+
+ while (table->p0 < HASH_SIZE) {
+ if (table->p1) {
+ *key = table->p1->key;
+ *value = table->p1->value;
+ table->p1 = table->p1->next;
+ return 1;
+ }
+ table->p1 = table->buckets[table->p0];
+ ++table->p0;
+ }
+ return 0;
}
-_X_HIDDEN int __glxHashFirst(__glxHashTable *t,
- unsigned long *key, void **value)
+_X_HIDDEN int
+__glxHashFirst(__glxHashTable * t, unsigned long *key, void **value)
{
- __glxHashTablePtr table = (__glxHashTablePtr)t;
+ __glxHashTablePtr table = (__glxHashTablePtr) t;
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
+ if (table->magic != HASH_MAGIC)
+ return -1; /* Bad magic */
- table->p0 = 0;
- table->p1 = table->buckets[0];
- return __glxHashNext(table, key, value);
+ table->p0 = 0;
+ table->p1 = table->buckets[0];
+ return __glxHashNext(table, key, value);
}
#if HASH_MAIN
#define DIST_LIMIT 10
static int dist[DIST_LIMIT];
-static void clear_dist(void) {
- int i;
+static void
+clear_dist(void)
+{
+ int i;
- for (i = 0; i < DIST_LIMIT; i++) dist[i] = 0;
+ for (i = 0; i < DIST_LIMIT; i++)
+ dist[i] = 0;
}
-static int count_entries(__glxHashBucketPtr bucket)
+static int
+count_entries(__glxHashBucketPtr bucket)
{
- int count = 0;
+ int count = 0;
- for (; bucket; bucket = bucket->next) ++count;
- return count;
+ for (; bucket; bucket = bucket->next)
+ ++count;
+ return count;
}
-static void update_dist(int count)
+static void
+update_dist(int count)
{
- if (count >= DIST_LIMIT) ++dist[DIST_LIMIT-1];
- else ++dist[count];
+ if (count >= DIST_LIMIT)
+ ++dist[DIST_LIMIT - 1];
+ else
+ ++dist[count];
}
-static void compute_dist(__glxHashTablePtr table)
+static void
+compute_dist(__glxHashTablePtr table)
{
- int i;
- __glxHashBucketPtr bucket;
-
- printf("Hits = %ld, partials = %ld, misses = %ld\n",
- table->hits, table->partials, table->misses);
- clear_dist();
- for (i = 0; i < HASH_SIZE; i++) {
- bucket = table->buckets[i];
- update_dist(count_entries(bucket));
- }
- for (i = 0; i < DIST_LIMIT; i++) {
- if (i != DIST_LIMIT-1) printf("%5d %10d\n", i, dist[i]);
- else printf("other %10d\n", dist[i]);
- }
+ int i;
+ __glxHashBucketPtr bucket;
+
+ printf("Hits = %ld, partials = %ld, misses = %ld\n",
+ table->hits, table->partials, table->misses);
+ clear_dist();
+ for (i = 0; i < HASH_SIZE; i++) {
+ bucket = table->buckets[i];
+ update_dist(count_entries(bucket));
+ }
+ for (i = 0; i < DIST_LIMIT; i++) {
+ if (i != DIST_LIMIT - 1)
+ printf("%5d %10d\n", i, dist[i]);
+ else
+ printf("other %10d\n", dist[i]);
+ }
}
-static void check_table(__glxHashTablePtr table,
- unsigned long key, unsigned long value)
+static void
+check_table(__glxHashTablePtr table, unsigned long key, unsigned long value)
{
- unsigned long retval = 0;
- int retcode = __glxHashLookup(table, key, &retval);
-
- switch (retcode) {
- case -1:
- printf("Bad magic = 0x%08lx:"
- " key = %lu, expected = %lu, returned = %lu\n",
- table->magic, key, value, retval);
- break;
- case 1:
- printf("Not found: key = %lu, expected = %lu returned = %lu\n",
- key, value, retval);
- break;
- case 0:
- if (value != retval)
- printf("Bad value: key = %lu, expected = %lu, returned = %lu\n",
- key, value, retval);
- break;
- default:
- printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n",
- retcode, key, value, retval);
- break;
- }
+ unsigned long retval = 0;
+ int retcode = __glxHashLookup(table, key, &retval);
+
+ switch (retcode) {
+ case -1:
+ printf("Bad magic = 0x%08lx:"
+ " key = %lu, expected = %lu, returned = %lu\n",
+ table->magic, key, value, retval);
+ break;
+ case 1:
+ printf("Not found: key = %lu, expected = %lu returned = %lu\n",
+ key, value, retval);
+ break;
+ case 0:
+ if (value != retval)
+ printf("Bad value: key = %lu, expected = %lu, returned = %lu\n",
+ key, value, retval);
+ break;
+ default:
+ printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n",
+ retcode, key, value, retval);
+ break;
+ }
}
-int main(void)
+int
+main(void)
{
- __glxHashTablePtr table;
- int i;
-
- printf("\n***** 256 consecutive integers ****\n");
- table = __glxHashCreate();
- for (i = 0; i < 256; i++) __glxHashInsert(table, i, i);
- for (i = 0; i < 256; i++) check_table(table, i, i);
- for (i = 256; i >= 0; i--) check_table(table, i, i);
- compute_dist(table);
- __glxHashDestroy(table);
-
- printf("\n***** 1024 consecutive integers ****\n");
- table = __glxHashCreate();
- for (i = 0; i < 1024; i++) __glxHashInsert(table, i, i);
- for (i = 0; i < 1024; i++) check_table(table, i, i);
- for (i = 1024; i >= 0; i--) check_table(table, i, i);
- compute_dist(table);
- __glxHashDestroy(table);
-
- printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
- table = __glxHashCreate();
- for (i = 0; i < 1024; i++) __glxHashInsert(table, i*4096, i);
- for (i = 0; i < 1024; i++) check_table(table, i*4096, i);
- for (i = 1024; i >= 0; i--) check_table(table, i*4096, i);
- compute_dist(table);
- __glxHashDestroy(table);
-
- printf("\n***** 1024 random integers ****\n");
- table = __glxHashCreate();
- srandom(0xbeefbeef);
- for (i = 0; i < 1024; i++) __glxHashInsert(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 1024; i++) check_table(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 1024; i++) check_table(table, random(), i);
- compute_dist(table);
- __glxHashDestroy(table);
-
- printf("\n***** 5000 random integers ****\n");
- table = __glxHashCreate();
- srandom(0xbeefbeef);
- for (i = 0; i < 5000; i++) __glxHashInsert(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 5000; i++) check_table(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 5000; i++) check_table(table, random(), i);
- compute_dist(table);
- __glxHashDestroy(table);
-
- return 0;
+ __glxHashTablePtr table;
+ int i;
+
+ printf("\n***** 256 consecutive integers ****\n");
+ table = __glxHashCreate();
+ for (i = 0; i < 256; i++)
+ __glxHashInsert(table, i, i);
+ for (i = 0; i < 256; i++)
+ check_table(table, i, i);
+ for (i = 256; i >= 0; i--)
+ check_table(table, i, i);
+ compute_dist(table);
+ __glxHashDestroy(table);
+
+ printf("\n***** 1024 consecutive integers ****\n");
+ table = __glxHashCreate();
+ for (i = 0; i < 1024; i++)
+ __glxHashInsert(table, i, i);
+ for (i = 0; i < 1024; i++)
+ check_table(table, i, i);
+ for (i = 1024; i >= 0; i--)
+ check_table(table, i, i);
+ compute_dist(table);
+ __glxHashDestroy(table);
+
+ printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
+ table = __glxHashCreate();
+ for (i = 0; i < 1024; i++)
+ __glxHashInsert(table, i * 4096, i);
+ for (i = 0; i < 1024; i++)
+ check_table(table, i * 4096, i);
+ for (i = 1024; i >= 0; i--)
+ check_table(table, i * 4096, i);
+ compute_dist(table);
+ __glxHashDestroy(table);
+
+ printf("\n***** 1024 random integers ****\n");
+ table = __glxHashCreate();
+ srandom(0xbeefbeef);
+ for (i = 0; i < 1024; i++)
+ __glxHashInsert(table, random(), i);
+ srandom(0xbeefbeef);
+ for (i = 0; i < 1024; i++)
+ check_table(table, random(), i);
+ srandom(0xbeefbeef);
+ for (i = 0; i < 1024; i++)
+ check_table(table, random(), i);
+ compute_dist(table);
+ __glxHashDestroy(table);
+
+ printf("\n***** 5000 random integers ****\n");
+ table = __glxHashCreate();
+ srandom(0xbeefbeef);
+ for (i = 0; i < 5000; i++)
+ __glxHashInsert(table, random(), i);
+ srandom(0xbeefbeef);
+ for (i = 0; i < 5000; i++)
+ check_table(table, random(), i);
+ srandom(0xbeefbeef);
+ for (i = 0; i < 5000; i++)
+ check_table(table, random(), i);
+ compute_dist(table);
+ __glxHashDestroy(table);
+
+ return 0;
}
#endif
diff --git a/src/glx/x11/glxhash.h b/src/glx/x11/glxhash.h
index 66012fb889..e97848fa8d 100644
--- a/src/glx/x11/glxhash.h
+++ b/src/glx/x11/glxhash.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
#ifndef _GLX_HASH_H_
#define _GLX_HASH_H_
@@ -6,11 +7,15 @@ typedef struct __glxHashTable __glxHashTable;
/* Hash table routines */
extern __glxHashTable *__glxHashCreate(void);
-extern int __glxHashDestroy(__glxHashTable *t);
-extern int __glxHashLookup(__glxHashTable *t, unsigned long key, void **value);
-extern int __glxHashInsert(__glxHashTable *t, unsigned long key, void *value);
-extern int __glxHashDelete(__glxHashTable *t, unsigned long key);
-extern int __glxHashFirst(__glxHashTable *t, unsigned long *key, void **value);
-extern int __glxHashNext(__glxHashTable *t, unsigned long *key, void **value);
+extern int __glxHashDestroy(__glxHashTable * t);
+extern int __glxHashLookup(__glxHashTable * t, unsigned long key,
+ void **value);
+extern int __glxHashInsert(__glxHashTable * t, unsigned long key,
+ void *value);
+extern int __glxHashDelete(__glxHashTable * t, unsigned long key);
+extern int __glxHashFirst(__glxHashTable * t, unsigned long *key,
+ void **value);
+extern int __glxHashNext(__glxHashTable * t, unsigned long *key,
+ void **value);
#endif /* _GLX_HASH_H_ */
diff --git a/src/glx/x11/indirect_init.h b/src/glx/x11/indirect_init.h
index 72255f1301..8a75fb0452 100644
--- a/src/glx/x11/indirect_init.h
+++ b/src/glx/x11/indirect_init.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/src/glx/x11/indirect_texture_compression.c b/src/glx/x11/indirect_texture_compression.c
index 5676858017..6883766820 100644
--- a/src/glx/x11/indirect_texture_compression.c
+++ b/src/glx/x11/indirect_texture_compression.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
@@ -40,31 +41,31 @@
void
-__indirect_glGetCompressedTexImageARB( GLenum target, GLint level,
- GLvoid * img )
+__indirect_glGetCompressedTexImageARB(GLenum target, GLint level,
+ GLvoid * img)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXGetTexImageReply reply;
- size_t image_bytes;
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN( X_GLsop_GetCompressedTexImage, 8 );
- __GLX_SINGLE_PUT_LONG( 0, target );
- __GLX_SINGLE_PUT_LONG( 4, level );
- __GLX_SINGLE_READ_XREPLY();
-
- image_bytes = reply.width;
- assert( image_bytes <= ((4 * reply.length) - 0) );
- assert( image_bytes >= ((4 * reply.length) - 3) );
-
- if ( image_bytes != 0 ) {
- _XRead( dpy, (char *) img, image_bytes );
- if ( image_bytes < (4 * reply.length) ) {
- _XEatData( dpy, (4 * reply.length) - image_bytes );
- }
- }
-
- __GLX_SINGLE_END();
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ xGLXGetTexImageReply reply;
+ size_t image_bytes;
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_GetCompressedTexImage, 8);
+ __GLX_SINGLE_PUT_LONG(0, target);
+ __GLX_SINGLE_PUT_LONG(4, level);
+ __GLX_SINGLE_READ_XREPLY();
+
+ image_bytes = reply.width;
+ assert(image_bytes <= ((4 * reply.length) - 0));
+ assert(image_bytes >= ((4 * reply.length) - 3));
+
+ if (image_bytes != 0) {
+ _XRead(dpy, (char *) img, image_bytes);
+ if (image_bytes < (4 * reply.length)) {
+ _XEatData(dpy, (4 * reply.length) - image_bytes);
+ }
+ }
+
+ __GLX_SINGLE_END();
}
@@ -73,60 +74,59 @@ __indirect_glGetCompressedTexImageARB( GLenum target, GLint level,
* \c glCompressedTexImage2D.
*/
static void
-CompressedTexImage1D2D( GLenum target, GLint level,
- GLenum internal_format,
- GLsizei width, GLsizei height,
- GLint border, GLsizei image_size,
- const GLvoid *data, CARD32 rop )
+CompressedTexImage1D2D(GLenum target, GLint level,
+ GLenum internal_format,
+ GLsizei width, GLsizei height,
+ GLint border, GLsizei image_size,
+ const GLvoid * data, CARD32 rop)
{
- __GLX_DECLARE_VARIABLES();
-
- __GLX_LOAD_VARIABLES();
- if ( gc->currentDpy == NULL ) {
- return;
- }
-
- if ( (target == GL_PROXY_TEXTURE_1D)
- || (target == GL_PROXY_TEXTURE_2D)
- || (target == GL_PROXY_TEXTURE_CUBE_MAP) ) {
- compsize = 0;
- }
- else {
- compsize = image_size;
- }
-
- cmdlen = __GLX_PAD( __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE
- + compsize );
- if ( cmdlen <= gc->maxSmallRenderCommandSize ) {
- __GLX_BEGIN_VARIABLE( rop, cmdlen );
- __GLX_PUT_LONG( 4, target );
- __GLX_PUT_LONG( 8, level );
- __GLX_PUT_LONG( 12, internal_format );
- __GLX_PUT_LONG( 16, width );
- __GLX_PUT_LONG( 20, height );
- __GLX_PUT_LONG( 24, border );
- __GLX_PUT_LONG( 28, image_size );
- if ( compsize != 0 ) {
- __GLX_PUT_CHAR_ARRAY( __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE,
- data, image_size );
- }
- __GLX_END( cmdlen );
- }
- else {
- assert( compsize != 0 );
-
- __GLX_BEGIN_VARIABLE_LARGE( rop, cmdlen + 4 );
- __GLX_PUT_LONG( 8, target );
- __GLX_PUT_LONG( 12, level );
- __GLX_PUT_LONG( 16, internal_format );
- __GLX_PUT_LONG( 20, width );
- __GLX_PUT_LONG( 24, height );
- __GLX_PUT_LONG( 28, border );
- __GLX_PUT_LONG( 32, image_size );
- __glXSendLargeCommand( gc, gc->pc,
- __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + 4,
- data, image_size );
- }
+ __GLX_DECLARE_VARIABLES();
+
+ __GLX_LOAD_VARIABLES();
+ if (gc->currentDpy == NULL) {
+ return;
+ }
+
+ if ((target == GL_PROXY_TEXTURE_1D)
+ || (target == GL_PROXY_TEXTURE_2D)
+ || (target == GL_PROXY_TEXTURE_CUBE_MAP)) {
+ compsize = 0;
+ }
+ else {
+ compsize = image_size;
+ }
+
+ cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + compsize);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ __GLX_BEGIN_VARIABLE(rop, cmdlen);
+ __GLX_PUT_LONG(4, target);
+ __GLX_PUT_LONG(8, level);
+ __GLX_PUT_LONG(12, internal_format);
+ __GLX_PUT_LONG(16, width);
+ __GLX_PUT_LONG(20, height);
+ __GLX_PUT_LONG(24, border);
+ __GLX_PUT_LONG(28, image_size);
+ if (compsize != 0) {
+ __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE,
+ data, image_size);
+ }
+ __GLX_END(cmdlen);
+ }
+ else {
+ assert(compsize != 0);
+
+ __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4);
+ __GLX_PUT_LONG(8, target);
+ __GLX_PUT_LONG(12, level);
+ __GLX_PUT_LONG(16, internal_format);
+ __GLX_PUT_LONG(20, width);
+ __GLX_PUT_LONG(24, height);
+ __GLX_PUT_LONG(28, border);
+ __GLX_PUT_LONG(32, image_size);
+ __glXSendLargeCommand(gc, gc->pc,
+ __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + 4,
+ data, image_size);
+ }
}
@@ -135,213 +135,210 @@ CompressedTexImage1D2D( GLenum target, GLint level,
* \c glCompressedTexSubImage2D.
*/
static void
-CompressedTexSubImage1D2D( GLenum target, GLint level,
- GLsizei xoffset, GLsizei yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLsizei image_size,
- const GLvoid *data, CARD32 rop )
+CompressedTexSubImage1D2D(GLenum target, GLint level,
+ GLsizei xoffset, GLsizei yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLsizei image_size,
+ const GLvoid * data, CARD32 rop)
{
- __GLX_DECLARE_VARIABLES();
-
- __GLX_LOAD_VARIABLES();
- if ( gc->currentDpy == NULL ) {
- return;
- }
-
- if ( target == GL_PROXY_TEXTURE_3D ) {
- compsize = 0;
- }
- else {
- compsize = image_size;
- }
-
- cmdlen = __GLX_PAD( __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE
- + compsize );
- if ( cmdlen <= gc->maxSmallRenderCommandSize ) {
- __GLX_BEGIN_VARIABLE( rop, cmdlen );
- __GLX_PUT_LONG( 4, target );
- __GLX_PUT_LONG( 8, level );
- __GLX_PUT_LONG( 12, xoffset );
- __GLX_PUT_LONG( 16, yoffset );
- __GLX_PUT_LONG( 20, width );
- __GLX_PUT_LONG( 24, height );
- __GLX_PUT_LONG( 28, format );
- __GLX_PUT_LONG( 32, image_size );
- if ( compsize != 0 ) {
- __GLX_PUT_CHAR_ARRAY( __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE,
- data, image_size );
- }
- __GLX_END( cmdlen );
- }
- else {
- assert( compsize != 0 );
-
- __GLX_BEGIN_VARIABLE_LARGE( rop, cmdlen + 4 );
- __GLX_PUT_LONG( 8, target );
- __GLX_PUT_LONG( 12, level );
- __GLX_PUT_LONG( 16, xoffset );
- __GLX_PUT_LONG( 20, yoffset );
- __GLX_PUT_LONG( 24, width );
- __GLX_PUT_LONG( 28, height );
- __GLX_PUT_LONG( 32, format );
- __GLX_PUT_LONG( 36, image_size );
- __glXSendLargeCommand( gc, gc->pc,
- __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + 4,
- data, image_size );
- }
+ __GLX_DECLARE_VARIABLES();
+
+ __GLX_LOAD_VARIABLES();
+ if (gc->currentDpy == NULL) {
+ return;
+ }
+
+ if (target == GL_PROXY_TEXTURE_3D) {
+ compsize = 0;
+ }
+ else {
+ compsize = image_size;
+ }
+
+ cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + compsize);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ __GLX_BEGIN_VARIABLE(rop, cmdlen);
+ __GLX_PUT_LONG(4, target);
+ __GLX_PUT_LONG(8, level);
+ __GLX_PUT_LONG(12, xoffset);
+ __GLX_PUT_LONG(16, yoffset);
+ __GLX_PUT_LONG(20, width);
+ __GLX_PUT_LONG(24, height);
+ __GLX_PUT_LONG(28, format);
+ __GLX_PUT_LONG(32, image_size);
+ if (compsize != 0) {
+ __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE,
+ data, image_size);
+ }
+ __GLX_END(cmdlen);
+ }
+ else {
+ assert(compsize != 0);
+
+ __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4);
+ __GLX_PUT_LONG(8, target);
+ __GLX_PUT_LONG(12, level);
+ __GLX_PUT_LONG(16, xoffset);
+ __GLX_PUT_LONG(20, yoffset);
+ __GLX_PUT_LONG(24, width);
+ __GLX_PUT_LONG(28, height);
+ __GLX_PUT_LONG(32, format);
+ __GLX_PUT_LONG(36, image_size);
+ __glXSendLargeCommand(gc, gc->pc,
+ __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + 4,
+ data, image_size);
+ }
}
void
-__indirect_glCompressedTexImage1DARB( GLenum target, GLint level,
- GLenum internal_format, GLsizei width,
- GLint border, GLsizei image_size,
- const GLvoid *data )
+__indirect_glCompressedTexImage1DARB(GLenum target, GLint level,
+ GLenum internal_format, GLsizei width,
+ GLint border, GLsizei image_size,
+ const GLvoid * data)
{
- CompressedTexImage1D2D( target, level, internal_format, width, 0,
- border, image_size, data,
- X_GLrop_CompressedTexImage1D );
+ CompressedTexImage1D2D(target, level, internal_format, width, 0,
+ border, image_size, data,
+ X_GLrop_CompressedTexImage1D);
}
void
-__indirect_glCompressedTexImage2DARB( GLenum target, GLint level,
- GLenum internal_format,
- GLsizei width, GLsizei height,
- GLint border, GLsizei image_size,
- const GLvoid *data )
+__indirect_glCompressedTexImage2DARB(GLenum target, GLint level,
+ GLenum internal_format,
+ GLsizei width, GLsizei height,
+ GLint border, GLsizei image_size,
+ const GLvoid * data)
{
- CompressedTexImage1D2D( target, level, internal_format, width, height,
- border, image_size, data,
- X_GLrop_CompressedTexImage2D );
+ CompressedTexImage1D2D(target, level, internal_format, width, height,
+ border, image_size, data,
+ X_GLrop_CompressedTexImage2D);
}
void
-__indirect_glCompressedTexImage3DARB( GLenum target, GLint level,
- GLenum internal_format,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLsizei image_size,
- const GLvoid *data )
+__indirect_glCompressedTexImage3DARB(GLenum target, GLint level,
+ GLenum internal_format,
+ GLsizei width, GLsizei height,
+ GLsizei depth, GLint border,
+ GLsizei image_size, const GLvoid * data)
{
- __GLX_DECLARE_VARIABLES();
-
- __GLX_LOAD_VARIABLES();
- if ( gc->currentDpy == NULL ) {
- return;
- }
-
- cmdlen = __GLX_PAD( __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE
- + image_size );
- if ( cmdlen <= gc->maxSmallRenderCommandSize ) {
- __GLX_BEGIN_VARIABLE( X_GLrop_CompressedTexImage3D, cmdlen );
- __GLX_PUT_LONG( 4, target );
- __GLX_PUT_LONG( 8, level );
- __GLX_PUT_LONG( 12, internal_format );
- __GLX_PUT_LONG( 16, width );
- __GLX_PUT_LONG( 20, height );
- __GLX_PUT_LONG( 24, depth );
- __GLX_PUT_LONG( 28, border );
- __GLX_PUT_LONG( 32, image_size );
- if ( image_size != 0 ) {
- __GLX_PUT_CHAR_ARRAY( __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE,
- data, image_size );
- }
- __GLX_END( cmdlen );
- }
- else {
- __GLX_BEGIN_VARIABLE_LARGE( X_GLrop_CompressedTexImage3D,
- cmdlen + 4 );
- __GLX_PUT_LONG( 8, target );
- __GLX_PUT_LONG( 12, level );
- __GLX_PUT_LONG( 16, internal_format );
- __GLX_PUT_LONG( 20, width );
- __GLX_PUT_LONG( 24, height );
- __GLX_PUT_LONG( 28, depth );
- __GLX_PUT_LONG( 32, border );
- __GLX_PUT_LONG( 36, image_size );
- __glXSendLargeCommand( gc, gc->pc,
- __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + 4,
- data, image_size );
- }
+ __GLX_DECLARE_VARIABLES();
+
+ __GLX_LOAD_VARIABLES();
+ if (gc->currentDpy == NULL) {
+ return;
+ }
+
+ cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + image_size);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexImage3D, cmdlen);
+ __GLX_PUT_LONG(4, target);
+ __GLX_PUT_LONG(8, level);
+ __GLX_PUT_LONG(12, internal_format);
+ __GLX_PUT_LONG(16, width);
+ __GLX_PUT_LONG(20, height);
+ __GLX_PUT_LONG(24, depth);
+ __GLX_PUT_LONG(28, border);
+ __GLX_PUT_LONG(32, image_size);
+ if (image_size != 0) {
+ __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE,
+ data, image_size);
+ }
+ __GLX_END(cmdlen);
+ }
+ else {
+ __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexImage3D, cmdlen + 4);
+ __GLX_PUT_LONG(8, target);
+ __GLX_PUT_LONG(12, level);
+ __GLX_PUT_LONG(16, internal_format);
+ __GLX_PUT_LONG(20, width);
+ __GLX_PUT_LONG(24, height);
+ __GLX_PUT_LONG(28, depth);
+ __GLX_PUT_LONG(32, border);
+ __GLX_PUT_LONG(36, image_size);
+ __glXSendLargeCommand(gc, gc->pc,
+ __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + 4,
+ data, image_size);
+ }
}
void
-__indirect_glCompressedTexSubImage1DARB( GLenum target, GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLsizei image_size,
- const GLvoid *data )
+__indirect_glCompressedTexSubImage1DARB(GLenum target, GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format, GLsizei image_size,
+ const GLvoid * data)
{
- CompressedTexSubImage1D2D( target, level, xoffset, 0, width, 0,
- format, image_size, data,
- X_GLrop_CompressedTexSubImage1D );
+ CompressedTexSubImage1D2D(target, level, xoffset, 0, width, 0,
+ format, image_size, data,
+ X_GLrop_CompressedTexSubImage1D);
}
void
-__indirect_glCompressedTexSubImage2DARB( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLsizei image_size,
- const GLvoid *data )
+__indirect_glCompressedTexSubImage2DARB(GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLsizei image_size,
+ const GLvoid * data)
{
- CompressedTexSubImage1D2D( target, level, xoffset, yoffset, width, height,
- format, image_size, data,
- X_GLrop_CompressedTexSubImage2D );
+ CompressedTexSubImage1D2D(target, level, xoffset, yoffset, width, height,
+ format, image_size, data,
+ X_GLrop_CompressedTexSubImage2D);
}
void
-__indirect_glCompressedTexSubImage3DARB( GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLsizei image_size,
- const GLvoid *data )
+__indirect_glCompressedTexSubImage3DARB(GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLenum format, GLsizei image_size,
+ const GLvoid * data)
{
- __GLX_DECLARE_VARIABLES();
-
- __GLX_LOAD_VARIABLES();
- if ( gc->currentDpy == NULL ) {
- return;
- }
-
- cmdlen = __GLX_PAD( __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE
- + image_size );
- if ( cmdlen <= gc->maxSmallRenderCommandSize ) {
- __GLX_BEGIN_VARIABLE( X_GLrop_CompressedTexSubImage3D, cmdlen );
- __GLX_PUT_LONG( 4, target );
- __GLX_PUT_LONG( 8, level );
- __GLX_PUT_LONG( 12, xoffset );
- __GLX_PUT_LONG( 16, yoffset );
- __GLX_PUT_LONG( 20, zoffset );
- __GLX_PUT_LONG( 24, width );
- __GLX_PUT_LONG( 28, height );
- __GLX_PUT_LONG( 32, depth );
- __GLX_PUT_LONG( 36, format );
- __GLX_PUT_LONG( 40, image_size );
- if ( image_size != 0 ) {
- __GLX_PUT_CHAR_ARRAY( __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE,
- data, image_size );
- }
- __GLX_END( cmdlen );
- }
- else {
- __GLX_BEGIN_VARIABLE_LARGE( X_GLrop_CompressedTexSubImage3D,
- cmdlen + 4 );
- __GLX_PUT_LONG( 8, target );
- __GLX_PUT_LONG( 12, level );
- __GLX_PUT_LONG( 16, xoffset );
- __GLX_PUT_LONG( 20, yoffset );
- __GLX_PUT_LONG( 24, zoffset );
- __GLX_PUT_LONG( 28, width );
- __GLX_PUT_LONG( 32, height );
- __GLX_PUT_LONG( 36, depth );
- __GLX_PUT_LONG( 40, format );
- __GLX_PUT_LONG( 44, image_size );
- __glXSendLargeCommand( gc, gc->pc,
- __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE + 4,
- data, image_size );
- }
+ __GLX_DECLARE_VARIABLES();
+
+ __GLX_LOAD_VARIABLES();
+ if (gc->currentDpy == NULL) {
+ return;
+ }
+
+ cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE
+ + image_size);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexSubImage3D, cmdlen);
+ __GLX_PUT_LONG(4, target);
+ __GLX_PUT_LONG(8, level);
+ __GLX_PUT_LONG(12, xoffset);
+ __GLX_PUT_LONG(16, yoffset);
+ __GLX_PUT_LONG(20, zoffset);
+ __GLX_PUT_LONG(24, width);
+ __GLX_PUT_LONG(28, height);
+ __GLX_PUT_LONG(32, depth);
+ __GLX_PUT_LONG(36, format);
+ __GLX_PUT_LONG(40, image_size);
+ if (image_size != 0) {
+ __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE,
+ data, image_size);
+ }
+ __GLX_END(cmdlen);
+ }
+ else {
+ __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexSubImage3D, cmdlen + 4);
+ __GLX_PUT_LONG(8, target);
+ __GLX_PUT_LONG(12, level);
+ __GLX_PUT_LONG(16, xoffset);
+ __GLX_PUT_LONG(20, yoffset);
+ __GLX_PUT_LONG(24, zoffset);
+ __GLX_PUT_LONG(28, width);
+ __GLX_PUT_LONG(32, height);
+ __GLX_PUT_LONG(36, depth);
+ __GLX_PUT_LONG(40, format);
+ __GLX_PUT_LONG(44, image_size);
+ __glXSendLargeCommand(gc, gc->pc,
+ __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE + 4,
+ data, image_size);
+ }
}
diff --git a/src/glx/x11/indirect_transpose_matrix.c b/src/glx/x11/indirect_transpose_matrix.c
index 2144410e5a..14acee8eec 100644
--- a/src/glx/x11/indirect_transpose_matrix.c
+++ b/src/glx/x11/indirect_transpose_matrix.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
@@ -25,59 +26,61 @@
#include <GL/gl.h>
#include "indirect.h"
-static void TransposeMatrixf(const GLfloat s[16], GLfloat d[16])
+static void
+TransposeMatrixf(const GLfloat s[16], GLfloat d[16])
{
- int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- d[i*4+j] = s[j*4+i];
- }
- }
+ int i, j;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ d[i * 4 + j] = s[j * 4 + i];
+ }
+ }
}
-static void TransposeMatrixd(const GLdouble s[16], GLdouble d[16])
+static void
+TransposeMatrixd(const GLdouble s[16], GLdouble d[16])
{
- int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- d[i*4+j] = s[j*4+i];
- }
- }
+ int i, j;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ d[i * 4 + j] = s[j * 4 + i];
+ }
+ }
}
void
-__indirect_glLoadTransposeMatrixdARB( const GLdouble * m )
+__indirect_glLoadTransposeMatrixdARB(const GLdouble * m)
{
GLdouble mt[16];
-
- TransposeMatrixd( m, mt );
- __indirect_glLoadMatrixd( mt );
+
+ TransposeMatrixd(m, mt);
+ __indirect_glLoadMatrixd(mt);
}
void
-__indirect_glLoadTransposeMatrixfARB( const GLfloat * m )
+__indirect_glLoadTransposeMatrixfARB(const GLfloat * m)
{
GLfloat mt[16];
- TransposeMatrixf( m, mt );
- __indirect_glLoadMatrixf( mt );
+ TransposeMatrixf(m, mt);
+ __indirect_glLoadMatrixf(mt);
}
void
-__indirect_glMultTransposeMatrixdARB( const GLdouble * m )
+__indirect_glMultTransposeMatrixdARB(const GLdouble * m)
{
GLdouble mt[16];
-
- TransposeMatrixd( m, mt );
- __indirect_glMultMatrixd( mt );
+
+ TransposeMatrixd(m, mt);
+ __indirect_glMultMatrixd(mt);
}
void
-__indirect_glMultTransposeMatrixfARB( const GLfloat * m )
+__indirect_glMultTransposeMatrixfARB(const GLfloat * m)
{
GLfloat mt[16];
- TransposeMatrixf( m, mt );
- __indirect_glMultMatrixf( mt );
+ TransposeMatrixf(m, mt);
+ __indirect_glMultMatrixf(mt);
}
diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c
index c7a20e2bc5..b7744bceac 100644
--- a/src/glx/x11/indirect_vertex_array.c
+++ b/src/glx/x11/indirect_vertex_array.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004, 2005
* All Rights Reserved.
@@ -65,25 +66,28 @@
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
-static void emit_DrawArrays_none( GLenum mode, GLint first, GLsizei count );
-static void emit_DrawArrays_old ( GLenum mode, GLint first, GLsizei count );
+static void emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count);
+static void emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count);
-static void emit_DrawElements_none( GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices );
-static void emit_DrawElements_old ( GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices );
+static void emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices);
+static void emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices);
-static GLubyte * emit_element_none( GLubyte * dst,
- const struct array_state_vector * arrays, unsigned index );
-static GLubyte * emit_element_old( GLubyte * dst,
- const struct array_state_vector * arrays, unsigned index );
-static struct array_state * get_array_entry(
- const struct array_state_vector * arrays, GLenum key, unsigned index );
-static void fill_array_info_cache( struct array_state_vector * arrays );
-static GLboolean validate_mode(__GLXcontext *gc, GLenum mode);
-static GLboolean validate_count(__GLXcontext *gc, GLsizei count);
-static GLboolean validate_type(__GLXcontext *gc, GLenum type);
+static GLubyte *emit_element_none(GLubyte * dst,
+ const struct array_state_vector *arrays,
+ unsigned index);
+static GLubyte *emit_element_old(GLubyte * dst,
+ const struct array_state_vector *arrays,
+ unsigned index);
+static struct array_state *get_array_entry(const struct array_state_vector
+ *arrays, GLenum key,
+ unsigned index);
+static void fill_array_info_cache(struct array_state_vector *arrays);
+static GLboolean validate_mode(__GLXcontext * gc, GLenum mode);
+static GLboolean validate_count(__GLXcontext * gc, GLsizei count);
+static GLboolean validate_type(__GLXcontext * gc, GLenum type);
/**
@@ -97,7 +101,7 @@ static GLboolean validate_type(__GLXcontext *gc, GLenum type);
* \c GL_3_BYTES, or \c GL_4_BYTES.
*/
const GLuint __glXTypeSize_table[16] = {
- 1, 1, 2, 2, 4, 4, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0
+ 1, 1, 2, 2, 4, 4, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0
};
@@ -106,24 +110,23 @@ const GLuint __glXTypeSize_table[16] = {
* __glXInitVertexArrayState().
*/
void
-__glXFreeVertexArrayState( __GLXcontext * gc )
+__glXFreeVertexArrayState(__GLXcontext * gc)
{
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector* arrays = state->array_state;
-
- if (arrays) {
- if (arrays->stack) {
- free(arrays->stack);
- arrays->stack = NULL;
- }
- if (arrays->arrays) {
- free(arrays->arrays);
- arrays->arrays = NULL;
- }
- free(arrays);
- arrays = NULL;
- state->array_state = NULL;
- }
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+
+ if (arrays) {
+ if (arrays->stack) {
+ free(arrays->stack);
+ arrays->stack = NULL;
+ }
+ if (arrays->arrays) {
+ free(arrays->arrays);
+ arrays->arrays = NULL;
+ }
+ free(arrays);
+ state->array_state = NULL;
+ }
}
@@ -142,154 +145,154 @@ __glXFreeVertexArrayState( __GLXcontext * gc )
* Return values from malloc are not properly tested.
*/
void
-__glXInitVertexArrayState( __GLXcontext * gc )
+__glXInitVertexArrayState(__GLXcontext * gc)
{
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays;
-
- unsigned array_count;
- int texture_units = 1, vertex_program_attribs = 0;
- unsigned i, j;
-
- GLboolean got_fog = GL_FALSE;
- GLboolean got_secondary_color = GL_FALSE;
-
-
- arrays = calloc( 1, sizeof( struct array_state_vector ) );
- state->array_state = arrays;
-
- arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
- arrays->new_DrawArrays_possible = GL_FALSE;
- arrays->DrawArrays = NULL;
-
- arrays->active_texture_unit = 0;
-
-
- /* Determine how many arrays are actually needed. Only arrays that
- * are supported by the server are create. For example, if the server
- * supports only 2 texture units, then only 2 texture coordinate arrays
- * are created.
- *
- * At the very least, GL_VERTEX_ARRAY, GL_NORMAL_ARRAY,
- * GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
- * GL_EDGE_FLAG_ARRAY are supported.
- */
-
- array_count = 5;
-
- if ( __glExtensionBitIsEnabled( gc, GL_EXT_fog_coord_bit )
- || (gc->server_major > 1) || (gc->server_minor >= 4) ) {
- got_fog = GL_TRUE;
- array_count++;
- }
-
- if ( __glExtensionBitIsEnabled( gc, GL_EXT_secondary_color_bit )
- || (gc->server_major > 1) || (gc->server_minor >= 4) ) {
- got_secondary_color = GL_TRUE;
- array_count++;
- }
-
- if ( __glExtensionBitIsEnabled( gc, GL_ARB_multitexture_bit )
- || (gc->server_major > 1) || (gc->server_minor >= 3) ) {
- __indirect_glGetIntegerv( GL_MAX_TEXTURE_UNITS, & texture_units );
- }
-
- if ( __glExtensionBitIsEnabled( gc, GL_ARB_vertex_program_bit ) ) {
- __indirect_glGetProgramivARB( GL_VERTEX_PROGRAM_ARB,
- GL_MAX_PROGRAM_ATTRIBS_ARB,
- & vertex_program_attribs );
- }
-
- arrays->num_texture_units = texture_units;
- arrays->num_vertex_program_attribs = vertex_program_attribs;
- array_count += texture_units + vertex_program_attribs;
- arrays->num_arrays = array_count;
- arrays->arrays = calloc( array_count, sizeof( struct array_state ) );
-
- arrays->arrays[0].data_type = GL_FLOAT;
- arrays->arrays[0].count = 3;
- arrays->arrays[0].key = GL_NORMAL_ARRAY;
- arrays->arrays[0].normalized = GL_TRUE;
- arrays->arrays[0].old_DrawArrays_possible = GL_TRUE;
-
- arrays->arrays[1].data_type = GL_FLOAT;
- arrays->arrays[1].count = 4;
- arrays->arrays[1].key = GL_COLOR_ARRAY;
- arrays->arrays[1].normalized = GL_TRUE;
- arrays->arrays[1].old_DrawArrays_possible = GL_TRUE;
-
- arrays->arrays[2].data_type = GL_FLOAT;
- arrays->arrays[2].count = 1;
- arrays->arrays[2].key = GL_INDEX_ARRAY;
- arrays->arrays[2].old_DrawArrays_possible = GL_TRUE;
-
- arrays->arrays[3].data_type = GL_UNSIGNED_BYTE;
- arrays->arrays[3].count = 1;
- arrays->arrays[3].key = GL_EDGE_FLAG_ARRAY;
- arrays->arrays[3].old_DrawArrays_possible = GL_TRUE;
-
- for ( i = 0 ; i < texture_units ; i++ ) {
- arrays->arrays[4 + i].data_type = GL_FLOAT;
- arrays->arrays[4 + i].count = 4;
- arrays->arrays[4 + i].key = GL_TEXTURE_COORD_ARRAY;
-
- arrays->arrays[4 + i].old_DrawArrays_possible = (i == 0);
- arrays->arrays[4 + i].index = i;
-
- arrays->arrays[4 + i].header[1] = i + GL_TEXTURE0;
- }
-
- i = 4 + texture_units;
-
- if ( got_fog ) {
- arrays->arrays[i].data_type = GL_FLOAT;
- arrays->arrays[i].count = 1;
- arrays->arrays[i].key = GL_FOG_COORDINATE_ARRAY;
- arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
- i++;
- }
-
- if ( got_secondary_color ) {
- arrays->arrays[i].data_type = GL_FLOAT;
- arrays->arrays[i].count = 3;
- arrays->arrays[i].key = GL_SECONDARY_COLOR_ARRAY;
- arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
- arrays->arrays[i].normalized = GL_TRUE;
- i++;
- }
-
-
- for ( j = 0 ; j < vertex_program_attribs ; j++ ) {
- const unsigned idx = (vertex_program_attribs - (j + 1));
-
-
- arrays->arrays[idx + i].data_type = GL_FLOAT;
- arrays->arrays[idx + i].count = 4;
- arrays->arrays[idx + i].key = GL_VERTEX_ATTRIB_ARRAY_POINTER;
-
- arrays->arrays[idx + i].old_DrawArrays_possible = 0;
- arrays->arrays[idx + i].index = idx;
-
- arrays->arrays[idx + i].header[1] = idx;
- }
-
- i += vertex_program_attribs;
-
-
- /* Vertex array *must* be last becuase of the way that
- * emit_DrawArrays_none works.
- */
-
- arrays->arrays[i].data_type = GL_FLOAT;
- arrays->arrays[i].count = 4;
- arrays->arrays[i].key = GL_VERTEX_ARRAY;
- arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
-
- assert( (i + 1) == arrays->num_arrays );
-
- arrays->stack_index = 0;
- arrays->stack = malloc( sizeof( struct array_stack_state )
- * arrays->num_arrays );
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays;
+
+ unsigned array_count;
+ int texture_units = 1, vertex_program_attribs = 0;
+ unsigned i, j;
+
+ GLboolean got_fog = GL_FALSE;
+ GLboolean got_secondary_color = GL_FALSE;
+
+
+ arrays = calloc(1, sizeof(struct array_state_vector));
+ state->array_state = arrays;
+
+ arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
+ arrays->new_DrawArrays_possible = GL_FALSE;
+ arrays->DrawArrays = NULL;
+
+ arrays->active_texture_unit = 0;
+
+
+ /* Determine how many arrays are actually needed. Only arrays that
+ * are supported by the server are create. For example, if the server
+ * supports only 2 texture units, then only 2 texture coordinate arrays
+ * are created.
+ *
+ * At the very least, GL_VERTEX_ARRAY, GL_NORMAL_ARRAY,
+ * GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
+ * GL_EDGE_FLAG_ARRAY are supported.
+ */
+
+ array_count = 5;
+
+ if (__glExtensionBitIsEnabled(gc, GL_EXT_fog_coord_bit)
+ || (gc->server_major > 1) || (gc->server_minor >= 4)) {
+ got_fog = GL_TRUE;
+ array_count++;
+ }
+
+ if (__glExtensionBitIsEnabled(gc, GL_EXT_secondary_color_bit)
+ || (gc->server_major > 1) || (gc->server_minor >= 4)) {
+ got_secondary_color = GL_TRUE;
+ array_count++;
+ }
+
+ if (__glExtensionBitIsEnabled(gc, GL_ARB_multitexture_bit)
+ || (gc->server_major > 1) || (gc->server_minor >= 3)) {
+ __indirect_glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units);
+ }
+
+ if (__glExtensionBitIsEnabled(gc, GL_ARB_vertex_program_bit)) {
+ __indirect_glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
+ GL_MAX_PROGRAM_ATTRIBS_ARB,
+ &vertex_program_attribs);
+ }
+
+ arrays->num_texture_units = texture_units;
+ arrays->num_vertex_program_attribs = vertex_program_attribs;
+ array_count += texture_units + vertex_program_attribs;
+ arrays->num_arrays = array_count;
+ arrays->arrays = calloc(array_count, sizeof(struct array_state));
+
+ arrays->arrays[0].data_type = GL_FLOAT;
+ arrays->arrays[0].count = 3;
+ arrays->arrays[0].key = GL_NORMAL_ARRAY;
+ arrays->arrays[0].normalized = GL_TRUE;
+ arrays->arrays[0].old_DrawArrays_possible = GL_TRUE;
+
+ arrays->arrays[1].data_type = GL_FLOAT;
+ arrays->arrays[1].count = 4;
+ arrays->arrays[1].key = GL_COLOR_ARRAY;
+ arrays->arrays[1].normalized = GL_TRUE;
+ arrays->arrays[1].old_DrawArrays_possible = GL_TRUE;
+
+ arrays->arrays[2].data_type = GL_FLOAT;
+ arrays->arrays[2].count = 1;
+ arrays->arrays[2].key = GL_INDEX_ARRAY;
+ arrays->arrays[2].old_DrawArrays_possible = GL_TRUE;
+
+ arrays->arrays[3].data_type = GL_UNSIGNED_BYTE;
+ arrays->arrays[3].count = 1;
+ arrays->arrays[3].key = GL_EDGE_FLAG_ARRAY;
+ arrays->arrays[3].old_DrawArrays_possible = GL_TRUE;
+
+ for (i = 0; i < texture_units; i++) {
+ arrays->arrays[4 + i].data_type = GL_FLOAT;
+ arrays->arrays[4 + i].count = 4;
+ arrays->arrays[4 + i].key = GL_TEXTURE_COORD_ARRAY;
+
+ arrays->arrays[4 + i].old_DrawArrays_possible = (i == 0);
+ arrays->arrays[4 + i].index = i;
+
+ arrays->arrays[4 + i].header[1] = i + GL_TEXTURE0;
+ }
+
+ i = 4 + texture_units;
+
+ if (got_fog) {
+ arrays->arrays[i].data_type = GL_FLOAT;
+ arrays->arrays[i].count = 1;
+ arrays->arrays[i].key = GL_FOG_COORDINATE_ARRAY;
+ arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
+ i++;
+ }
+
+ if (got_secondary_color) {
+ arrays->arrays[i].data_type = GL_FLOAT;
+ arrays->arrays[i].count = 3;
+ arrays->arrays[i].key = GL_SECONDARY_COLOR_ARRAY;
+ arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
+ arrays->arrays[i].normalized = GL_TRUE;
+ i++;
+ }
+
+
+ for (j = 0; j < vertex_program_attribs; j++) {
+ const unsigned idx = (vertex_program_attribs - (j + 1));
+
+
+ arrays->arrays[idx + i].data_type = GL_FLOAT;
+ arrays->arrays[idx + i].count = 4;
+ arrays->arrays[idx + i].key = GL_VERTEX_ATTRIB_ARRAY_POINTER;
+
+ arrays->arrays[idx + i].old_DrawArrays_possible = 0;
+ arrays->arrays[idx + i].index = idx;
+
+ arrays->arrays[idx + i].header[1] = idx;
+ }
+
+ i += vertex_program_attribs;
+
+
+ /* Vertex array *must* be last becuase of the way that
+ * emit_DrawArrays_none works.
+ */
+
+ arrays->arrays[i].data_type = GL_FLOAT;
+ arrays->arrays[i].count = 4;
+ arrays->arrays[i].key = GL_VERTEX_ARRAY;
+ arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
+
+ assert((i + 1) == arrays->num_arrays);
+
+ arrays->stack_index = 0;
+ arrays->stack = malloc(sizeof(struct array_stack_state)
+ * arrays->num_arrays);
}
@@ -299,19 +302,19 @@ __glXInitVertexArrayState( __GLXcontext * gc )
* implement the enabled vertex arrays.
*/
static size_t
-calculate_single_vertex_size_none( const struct array_state_vector * arrays )
+calculate_single_vertex_size_none(const struct array_state_vector *arrays)
{
- size_t single_vertex_size = 0;
- unsigned i;
+ size_t single_vertex_size = 0;
+ unsigned i;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( arrays->arrays[i].enabled ) {
- single_vertex_size += ((uint16_t *)arrays->arrays[i].header)[0];
- }
- }
-
- return single_vertex_size;
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if (arrays->arrays[i].enabled) {
+ single_vertex_size += ((uint16_t *) arrays->arrays[i].header)[0];
+ }
+ }
+
+ return single_vertex_size;
}
@@ -319,39 +322,37 @@ calculate_single_vertex_size_none( const struct array_state_vector * arrays )
* Emit a single element using non-DrawArrays protocol.
*/
GLubyte *
-emit_element_none( GLubyte * dst,
- const struct array_state_vector * arrays,
- unsigned index )
+emit_element_none(GLubyte * dst,
+ const struct array_state_vector * arrays, unsigned index)
{
- unsigned i;
+ unsigned i;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( arrays->arrays[i].enabled ) {
- const size_t offset = index * arrays->arrays[i].true_stride;
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if (arrays->arrays[i].enabled) {
+ const size_t offset = index * arrays->arrays[i].true_stride;
- /* The generic attributes can have more data than is in the
- * elements. This is because a vertex array can be a 2 element,
- * normalized, unsigned short, but the "closest" immediate mode
- * protocol is for a 4Nus. Since the sizes are small, the
- * performance impact on modern processors should be negligible.
- */
- (void) memset( dst, 0,
- ((uint16_t *)arrays->arrays[i].header)[0] );
+ /* The generic attributes can have more data than is in the
+ * elements. This is because a vertex array can be a 2 element,
+ * normalized, unsigned short, but the "closest" immediate mode
+ * protocol is for a 4Nus. Since the sizes are small, the
+ * performance impact on modern processors should be negligible.
+ */
+ (void) memset(dst, 0, ((uint16_t *) arrays->arrays[i].header)[0]);
- (void) memcpy( dst, arrays->arrays[i].header,
- arrays->arrays[i].header_size );
+ (void) memcpy(dst, arrays->arrays[i].header,
+ arrays->arrays[i].header_size);
- dst += arrays->arrays[i].header_size;
+ dst += arrays->arrays[i].header_size;
- (void) memcpy( dst, ((GLubyte *) arrays->arrays[i].data) + offset,
- arrays->arrays[i].element_size );
+ (void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
+ arrays->arrays[i].element_size);
- dst += __GLX_PAD( arrays->arrays[i].element_size );
- }
- }
+ dst += __GLX_PAD(arrays->arrays[i].element_size);
+ }
+ }
- return dst;
+ return dst;
}
@@ -360,120 +361,119 @@ emit_element_none( GLubyte * dst,
* EXT_vertex_arrays / OpenGL 1.1.
*/
GLubyte *
-emit_element_old( GLubyte * dst,
- const struct array_state_vector * arrays,
- unsigned index )
+emit_element_old(GLubyte * dst,
+ const struct array_state_vector * arrays, unsigned index)
{
- unsigned i;
+ unsigned i;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( arrays->arrays[i].enabled ) {
- const size_t offset = index * arrays->arrays[i].true_stride;
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if (arrays->arrays[i].enabled) {
+ const size_t offset = index * arrays->arrays[i].true_stride;
- (void) memcpy( dst, ((GLubyte *) arrays->arrays[i].data) + offset,
- arrays->arrays[i].element_size );
+ (void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
+ arrays->arrays[i].element_size);
- dst += __GLX_PAD( arrays->arrays[i].element_size );
- }
- }
+ dst += __GLX_PAD(arrays->arrays[i].element_size);
+ }
+ }
- return dst;
+ return dst;
}
struct array_state *
-get_array_entry( const struct array_state_vector * arrays,
- GLenum key, unsigned index )
+get_array_entry(const struct array_state_vector *arrays,
+ GLenum key, unsigned index)
{
- unsigned i;
-
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( (arrays->arrays[i].key == key)
- && (arrays->arrays[i].index == index) ) {
- return & arrays->arrays[i];
- }
- }
-
- return NULL;
+ unsigned i;
+
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if ((arrays->arrays[i].key == key)
+ && (arrays->arrays[i].index == index)) {
+ return &arrays->arrays[i];
+ }
+ }
+
+ return NULL;
}
static GLboolean
-allocate_array_info_cache( struct array_state_vector * arrays,
- size_t required_size )
+allocate_array_info_cache(struct array_state_vector *arrays,
+ size_t required_size)
{
#define MAX_HEADER_SIZE 20
- if ( arrays->array_info_cache_buffer_size < required_size ) {
- GLubyte * temp = realloc( arrays->array_info_cache_base,
- required_size + MAX_HEADER_SIZE );
+ if (arrays->array_info_cache_buffer_size < required_size) {
+ GLubyte *temp = realloc(arrays->array_info_cache_base,
+ required_size + MAX_HEADER_SIZE);
- if ( temp == NULL ) {
- return GL_FALSE;
- }
+ if (temp == NULL) {
+ return GL_FALSE;
+ }
- arrays->array_info_cache_base = temp;
- arrays->array_info_cache = temp + MAX_HEADER_SIZE;
- arrays->array_info_cache_buffer_size = required_size;
- }
+ arrays->array_info_cache_base = temp;
+ arrays->array_info_cache = temp + MAX_HEADER_SIZE;
+ arrays->array_info_cache_buffer_size = required_size;
+ }
- arrays->array_info_cache_size = required_size;
- return GL_TRUE;
+ arrays->array_info_cache_size = required_size;
+ return GL_TRUE;
}
/**
*/
void
-fill_array_info_cache( struct array_state_vector * arrays )
+fill_array_info_cache(struct array_state_vector *arrays)
{
- GLboolean old_DrawArrays_possible;
- unsigned i;
-
-
- /* Determine how many arrays are enabled.
- */
-
- arrays->enabled_client_array_count = 0;
- old_DrawArrays_possible = arrays->old_DrawArrays_possible;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( arrays->arrays[i].enabled ) {
- arrays->enabled_client_array_count++;
- old_DrawArrays_possible &= arrays->arrays[i].old_DrawArrays_possible;
- }
- }
-
- if ( arrays->new_DrawArrays_possible ) {
- assert( ! arrays->new_DrawArrays_possible );
- }
- else if ( old_DrawArrays_possible ) {
- const size_t required_size = arrays->enabled_client_array_count * 12;
- uint32_t * info;
-
-
- if ( ! allocate_array_info_cache( arrays, required_size ) ) {
- return;
- }
-
-
- info = (uint32_t *) arrays->array_info_cache;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( arrays->arrays[i].enabled ) {
- *(info++) = arrays->arrays[i].data_type;
- *(info++) = arrays->arrays[i].count;
- *(info++) = arrays->arrays[i].key;
- }
- }
-
- arrays->DrawArrays = emit_DrawArrays_old;
- arrays->DrawElements = emit_DrawElements_old;
- }
- else {
- arrays->DrawArrays = emit_DrawArrays_none;
- arrays->DrawElements = emit_DrawElements_none;
- }
-
- arrays->array_info_cache_valid = GL_TRUE;
+ GLboolean old_DrawArrays_possible;
+ unsigned i;
+
+
+ /* Determine how many arrays are enabled.
+ */
+
+ arrays->enabled_client_array_count = 0;
+ old_DrawArrays_possible = arrays->old_DrawArrays_possible;
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if (arrays->arrays[i].enabled) {
+ arrays->enabled_client_array_count++;
+ old_DrawArrays_possible &= arrays->arrays[i].old_DrawArrays_possible;
+ }
+ }
+
+ if (arrays->new_DrawArrays_possible) {
+ assert(!arrays->new_DrawArrays_possible);
+ }
+ else if (old_DrawArrays_possible) {
+ const size_t required_size = arrays->enabled_client_array_count * 12;
+ uint32_t *info;
+
+
+ if (!allocate_array_info_cache(arrays, required_size)) {
+ return;
+ }
+
+
+ info = (uint32_t *) arrays->array_info_cache;
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if (arrays->arrays[i].enabled) {
+ *(info++) = arrays->arrays[i].data_type;
+ *(info++) = arrays->arrays[i].count;
+ *(info++) = arrays->arrays[i].key;
+ }
+ }
+
+ arrays->DrawArrays = emit_DrawArrays_old;
+ arrays->DrawElements = emit_DrawElements_old;
+ }
+ else {
+ arrays->DrawArrays = emit_DrawArrays_none;
+ arrays->DrawElements = emit_DrawElements_none;
+ }
+
+ arrays->array_info_cache_valid = GL_TRUE;
}
@@ -485,48 +485,48 @@ fill_array_info_cache( struct array_state_vector * arrays )
* vertex state is enabled that is not compatible with that protocol.
*/
void
-emit_DrawArrays_none( GLenum mode, GLint first, GLsizei count )
+emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
- size_t single_vertex_size;
- GLubyte * pc;
- unsigned i;
- static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
- static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
+ size_t single_vertex_size;
+ GLubyte *pc;
+ unsigned i;
+ static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
+ static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
- single_vertex_size = calculate_single_vertex_size_none( arrays );
+ single_vertex_size = calculate_single_vertex_size_none(arrays);
- pc = gc->pc;
+ pc = gc->pc;
- (void) memcpy( pc, begin_cmd, 4 );
- *(int *)(pc + 4) = mode;
+ (void) memcpy(pc, begin_cmd, 4);
+ *(int *) (pc + 4) = mode;
- pc += 8;
+ pc += 8;
- for ( i = 0 ; i < count ; i++ ) {
- if ( (pc + single_vertex_size) >= gc->bufEnd ) {
- pc = __glXFlushRenderBuffer(gc, pc);
- }
+ for (i = 0; i < count; i++) {
+ if ((pc + single_vertex_size) >= gc->bufEnd) {
+ pc = __glXFlushRenderBuffer(gc, pc);
+ }
- pc = emit_element_none( pc, arrays, first + i );
- }
+ pc = emit_element_none(pc, arrays, first + i);
+ }
- if ( (pc + 4) >= gc->bufEnd ) {
- pc = __glXFlushRenderBuffer(gc, pc);
- }
+ if ((pc + 4) >= gc->bufEnd) {
+ pc = __glXFlushRenderBuffer(gc, pc);
+ }
- (void) memcpy( pc, end_cmd, 4 );
- pc += 4;
+ (void) memcpy(pc, end_cmd, 4);
+ pc += 4;
- gc->pc = pc;
- if ( gc->pc > gc->limit ) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
+ gc->pc = pc;
+ if (gc->pc > gc->limit) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
}
@@ -549,323 +549,321 @@ emit_DrawArrays_none( GLenum mode, GLint first, GLsizei count )
* A pointer to the buffer for array data.
*/
static GLubyte *
-emit_DrawArrays_header_old( __GLXcontext * gc,
- struct array_state_vector * arrays,
- size_t * elements_per_request,
- unsigned int * total_requests,
- GLenum mode, GLsizei count )
+emit_DrawArrays_header_old(__GLXcontext * gc,
+ struct array_state_vector *arrays,
+ size_t * elements_per_request,
+ unsigned int *total_requests,
+ GLenum mode, GLsizei count)
{
- size_t command_size;
- size_t single_vertex_size;
- const unsigned header_size = 16;
- unsigned i;
- GLubyte * pc;
-
-
- /* Determine the size of the whole command. This includes the header,
- * the ARRAY_INFO data and the array data. Once this size is calculated,
- * it will be known whether a Render or RenderLarge command is needed.
- */
-
- single_vertex_size = 0;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- if ( arrays->arrays[i].enabled ) {
- single_vertex_size += __GLX_PAD( arrays->arrays[i].element_size );
- }
- }
-
- command_size = arrays->array_info_cache_size + header_size
+ size_t command_size;
+ size_t single_vertex_size;
+ const unsigned header_size = 16;
+ unsigned i;
+ GLubyte *pc;
+
+
+ /* Determine the size of the whole command. This includes the header,
+ * the ARRAY_INFO data and the array data. Once this size is calculated,
+ * it will be known whether a Render or RenderLarge command is needed.
+ */
+
+ single_vertex_size = 0;
+ for (i = 0; i < arrays->num_arrays; i++) {
+ if (arrays->arrays[i].enabled) {
+ single_vertex_size += __GLX_PAD(arrays->arrays[i].element_size);
+ }
+ }
+
+ command_size = arrays->array_info_cache_size + header_size
+ (single_vertex_size * count);
- /* Write the header for either a Render command or a RenderLarge
- * command. After the header is written, write the ARRAY_INFO data.
- */
+ /* Write the header for either a Render command or a RenderLarge
+ * command. After the header is written, write the ARRAY_INFO data.
+ */
+
+ if (command_size > gc->maxSmallRenderCommandSize) {
+ /* maxSize is the maximum amount of data can be stuffed into a single
+ * packet. sz_xGLXRenderReq is added because bufSize is the maximum
+ * packet size minus sz_xGLXRenderReq.
+ */
+ const size_t maxSize = (gc->bufSize + sz_xGLXRenderReq)
+ - sz_xGLXRenderLargeReq;
+ unsigned vertex_requests;
- if ( command_size > gc->maxSmallRenderCommandSize ) {
- /* maxSize is the maximum amount of data can be stuffed into a single
- * packet. sz_xGLXRenderReq is added because bufSize is the maximum
- * packet size minus sz_xGLXRenderReq.
- */
- const size_t maxSize = (gc->bufSize + sz_xGLXRenderReq)
- - sz_xGLXRenderLargeReq;
- unsigned vertex_requests;
+ /* Calculate the number of data packets that will be required to send
+ * the whole command. To do this, the number of verticies that
+ * will fit in a single buffer must be calculated.
+ *
+ * The important value here is elements_per_request. This is the
+ * number of complete array elements that will fit in a single
+ * buffer. There may be some wasted space at the end of the buffer,
+ * but splitting elements across buffer boundries would be painful.
+ */
- /* Calculate the number of data packets that will be required to send
- * the whole command. To do this, the number of verticies that
- * will fit in a single buffer must be calculated.
- *
- * The important value here is elements_per_request. This is the
- * number of complete array elements that will fit in a single
- * buffer. There may be some wasted space at the end of the buffer,
- * but splitting elements across buffer boundries would be painful.
- */
+ elements_per_request[0] = maxSize / single_vertex_size;
- elements_per_request[0] = maxSize / single_vertex_size;
+ vertex_requests = (count + elements_per_request[0] - 1)
+ / elements_per_request[0];
- vertex_requests = (count + elements_per_request[0] - 1)
- / elements_per_request[0];
-
- *total_requests = vertex_requests + 1;
+ *total_requests = vertex_requests + 1;
- __glXFlushRenderBuffer(gc, gc->pc);
+ __glXFlushRenderBuffer(gc, gc->pc);
- command_size += 4;
+ command_size += 4;
- pc = ((GLubyte *) arrays->array_info_cache) - (header_size + 4);
- *(uint32_t *)(pc + 0) = command_size;
- *(uint32_t *)(pc + 4) = X_GLrop_DrawArrays;
- *(uint32_t *)(pc + 8) = count;
- *(uint32_t *)(pc + 12) = arrays->enabled_client_array_count;
- *(uint32_t *)(pc + 16) = mode;
+ pc = ((GLubyte *) arrays->array_info_cache) - (header_size + 4);
+ *(uint32_t *) (pc + 0) = command_size;
+ *(uint32_t *) (pc + 4) = X_GLrop_DrawArrays;
+ *(uint32_t *) (pc + 8) = count;
+ *(uint32_t *) (pc + 12) = arrays->enabled_client_array_count;
+ *(uint32_t *) (pc + 16) = mode;
- __glXSendLargeChunk( gc, 1, *total_requests, pc,
- header_size + 4 + arrays->array_info_cache_size );
+ __glXSendLargeChunk(gc, 1, *total_requests, pc,
+ header_size + 4 + arrays->array_info_cache_size);
- pc = gc->pc;
- }
- else {
- if ( (gc->pc + command_size) >= gc->bufEnd ) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
+ pc = gc->pc;
+ }
+ else {
+ if ((gc->pc + command_size) >= gc->bufEnd) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
- pc = gc->pc;
- *(uint16_t *)(pc + 0) = command_size;
- *(uint16_t *)(pc + 2) = X_GLrop_DrawArrays;
- *(uint32_t *)(pc + 4) = count;
- *(uint32_t *)(pc + 8) = arrays->enabled_client_array_count;
- *(uint32_t *)(pc + 12) = mode;
+ pc = gc->pc;
+ *(uint16_t *) (pc + 0) = command_size;
+ *(uint16_t *) (pc + 2) = X_GLrop_DrawArrays;
+ *(uint32_t *) (pc + 4) = count;
+ *(uint32_t *) (pc + 8) = arrays->enabled_client_array_count;
+ *(uint32_t *) (pc + 12) = mode;
- pc += header_size;
+ pc += header_size;
- (void) memcpy( pc, arrays->array_info_cache,
- arrays->array_info_cache_size );
- pc += arrays->array_info_cache_size;
+ (void) memcpy(pc, arrays->array_info_cache,
+ arrays->array_info_cache_size);
+ pc += arrays->array_info_cache_size;
- *elements_per_request = count;
- *total_requests = 0;
- }
+ *elements_per_request = count;
+ *total_requests = 0;
+ }
- return pc;
+ return pc;
}
/**
*/
void
-emit_DrawArrays_old( GLenum mode, GLint first, GLsizei count )
+emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+
+ GLubyte *pc;
+ size_t elements_per_request;
+ unsigned total_requests = 0;
+ unsigned i;
+ size_t total_sent = 0;
- GLubyte * pc;
- size_t elements_per_request;
- unsigned total_requests = 0;
- unsigned i;
- size_t total_sent = 0;
+ pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
+ &total_requests, mode, count);
- pc = emit_DrawArrays_header_old( gc, arrays, & elements_per_request,
- & total_requests, mode, count);
-
- /* Write the arrays.
- */
+ /* Write the arrays.
+ */
- if ( total_requests == 0 ) {
- assert( elements_per_request >= count );
+ if (total_requests == 0) {
+ assert(elements_per_request >= count);
- for ( i = 0 ; i < count ; i++ ) {
- pc = emit_element_old( pc, arrays, i + first );
- }
+ for (i = 0; i < count; i++) {
+ pc = emit_element_old(pc, arrays, i + first);
+ }
- assert( pc <= gc->bufEnd );
+ assert(pc <= gc->bufEnd);
- gc->pc = pc;
- if ( gc->pc > gc->limit ) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
- }
- else {
- unsigned req;
+ gc->pc = pc;
+ if (gc->pc > gc->limit) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+ }
+ else {
+ unsigned req;
- for ( req = 2 ; req <= total_requests ; req++ ) {
- if ( count < elements_per_request ) {
- elements_per_request = count;
- }
+ for (req = 2; req <= total_requests; req++) {
+ if (count < elements_per_request) {
+ elements_per_request = count;
+ }
- pc = gc->pc;
- for ( i = 0 ; i < elements_per_request ; i++ ) {
- pc = emit_element_old( pc, arrays, i + first );
- }
+ pc = gc->pc;
+ for (i = 0; i < elements_per_request; i++) {
+ pc = emit_element_old(pc, arrays, i + first);
+ }
- first += elements_per_request;
+ first += elements_per_request;
- total_sent += (size_t) (pc - gc->pc);
- __glXSendLargeChunk( gc, req, total_requests, gc->pc,
- pc - gc->pc );
+ total_sent += (size_t) (pc - gc->pc);
+ __glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
- count -= elements_per_request;
- }
- }
+ count -= elements_per_request;
+ }
+ }
}
void
-emit_DrawElements_none( GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices )
+emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
- static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
+ static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
- GLubyte * pc;
- size_t single_vertex_size;
- unsigned i;
+ GLubyte *pc;
+ size_t single_vertex_size;
+ unsigned i;
- single_vertex_size = calculate_single_vertex_size_none( arrays );
+ single_vertex_size = calculate_single_vertex_size_none(arrays);
- if ( (gc->pc + single_vertex_size) >= gc->bufEnd ) {
- gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
- }
+ if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
+ gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
+ }
- pc = gc->pc;
+ pc = gc->pc;
- (void) memcpy( pc, begin_cmd, 4 );
- *(int *)(pc + 4) = mode;
+ (void) memcpy(pc, begin_cmd, 4);
+ *(int *) (pc + 4) = mode;
- pc += 8;
+ pc += 8;
- for ( i = 0 ; i < count ; i++ ) {
- unsigned index = 0;
+ for (i = 0; i < count; i++) {
+ unsigned index = 0;
- if ( (pc + single_vertex_size) >= gc->bufEnd ) {
- pc = __glXFlushRenderBuffer(gc, pc);
- }
+ if ((pc + single_vertex_size) >= gc->bufEnd) {
+ pc = __glXFlushRenderBuffer(gc, pc);
+ }
- switch( type ) {
- case GL_UNSIGNED_INT:
- index = (unsigned) (((GLuint *) indices)[i]);
- break;
- case GL_UNSIGNED_SHORT:
- index = (unsigned) (((GLushort *) indices)[i]);
- break;
- case GL_UNSIGNED_BYTE:
- index = (unsigned) (((GLubyte *) indices)[i]);
- break;
- }
- pc = emit_element_none( pc, arrays, index );
- }
+ switch (type) {
+ case GL_UNSIGNED_INT:
+ index = (unsigned) (((GLuint *) indices)[i]);
+ break;
+ case GL_UNSIGNED_SHORT:
+ index = (unsigned) (((GLushort *) indices)[i]);
+ break;
+ case GL_UNSIGNED_BYTE:
+ index = (unsigned) (((GLubyte *) indices)[i]);
+ break;
+ }
+ pc = emit_element_none(pc, arrays, index);
+ }
- if ( (pc + 4) >= gc->bufEnd ) {
- pc = __glXFlushRenderBuffer(gc, pc);
- }
+ if ((pc + 4) >= gc->bufEnd) {
+ pc = __glXFlushRenderBuffer(gc, pc);
+ }
- (void) memcpy( pc, end_cmd, 4 );
- pc += 4;
+ (void) memcpy(pc, end_cmd, 4);
+ pc += 4;
- gc->pc = pc;
- if ( gc->pc > gc->limit ) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
+ gc->pc = pc;
+ if (gc->pc > gc->limit) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
}
/**
*/
void
-emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices )
+emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
-
- GLubyte * pc;
- size_t elements_per_request;
- unsigned total_requests = 0;
- unsigned i;
- unsigned req;
- unsigned req_element=0;
-
-
- pc = emit_DrawArrays_header_old( gc, arrays, & elements_per_request,
- & total_requests, mode, count);
-
-
- /* Write the arrays.
- */
-
- req = 2;
- while ( count > 0 ) {
- if ( count < elements_per_request ) {
- elements_per_request = count;
- }
-
- switch( type ) {
- case GL_UNSIGNED_INT: {
- const GLuint * ui_ptr = (const GLuint *) indices + req_element;
-
- for ( i = 0 ; i < elements_per_request ; i++ ) {
- const GLint index = (GLint) *(ui_ptr++);
- pc = emit_element_old( pc, arrays, index );
- }
- break;
- }
- case GL_UNSIGNED_SHORT: {
- const GLushort * us_ptr = (const GLushort *) indices + req_element;
-
- for ( i = 0 ; i < elements_per_request ; i++ ) {
- const GLint index = (GLint) *(us_ptr++);
- pc = emit_element_old( pc, arrays, index );
- }
- break;
- }
- case GL_UNSIGNED_BYTE: {
- const GLubyte * ub_ptr = (const GLubyte *) indices + req_element;
-
- for ( i = 0 ; i < elements_per_request ; i++ ) {
- const GLint index = (GLint) *(ub_ptr++);
- pc = emit_element_old( pc, arrays, index );
- }
- break;
- }
- }
-
- if ( total_requests != 0 ) {
- __glXSendLargeChunk( gc, req, total_requests, gc->pc,
- pc - gc->pc );
- pc = gc->pc;
- req++;
- }
-
- count -= elements_per_request;
- req_element += elements_per_request;
- }
-
-
- assert( (total_requests == 0) || ((req - 1) == total_requests) );
-
- if ( total_requests == 0 ) {
- assert( pc <= gc->bufEnd );
-
- gc->pc = pc;
- if ( gc->pc > gc->limit ) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+
+ GLubyte *pc;
+ size_t elements_per_request;
+ unsigned total_requests = 0;
+ unsigned i;
+ unsigned req;
+ unsigned req_element = 0;
+
+
+ pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
+ &total_requests, mode, count);
+
+
+ /* Write the arrays.
+ */
+
+ req = 2;
+ while (count > 0) {
+ if (count < elements_per_request) {
+ elements_per_request = count;
+ }
+
+ switch (type) {
+ case GL_UNSIGNED_INT:{
+ const GLuint *ui_ptr = (const GLuint *) indices + req_element;
+
+ for (i = 0; i < elements_per_request; i++) {
+ const GLint index = (GLint) * (ui_ptr++);
+ pc = emit_element_old(pc, arrays, index);
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:{
+ const GLushort *us_ptr = (const GLushort *) indices + req_element;
+
+ for (i = 0; i < elements_per_request; i++) {
+ const GLint index = (GLint) * (us_ptr++);
+ pc = emit_element_old(pc, arrays, index);
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:{
+ const GLubyte *ub_ptr = (const GLubyte *) indices + req_element;
+
+ for (i = 0; i < elements_per_request; i++) {
+ const GLint index = (GLint) * (ub_ptr++);
+ pc = emit_element_old(pc, arrays, index);
+ }
+ break;
+ }
+ }
+
+ if (total_requests != 0) {
+ __glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
+ pc = gc->pc;
+ req++;
+ }
+
+ count -= elements_per_request;
+ req_element += elements_per_request;
+ }
+
+
+ assert((total_requests == 0) || ((req - 1) == total_requests));
+
+ if (total_requests == 0) {
+ assert(pc <= gc->bufEnd);
+
+ gc->pc = pc;
+ if (gc->pc > gc->limit) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+ }
}
@@ -877,26 +875,26 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
* \c GL_TRUE if the argument is valid, \c GL_FALSE if is not.
*/
static GLboolean
-validate_mode(__GLXcontext *gc, GLenum mode)
+validate_mode(__GLXcontext * gc, GLenum mode)
{
- switch(mode) {
- case GL_POINTS:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- case GL_LINES:
- case GL_TRIANGLE_STRIP:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLES:
- case GL_QUAD_STRIP:
- case GL_QUADS:
- case GL_POLYGON:
- break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return GL_FALSE;
- }
-
- return GL_TRUE;
+ switch (mode) {
+ case GL_POINTS:
+ case GL_LINE_STRIP:
+ case GL_LINE_LOOP:
+ case GL_LINES:
+ case GL_TRIANGLE_STRIP:
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLES:
+ case GL_QUAD_STRIP:
+ case GL_QUADS:
+ case GL_POLYGON:
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
}
@@ -910,13 +908,13 @@ validate_mode(__GLXcontext *gc, GLenum mode)
* \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
*/
static GLboolean
-validate_count(__GLXcontext *gc, GLsizei count)
+validate_count(__GLXcontext * gc, GLsizei count)
{
- if (count < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- }
+ if (count < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ }
- return (count > 0);
+ return (count > 0);
}
@@ -928,154 +926,161 @@ validate_count(__GLXcontext *gc, GLsizei count)
* \returns
* \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
*/
-static GLboolean validate_type(__GLXcontext *gc, GLenum type)
+static GLboolean
+validate_type(__GLXcontext * gc, GLenum type)
{
- switch( type ) {
- case GL_UNSIGNED_INT:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_BYTE:
- return GL_TRUE;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return GL_FALSE;
- }
+ switch (type) {
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_BYTE:
+ return GL_TRUE;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return GL_FALSE;
+ }
}
-void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count)
+void
+__indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
-
-
- if ( validate_mode(gc, mode) && validate_count(gc, count) ) {
- if ( ! arrays->array_info_cache_valid ) {
- fill_array_info_cache( arrays );
- }
-
- arrays->DrawArrays(mode, first, count);
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+
+
+ if (validate_mode(gc, mode) && validate_count(gc, count)) {
+ if (!arrays->array_info_cache_valid) {
+ fill_array_info_cache(arrays);
+ }
+
+ arrays->DrawArrays(mode, first, count);
+ }
}
-void __indirect_glArrayElement(GLint index)
+void
+__indirect_glArrayElement(GLint index)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
- size_t single_vertex_size;
+ size_t single_vertex_size;
- single_vertex_size = calculate_single_vertex_size_none( arrays );
+ single_vertex_size = calculate_single_vertex_size_none(arrays);
- if ( (gc->pc + single_vertex_size) >= gc->bufEnd ) {
- gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
- }
+ if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
+ gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
+ }
- gc->pc = emit_element_none( gc->pc, arrays, index );
+ gc->pc = emit_element_none(gc->pc, arrays, index);
- if ( gc->pc > gc->limit ) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
+ if (gc->pc > gc->limit) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
}
-void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices)
+void
+__indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
- if ( validate_mode(gc, mode) && validate_count(gc, count)
- && validate_type(gc, type) ) {
- if ( ! arrays->array_info_cache_valid ) {
- fill_array_info_cache( arrays );
- }
+ if (validate_mode(gc, mode) && validate_count(gc, count)
+ && validate_type(gc, type)) {
+ if (!arrays->array_info_cache_valid) {
+ fill_array_info_cache(arrays);
+ }
- arrays->DrawElements(mode, count, type, indices);
- }
+ arrays->DrawElements(mode, count, type, indices);
+ }
}
-void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
- GLsizei count, GLenum type,
- const GLvoid *indices)
+void
+__indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const GLvoid * indices)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
- if ( validate_mode(gc, mode) && validate_count(gc, count)
- && validate_type(gc, type) ) {
- if (end < start) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ if (validate_mode(gc, mode) && validate_count(gc, count)
+ && validate_type(gc, type)) {
+ if (end < start) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
- if ( ! arrays->array_info_cache_valid ) {
- fill_array_info_cache( arrays );
- }
+ if (!arrays->array_info_cache_valid) {
+ fill_array_info_cache(arrays);
+ }
- arrays->DrawElements(mode, count, type, indices);
- }
+ arrays->DrawElements(mode, count, type, indices);
+ }
}
-void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count,
- GLsizei primcount)
+void
+__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
+ GLsizei primcount)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- GLsizei i;
-
-
- if ( validate_mode(gc, mode) ) {
- if ( ! arrays->array_info_cache_valid ) {
- fill_array_info_cache( arrays );
- }
-
- for ( i = 0 ; i < primcount ; i++ ) {
- if ( validate_count( gc, count[i] ) ) {
- arrays->DrawArrays(mode, first[i], count[i]);
- }
- }
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ GLsizei i;
+
+
+ if (validate_mode(gc, mode)) {
+ if (!arrays->array_info_cache_valid) {
+ fill_array_info_cache(arrays);
+ }
+
+ for (i = 0; i < primcount; i++) {
+ if (validate_count(gc, count[i])) {
+ arrays->DrawArrays(mode, first[i], count[i]);
+ }
+ }
+ }
}
-void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count,
- GLenum type, const GLvoid ** indices,
- GLsizei primcount)
+void
+__indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
+ GLenum type, const GLvoid ** indices,
+ GLsizei primcount)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- const __GLXattribute * state =
- (const __GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- GLsizei i;
-
-
- if ( validate_mode(gc, mode) && validate_type(gc, type) ) {
- if ( ! arrays->array_info_cache_valid ) {
- fill_array_info_cache( arrays );
- }
-
- for ( i = 0 ; i < primcount ; i++ ) {
- if ( validate_count( gc, count[i] ) ) {
- arrays->DrawElements(mode, count[i], type, indices[i]);
- }
- }
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ const __GLXattribute *state =
+ (const __GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ GLsizei i;
+
+
+ if (validate_mode(gc, mode) && validate_type(gc, type)) {
+ if (!arrays->array_info_cache_valid) {
+ fill_array_info_cache(arrays);
+ }
+
+ for (i = 0; i < primcount; i++) {
+ if (validate_count(gc, count[i])) {
+ arrays->DrawElements(mode, count[i], type, indices[i]);
+ }
+ }
+ }
}
@@ -1097,475 +1102,577 @@ void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count,
} while(0)
-void __indirect_glVertexPointer( GLint size, GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- static const uint16_t short_ops[5] = {
- 0, 0, X_GLrop_Vertex2sv, X_GLrop_Vertex3sv, X_GLrop_Vertex4sv
- };
- static const uint16_t int_ops[5] = {
- 0, 0, X_GLrop_Vertex2iv, X_GLrop_Vertex3iv, X_GLrop_Vertex4iv
- };
- static const uint16_t float_ops[5] = {
- 0, 0, X_GLrop_Vertex2fv, X_GLrop_Vertex3fv, X_GLrop_Vertex4fv
- };
- static const uint16_t double_ops[5] = {
- 0, 0, X_GLrop_Vertex2dv, X_GLrop_Vertex3dv, X_GLrop_Vertex4dv
- };
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (size < 2 || size > 4 || stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- switch ( type ) {
- case GL_SHORT: opcode = short_ops[size]; break;
- case GL_INT: opcode = int_ops[size]; break;
- case GL_FLOAT: opcode = float_ops[size]; break;
- case GL_DOUBLE: opcode = double_ops[size]; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- a = get_array_entry( arrays, GL_VERTEX_ARRAY, 0 );
- assert( a != NULL );
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_FALSE, 4,
- opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ static const uint16_t short_ops[5] = {
+ 0, 0, X_GLrop_Vertex2sv, X_GLrop_Vertex3sv, X_GLrop_Vertex4sv
+ };
+ static const uint16_t int_ops[5] = {
+ 0, 0, X_GLrop_Vertex2iv, X_GLrop_Vertex3iv, X_GLrop_Vertex4iv
+ };
+ static const uint16_t float_ops[5] = {
+ 0, 0, X_GLrop_Vertex2fv, X_GLrop_Vertex3fv, X_GLrop_Vertex4fv
+ };
+ static const uint16_t double_ops[5] = {
+ 0, 0, X_GLrop_Vertex2dv, X_GLrop_Vertex3dv, X_GLrop_Vertex4dv
+ };
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (size < 2 || size > 4 || stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ switch (type) {
+ case GL_SHORT:
+ opcode = short_ops[size];
+ break;
+ case GL_INT:
+ opcode = int_ops[size];
+ break;
+ case GL_FLOAT:
+ opcode = float_ops[size];
+ break;
+ case GL_DOUBLE:
+ opcode = double_ops[size];
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ a = get_array_entry(arrays, GL_VERTEX_ARRAY, 0);
+ assert(a != NULL);
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE, 4,
+ opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glNormalPointer( GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glNormalPointer(GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- switch ( type ) {
- case GL_BYTE: opcode = X_GLrop_Normal3bv; break;
- case GL_SHORT: opcode = X_GLrop_Normal3sv; break;
- case GL_INT: opcode = X_GLrop_Normal3iv; break;
- case GL_FLOAT: opcode = X_GLrop_Normal3fv; break;
- case GL_DOUBLE: opcode = X_GLrop_Normal3dv; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- a = get_array_entry( arrays, GL_NORMAL_ARRAY, 0 );
- assert( a != NULL );
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 3, GL_TRUE, 4,
- opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ switch (type) {
+ case GL_BYTE:
+ opcode = X_GLrop_Normal3bv;
+ break;
+ case GL_SHORT:
+ opcode = X_GLrop_Normal3sv;
+ break;
+ case GL_INT:
+ opcode = X_GLrop_Normal3iv;
+ break;
+ case GL_FLOAT:
+ opcode = X_GLrop_Normal3fv;
+ break;
+ case GL_DOUBLE:
+ opcode = X_GLrop_Normal3dv;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ a = get_array_entry(arrays, GL_NORMAL_ARRAY, 0);
+ assert(a != NULL);
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 3, GL_TRUE, 4, opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glColorPointer( GLint size, GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glColorPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- static const uint16_t byte_ops[5] = {
- 0, 0, 0, X_GLrop_Color3bv, X_GLrop_Color4bv
- };
- static const uint16_t ubyte_ops[5] = {
- 0, 0, 0, X_GLrop_Color3ubv, X_GLrop_Color4ubv
- };
- static const uint16_t short_ops[5] = {
- 0, 0, 0, X_GLrop_Color3sv, X_GLrop_Color4sv
- };
- static const uint16_t ushort_ops[5] = {
- 0, 0, 0, X_GLrop_Color3usv, X_GLrop_Color4usv
- };
- static const uint16_t int_ops[5] = {
- 0, 0, 0, X_GLrop_Color3iv, X_GLrop_Color4iv
- };
- static const uint16_t uint_ops[5] = {
- 0, 0, 0, X_GLrop_Color3uiv, X_GLrop_Color4uiv
- };
- static const uint16_t float_ops[5] = {
- 0, 0, 0, X_GLrop_Color3fv, X_GLrop_Color4fv
- };
- static const uint16_t double_ops[5] = {
- 0, 0, 0, X_GLrop_Color3dv, X_GLrop_Color4dv
- };
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (size < 3 || size > 4 || stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- switch ( type ) {
- case GL_BYTE: opcode = byte_ops[size]; break;
- case GL_UNSIGNED_BYTE: opcode = ubyte_ops[size]; break;
- case GL_SHORT: opcode = short_ops[size]; break;
- case GL_UNSIGNED_SHORT: opcode = ushort_ops[size]; break;
- case GL_INT: opcode = int_ops[size]; break;
- case GL_UNSIGNED_INT: opcode = uint_ops[size]; break;
- case GL_FLOAT: opcode = float_ops[size]; break;
- case GL_DOUBLE: opcode = double_ops[size]; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- a = get_array_entry( arrays, GL_COLOR_ARRAY, 0 );
- assert( a != NULL );
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_TRUE, 4,
- opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ static const uint16_t byte_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3bv, X_GLrop_Color4bv
+ };
+ static const uint16_t ubyte_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3ubv, X_GLrop_Color4ubv
+ };
+ static const uint16_t short_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3sv, X_GLrop_Color4sv
+ };
+ static const uint16_t ushort_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3usv, X_GLrop_Color4usv
+ };
+ static const uint16_t int_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3iv, X_GLrop_Color4iv
+ };
+ static const uint16_t uint_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3uiv, X_GLrop_Color4uiv
+ };
+ static const uint16_t float_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3fv, X_GLrop_Color4fv
+ };
+ static const uint16_t double_ops[5] = {
+ 0, 0, 0, X_GLrop_Color3dv, X_GLrop_Color4dv
+ };
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (size < 3 || size > 4 || stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ switch (type) {
+ case GL_BYTE:
+ opcode = byte_ops[size];
+ break;
+ case GL_UNSIGNED_BYTE:
+ opcode = ubyte_ops[size];
+ break;
+ case GL_SHORT:
+ opcode = short_ops[size];
+ break;
+ case GL_UNSIGNED_SHORT:
+ opcode = ushort_ops[size];
+ break;
+ case GL_INT:
+ opcode = int_ops[size];
+ break;
+ case GL_UNSIGNED_INT:
+ opcode = uint_ops[size];
+ break;
+ case GL_FLOAT:
+ opcode = float_ops[size];
+ break;
+ case GL_DOUBLE:
+ opcode = double_ops[size];
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ a = get_array_entry(arrays, GL_COLOR_ARRAY, 0);
+ assert(a != NULL);
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glIndexPointer( GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid * pointer)
{
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- switch ( type ) {
- case GL_UNSIGNED_BYTE: opcode = X_GLrop_Indexubv; break;
- case GL_SHORT: opcode = X_GLrop_Indexsv; break;
- case GL_INT: opcode = X_GLrop_Indexiv; break;
- case GL_FLOAT: opcode = X_GLrop_Indexfv; break;
- case GL_DOUBLE: opcode = X_GLrop_Indexdv; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- a = get_array_entry( arrays, GL_INDEX_ARRAY, 0 );
- assert( a != NULL );
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 1, GL_FALSE, 4,
- opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ opcode = X_GLrop_Indexubv;
+ break;
+ case GL_SHORT:
+ opcode = X_GLrop_Indexsv;
+ break;
+ case GL_INT:
+ opcode = X_GLrop_Indexiv;
+ break;
+ case GL_FLOAT:
+ opcode = X_GLrop_Indexfv;
+ break;
+ case GL_DOUBLE:
+ opcode = X_GLrop_Indexdv;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ a = get_array_entry(arrays, GL_INDEX_ARRAY, 0);
+ assert(a != NULL);
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glEdgeFlagPointer( GLsizei stride, const GLvoid * pointer )
+void
+__indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid * pointer)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
-
- a = get_array_entry( arrays, GL_EDGE_FLAG_ARRAY, 0 );
- assert( a != NULL );
- COMMON_ARRAY_DATA_INIT( a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE,
- 4, X_GLrop_EdgeFlagv );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+
+ a = get_array_entry(arrays, GL_EDGE_FLAG_ARRAY, 0);
+ assert(a != NULL);
+ COMMON_ARRAY_DATA_INIT(a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE,
+ 4, X_GLrop_EdgeFlagv);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glTexCoordPointer( GLint size, GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- static const uint16_t short_ops[5] = {
- 0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv, X_GLrop_TexCoord4sv
- };
- static const uint16_t int_ops[5] = {
- 0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv, X_GLrop_TexCoord4iv
- };
- static const uint16_t float_ops[5] = {
- 0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv, X_GLrop_TexCoord4fv
- };
- static const uint16_t double_ops[5] = {
- 0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv, X_GLrop_TexCoord4dv
- };
-
- static const uint16_t mshort_ops[5] = {
- 0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB, X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
- };
- static const uint16_t mint_ops[5] = {
- 0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB, X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
- };
- static const uint16_t mfloat_ops[5] = {
- 0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB, X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
- };
- static const uint16_t mdouble_ops[5] = {
- 0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB, X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
- };
-
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
- unsigned header_size;
- unsigned index;
-
-
- if (size < 1 || size > 4 || stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- index = arrays->active_texture_unit;
- if ( index == 0 ) {
- switch ( type ) {
- case GL_SHORT: opcode = short_ops[size]; break;
- case GL_INT: opcode = int_ops[size]; break;
- case GL_FLOAT: opcode = float_ops[size]; break;
- case GL_DOUBLE: opcode = double_ops[size]; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- header_size = 4;
- }
- else {
- switch ( type ) {
- case GL_SHORT: opcode = mshort_ops[size]; break;
- case GL_INT: opcode = mint_ops[size]; break;
- case GL_FLOAT: opcode = mfloat_ops[size]; break;
- case GL_DOUBLE: opcode = mdouble_ops[size]; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- header_size = 8;
- }
-
- a = get_array_entry( arrays, GL_TEXTURE_COORD_ARRAY, index );
- assert( a != NULL );
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_FALSE,
- header_size, opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ static const uint16_t short_ops[5] = {
+ 0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv,
+ X_GLrop_TexCoord4sv
+ };
+ static const uint16_t int_ops[5] = {
+ 0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv,
+ X_GLrop_TexCoord4iv
+ };
+ static const uint16_t float_ops[5] = {
+ 0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv,
+ X_GLrop_TexCoord4fv
+ };
+ static const uint16_t double_ops[5] = {
+ 0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv,
+ X_GLrop_TexCoord4dv
+ };
+
+ static const uint16_t mshort_ops[5] = {
+ 0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB,
+ X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
+ };
+ static const uint16_t mint_ops[5] = {
+ 0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB,
+ X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
+ };
+ static const uint16_t mfloat_ops[5] = {
+ 0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB,
+ X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
+ };
+ static const uint16_t mdouble_ops[5] = {
+ 0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB,
+ X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
+ };
+
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+ unsigned header_size;
+ unsigned index;
+
+
+ if (size < 1 || size > 4 || stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ index = arrays->active_texture_unit;
+ if (index == 0) {
+ switch (type) {
+ case GL_SHORT:
+ opcode = short_ops[size];
+ break;
+ case GL_INT:
+ opcode = int_ops[size];
+ break;
+ case GL_FLOAT:
+ opcode = float_ops[size];
+ break;
+ case GL_DOUBLE:
+ opcode = double_ops[size];
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ header_size = 4;
+ }
+ else {
+ switch (type) {
+ case GL_SHORT:
+ opcode = mshort_ops[size];
+ break;
+ case GL_INT:
+ opcode = mint_ops[size];
+ break;
+ case GL_FLOAT:
+ opcode = mfloat_ops[size];
+ break;
+ case GL_DOUBLE:
+ opcode = mdouble_ops[size];
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ header_size = 8;
+ }
+
+ a = get_array_entry(arrays, GL_TEXTURE_COORD_ARRAY, index);
+ assert(a != NULL);
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE,
+ header_size, opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glSecondaryColorPointerEXT( GLint size, GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (size != 3 || stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- switch ( type ) {
- case GL_BYTE: opcode = 4126; break;
- case GL_UNSIGNED_BYTE: opcode = 4131; break;
- case GL_SHORT: opcode = 4127; break;
- case GL_UNSIGNED_SHORT: opcode = 4132; break;
- case GL_INT: opcode = 4128; break;
- case GL_UNSIGNED_INT: opcode = 4133; break;
- case GL_FLOAT: opcode = 4129; break;
- case GL_DOUBLE: opcode = 4130; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- a = get_array_entry( arrays, GL_SECONDARY_COLOR_ARRAY, 0 );
- if ( a == NULL ) {
- __glXSetError(gc, GL_INVALID_OPERATION);
- return;
- }
-
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_TRUE, 4,
- opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (size != 3 || stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ switch (type) {
+ case GL_BYTE:
+ opcode = 4126;
+ break;
+ case GL_UNSIGNED_BYTE:
+ opcode = 4131;
+ break;
+ case GL_SHORT:
+ opcode = 4127;
+ break;
+ case GL_UNSIGNED_SHORT:
+ opcode = 4132;
+ break;
+ case GL_INT:
+ opcode = 4128;
+ break;
+ case GL_UNSIGNED_INT:
+ opcode = 4133;
+ break;
+ case GL_FLOAT:
+ opcode = 4129;
+ break;
+ case GL_DOUBLE:
+ opcode = 4130;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ a = get_array_entry(arrays, GL_SECONDARY_COLOR_ARRAY, 0);
+ if (a == NULL) {
+ __glXSetError(gc, GL_INVALID_OPERATION);
+ return;
+ }
+
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glFogCoordPointerEXT( GLenum type, GLsizei stride,
- const GLvoid * pointer )
+void
+__indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
-
- if (stride < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- switch ( type ) {
- case GL_FLOAT: opcode = 4124; break;
- case GL_DOUBLE: opcode = 4125; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- a = get_array_entry( arrays, GL_FOG_COORD_ARRAY, 0 );
- if ( a == NULL ) {
- __glXSetError(gc, GL_INVALID_OPERATION);
- return;
- }
-
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 1, GL_FALSE, 4,
- opcode );
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
+
+ if (stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ switch (type) {
+ case GL_FLOAT:
+ opcode = 4124;
+ break;
+ case GL_DOUBLE:
+ opcode = 4125;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ a = get_array_entry(arrays, GL_FOG_COORD_ARRAY, 0);
+ if (a == NULL) {
+ __glXSetError(gc, GL_INVALID_OPERATION);
+ return;
+ }
+
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
-void __indirect_glVertexAttribPointerARB(GLuint index, GLint size,
- GLenum type, GLboolean normalized,
- GLsizei stride,
- const GLvoid * pointer)
+void
+__indirect_glVertexAttribPointerARB(GLuint index, GLint size,
+ GLenum type, GLboolean normalized,
+ GLsizei stride, const GLvoid * pointer)
{
- static const uint16_t short_ops[5] = { 0, 4189, 4190, 4191, 4192 };
- static const uint16_t float_ops[5] = { 0, 4193, 4194, 4195, 4196 };
- static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };
-
- uint16_t opcode;
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
- unsigned true_immediate_count;
- unsigned true_immediate_size;
-
-
- if ( (size < 1) || (size > 4) || (stride < 0)
- || (index > arrays->num_vertex_program_attribs) ){
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
- if ( normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
- switch( type ) {
- case GL_BYTE: opcode = X_GLrop_VertexAttrib4NbvARB; break;
- case GL_UNSIGNED_BYTE: opcode = X_GLrop_VertexAttrib4NubvARB; break;
- case GL_SHORT: opcode = X_GLrop_VertexAttrib4NsvARB; break;
- case GL_UNSIGNED_SHORT: opcode = X_GLrop_VertexAttrib4NusvARB; break;
- case GL_INT: opcode = X_GLrop_VertexAttrib4NivARB; break;
- case GL_UNSIGNED_INT: opcode = X_GLrop_VertexAttrib4NuivARB; break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- true_immediate_count = 4;
- }
- else {
- true_immediate_count = size;
-
- switch( type ) {
- case GL_BYTE:
- opcode = X_GLrop_VertexAttrib4bvARB;
- true_immediate_count = 4;
- break;
- case GL_UNSIGNED_BYTE:
- opcode = X_GLrop_VertexAttrib4ubvARB;
- true_immediate_count = 4;
- break;
- case GL_SHORT:
- opcode = short_ops[size];
- break;
- case GL_UNSIGNED_SHORT:
- opcode = X_GLrop_VertexAttrib4usvARB;
- true_immediate_count = 4;
- break;
- case GL_INT:
- opcode = X_GLrop_VertexAttrib4ivARB;
- true_immediate_count = 4;
- break;
- case GL_UNSIGNED_INT:
- opcode = X_GLrop_VertexAttrib4uivARB;
- true_immediate_count = 4;
- break;
- case GL_FLOAT:
- opcode = float_ops[size];
- break;
- case GL_DOUBLE:
- opcode = double_ops[size];
- break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
- }
-
- a = get_array_entry( arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index );
- if ( a == NULL ) {
- __glXSetError(gc, GL_INVALID_OPERATION);
- return;
- }
-
- COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, normalized, 8,
- opcode );
-
- true_immediate_size = __glXTypeSize(type) * true_immediate_count;
- ((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size
- + true_immediate_size);
-
- if ( a->enabled ) {
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ static const uint16_t short_ops[5] = { 0, 4189, 4190, 4191, 4192 };
+ static const uint16_t float_ops[5] = { 0, 4193, 4194, 4195, 4196 };
+ static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };
+
+ uint16_t opcode;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+ unsigned true_immediate_count;
+ unsigned true_immediate_size;
+
+
+ if ((size < 1) || (size > 4) || (stride < 0)
+ || (index > arrays->num_vertex_program_attribs)) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+ if (normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
+ switch (type) {
+ case GL_BYTE:
+ opcode = X_GLrop_VertexAttrib4NbvARB;
+ break;
+ case GL_UNSIGNED_BYTE:
+ opcode = X_GLrop_VertexAttrib4NubvARB;
+ break;
+ case GL_SHORT:
+ opcode = X_GLrop_VertexAttrib4NsvARB;
+ break;
+ case GL_UNSIGNED_SHORT:
+ opcode = X_GLrop_VertexAttrib4NusvARB;
+ break;
+ case GL_INT:
+ opcode = X_GLrop_VertexAttrib4NivARB;
+ break;
+ case GL_UNSIGNED_INT:
+ opcode = X_GLrop_VertexAttrib4NuivARB;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ true_immediate_count = 4;
+ }
+ else {
+ true_immediate_count = size;
+
+ switch (type) {
+ case GL_BYTE:
+ opcode = X_GLrop_VertexAttrib4bvARB;
+ true_immediate_count = 4;
+ break;
+ case GL_UNSIGNED_BYTE:
+ opcode = X_GLrop_VertexAttrib4ubvARB;
+ true_immediate_count = 4;
+ break;
+ case GL_SHORT:
+ opcode = short_ops[size];
+ break;
+ case GL_UNSIGNED_SHORT:
+ opcode = X_GLrop_VertexAttrib4usvARB;
+ true_immediate_count = 4;
+ break;
+ case GL_INT:
+ opcode = X_GLrop_VertexAttrib4ivARB;
+ true_immediate_count = 4;
+ break;
+ case GL_UNSIGNED_INT:
+ opcode = X_GLrop_VertexAttrib4uivARB;
+ true_immediate_count = 4;
+ break;
+ case GL_FLOAT:
+ opcode = float_ops[size];
+ break;
+ case GL_DOUBLE:
+ opcode = double_ops[size];
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+ }
+
+ a = get_array_entry(arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index);
+ if (a == NULL) {
+ __glXSetError(gc, GL_INVALID_OPERATION);
+ return;
+ }
+
+ COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, normalized, 8,
+ opcode);
+
+ true_immediate_size = __glXTypeSize(type) * true_immediate_count;
+ ((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size
+ + true_immediate_size);
+
+ if (a->enabled) {
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
}
@@ -1578,50 +1685,52 @@ void __indirect_glVertexAttribPointerARB(GLuint index, GLint size,
* client just sends all the data to the server and lets the server deal
* with it.
*/
-void __indirect_glVertexAttribPointerNV( GLuint index, GLint size,
- GLenum type, GLsizei stride,
- const GLvoid * pointer)
+void
+__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
+ GLenum type, GLsizei stride,
+ const GLvoid * pointer)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- GLboolean normalized = GL_FALSE;
-
-
- switch( type ) {
- case GL_UNSIGNED_BYTE:
- if ( size != 4 ) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- normalized = GL_TRUE;
-
- case GL_SHORT:
- case GL_FLOAT:
- case GL_DOUBLE:
- __indirect_glVertexAttribPointerARB(index, size, type,
- normalized,
- stride, pointer);
- return;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ GLboolean normalized = GL_FALSE;
+
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ if (size != 4) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ normalized = GL_TRUE;
+
+ case GL_SHORT:
+ case GL_FLOAT:
+ case GL_DOUBLE:
+ __indirect_glVertexAttribPointerARB(index, size, type,
+ normalized, stride, pointer);
+ return;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
}
-void __indirect_glClientActiveTextureARB(GLenum texture)
+void
+__indirect_glClientActiveTextureARB(GLenum texture)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
- __GLXattribute * const state = (__GLXattribute *)(gc->client_state_private);
- struct array_state_vector * const arrays = state->array_state;
- const GLint unit = (GLint) texture - GL_TEXTURE0;
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ __GLXattribute *const state =
+ (__GLXattribute *) (gc->client_state_private);
+ struct array_state_vector *const arrays = state->array_state;
+ const GLint unit = (GLint) texture - GL_TEXTURE0;
- if ( (unit < 0) || (unit >= arrays->num_texture_units) ) {
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
+ if ((unit < 0) || (unit >= arrays->num_texture_units)) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
- arrays->active_texture_unit = unit;
+ arrays->active_texture_unit = unit;
}
@@ -1629,248 +1738,249 @@ void __indirect_glClientActiveTextureARB(GLenum texture)
* Modify the enable state for the selected array
*/
GLboolean
-__glXSetArrayEnable(__GLXattribute *state, GLenum key, unsigned index,
+__glXSetArrayEnable(__GLXattribute * state, GLenum key, unsigned index,
GLboolean enable)
{
- struct array_state_vector * arrays = state->array_state;
- struct array_state * a;
-
+ struct array_state_vector *arrays = state->array_state;
+ struct array_state *a;
+
- /* Texture coordinate arrays have an implict index set when the
- * application calls glClientActiveTexture.
- */
- if (key == GL_TEXTURE_COORD_ARRAY) {
- index = arrays->active_texture_unit;
- }
+ /* Texture coordinate arrays have an implict index set when the
+ * application calls glClientActiveTexture.
+ */
+ if (key == GL_TEXTURE_COORD_ARRAY) {
+ index = arrays->active_texture_unit;
+ }
- a = get_array_entry( arrays, key, index );
+ a = get_array_entry(arrays, key, index);
- if ( (a != NULL) && (a->enabled != enable) ) {
- a->enabled = enable;
- arrays->array_info_cache_valid = GL_FALSE;
- }
+ if ((a != NULL) && (a->enabled != enable)) {
+ a->enabled = enable;
+ arrays->array_info_cache_valid = GL_FALSE;
+ }
- return (a != NULL);
+ return (a != NULL);
}
void
-__glXArrayDisableAll( __GLXattribute * state )
+__glXArrayDisableAll(__GLXattribute * state)
{
- struct array_state_vector * arrays = state->array_state;
- unsigned i;
+ struct array_state_vector *arrays = state->array_state;
+ unsigned i;
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- arrays->arrays[i].enabled = GL_FALSE;
- }
+ for (i = 0; i < arrays->num_arrays; i++) {
+ arrays->arrays[i].enabled = GL_FALSE;
+ }
- arrays->array_info_cache_valid = GL_FALSE;
+ arrays->array_info_cache_valid = GL_FALSE;
}
/**
*/
GLboolean
-__glXGetArrayEnable( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest )
+__glXGetArrayEnable(const __GLXattribute * const state,
+ GLenum key, unsigned index, GLintptr * dest)
{
- const struct array_state_vector * arrays = state->array_state;
- const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
- key, index );
+ const struct array_state_vector *arrays = state->array_state;
+ const struct array_state *a =
+ get_array_entry((struct array_state_vector *) arrays,
+ key, index);
- if ( a != NULL ) {
- *dest = (GLintptr) a->enabled;
- }
+ if (a != NULL) {
+ *dest = (GLintptr) a->enabled;
+ }
- return (a != NULL);
+ return (a != NULL);
}
/**
*/
GLboolean
-__glXGetArrayType( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest )
+__glXGetArrayType(const __GLXattribute * const state,
+ GLenum key, unsigned index, GLintptr * dest)
{
- const struct array_state_vector * arrays = state->array_state;
- const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
- key, index );
+ const struct array_state_vector *arrays = state->array_state;
+ const struct array_state *a =
+ get_array_entry((struct array_state_vector *) arrays,
+ key, index);
- if ( a != NULL ) {
- *dest = (GLintptr) a->data_type;
- }
+ if (a != NULL) {
+ *dest = (GLintptr) a->data_type;
+ }
- return (a != NULL);
+ return (a != NULL);
}
/**
*/
GLboolean
-__glXGetArraySize( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest )
+__glXGetArraySize(const __GLXattribute * const state,
+ GLenum key, unsigned index, GLintptr * dest)
{
- const struct array_state_vector * arrays = state->array_state;
- const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
- key, index );
+ const struct array_state_vector *arrays = state->array_state;
+ const struct array_state *a =
+ get_array_entry((struct array_state_vector *) arrays,
+ key, index);
- if ( a != NULL ) {
- *dest = (GLintptr) a->count;
- }
+ if (a != NULL) {
+ *dest = (GLintptr) a->count;
+ }
- return (a != NULL);
+ return (a != NULL);
}
/**
*/
GLboolean
-__glXGetArrayStride( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest )
+__glXGetArrayStride(const __GLXattribute * const state,
+ GLenum key, unsigned index, GLintptr * dest)
{
- const struct array_state_vector * arrays = state->array_state;
- const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
- key, index );
+ const struct array_state_vector *arrays = state->array_state;
+ const struct array_state *a =
+ get_array_entry((struct array_state_vector *) arrays,
+ key, index);
- if ( a != NULL ) {
- *dest = (GLintptr) a->user_stride;
- }
+ if (a != NULL) {
+ *dest = (GLintptr) a->user_stride;
+ }
- return (a != NULL);
+ return (a != NULL);
}
/**
*/
GLboolean
-__glXGetArrayPointer( const __GLXattribute * const state,
- GLenum key, unsigned index, void ** dest )
+__glXGetArrayPointer(const __GLXattribute * const state,
+ GLenum key, unsigned index, void **dest)
{
- const struct array_state_vector * arrays = state->array_state;
- const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
- key, index );
+ const struct array_state_vector *arrays = state->array_state;
+ const struct array_state *a =
+ get_array_entry((struct array_state_vector *) arrays,
+ key, index);
- if ( a != NULL ) {
- *dest = (void *) (a->data);
- }
+ if (a != NULL) {
+ *dest = (void *) (a->data);
+ }
- return (a != NULL);
+ return (a != NULL);
}
/**
*/
GLboolean
-__glXGetArrayNormalized( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest )
+__glXGetArrayNormalized(const __GLXattribute * const state,
+ GLenum key, unsigned index, GLintptr * dest)
{
- const struct array_state_vector * arrays = state->array_state;
- const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
- key, index );
+ const struct array_state_vector *arrays = state->array_state;
+ const struct array_state *a =
+ get_array_entry((struct array_state_vector *) arrays,
+ key, index);
- if ( a != NULL ) {
- *dest = (GLintptr) a->normalized;
- }
+ if (a != NULL) {
+ *dest = (GLintptr) a->normalized;
+ }
- return (a != NULL);
+ return (a != NULL);
}
/**
*/
GLuint
-__glXGetActiveTextureUnit( const __GLXattribute * const state )
+__glXGetActiveTextureUnit(const __GLXattribute * const state)
{
- return state->array_state->active_texture_unit;
+ return state->array_state->active_texture_unit;
}
void
-__glXPushArrayState( __GLXattribute * state )
+__glXPushArrayState(__GLXattribute * state)
{
- struct array_state_vector * arrays = state->array_state;
- struct array_stack_state * stack = & arrays->stack[ (arrays->stack_index * arrays->num_arrays)];
- unsigned i;
-
- /* XXX are we pushing _all_ the necessary fields? */
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- stack[i].data = arrays->arrays[i].data;
- stack[i].data_type = arrays->arrays[i].data_type;
- stack[i].user_stride = arrays->arrays[i].user_stride;
- stack[i].count = arrays->arrays[i].count;
- stack[i].key = arrays->arrays[i].key;
- stack[i].index = arrays->arrays[i].index;
- stack[i].enabled = arrays->arrays[i].enabled;
- }
-
- arrays->active_texture_unit_stack[ arrays->stack_index ] =
+ struct array_state_vector *arrays = state->array_state;
+ struct array_stack_state *stack =
+ &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
+ unsigned i;
+
+ /* XXX are we pushing _all_ the necessary fields? */
+ for (i = 0; i < arrays->num_arrays; i++) {
+ stack[i].data = arrays->arrays[i].data;
+ stack[i].data_type = arrays->arrays[i].data_type;
+ stack[i].user_stride = arrays->arrays[i].user_stride;
+ stack[i].count = arrays->arrays[i].count;
+ stack[i].key = arrays->arrays[i].key;
+ stack[i].index = arrays->arrays[i].index;
+ stack[i].enabled = arrays->arrays[i].enabled;
+ }
+
+ arrays->active_texture_unit_stack[arrays->stack_index] =
arrays->active_texture_unit;
- arrays->stack_index++;
+ arrays->stack_index++;
}
void
-__glXPopArrayState( __GLXattribute * state )
+__glXPopArrayState(__GLXattribute * state)
{
- struct array_state_vector * arrays = state->array_state;
- struct array_stack_state * stack;
- unsigned i;
-
-
- arrays->stack_index--;
- stack = & arrays->stack[ (arrays->stack_index * arrays->num_arrays) ];
-
- for ( i = 0 ; i < arrays->num_arrays ; i++ ) {
- switch ( stack[i].key ) {
- case GL_NORMAL_ARRAY:
- __indirect_glNormalPointer( stack[i].data_type,
- stack[i].user_stride,
- stack[i].data );
- break;
- case GL_COLOR_ARRAY:
- __indirect_glColorPointer( stack[i].count,
- stack[i].data_type,
- stack[i].user_stride,
- stack[i].data );
- break;
- case GL_INDEX_ARRAY:
- __indirect_glIndexPointer( stack[i].data_type,
- stack[i].user_stride,
- stack[i].data );
- break;
- case GL_EDGE_FLAG_ARRAY:
- __indirect_glEdgeFlagPointer( stack[i].user_stride,
- stack[i].data );
- break;
- case GL_TEXTURE_COORD_ARRAY:
- arrays->active_texture_unit = stack[i].index;
- __indirect_glTexCoordPointer( stack[i].count,
- stack[i].data_type,
- stack[i].user_stride,
- stack[i].data );
- break;
- case GL_SECONDARY_COLOR_ARRAY:
- __indirect_glSecondaryColorPointerEXT( stack[i].count,
- stack[i].data_type,
- stack[i].user_stride,
- stack[i].data );
- break;
- case GL_FOG_COORDINATE_ARRAY:
- __indirect_glFogCoordPointerEXT( stack[i].data_type,
- stack[i].user_stride,
- stack[i].data );
- break;
-
- }
-
- __glXSetArrayEnable( state, stack[i].key, stack[i].index,
- stack[i].enabled );
- }
-
- arrays->active_texture_unit =
- arrays->active_texture_unit_stack[ arrays->stack_index ];
+ struct array_state_vector *arrays = state->array_state;
+ struct array_stack_state *stack;
+ unsigned i;
+
+
+ arrays->stack_index--;
+ stack = &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
+
+ for (i = 0; i < arrays->num_arrays; i++) {
+ switch (stack[i].key) {
+ case GL_NORMAL_ARRAY:
+ __indirect_glNormalPointer(stack[i].data_type,
+ stack[i].user_stride, stack[i].data);
+ break;
+ case GL_COLOR_ARRAY:
+ __indirect_glColorPointer(stack[i].count,
+ stack[i].data_type,
+ stack[i].user_stride, stack[i].data);
+ break;
+ case GL_INDEX_ARRAY:
+ __indirect_glIndexPointer(stack[i].data_type,
+ stack[i].user_stride, stack[i].data);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ __indirect_glEdgeFlagPointer(stack[i].user_stride, stack[i].data);
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ arrays->active_texture_unit = stack[i].index;
+ __indirect_glTexCoordPointer(stack[i].count,
+ stack[i].data_type,
+ stack[i].user_stride, stack[i].data);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY:
+ __indirect_glSecondaryColorPointerEXT(stack[i].count,
+ stack[i].data_type,
+ stack[i].user_stride,
+ stack[i].data);
+ break;
+ case GL_FOG_COORDINATE_ARRAY:
+ __indirect_glFogCoordPointerEXT(stack[i].data_type,
+ stack[i].user_stride, stack[i].data);
+ break;
+
+ }
+
+ __glXSetArrayEnable(state, stack[i].key, stack[i].index,
+ stack[i].enabled);
+ }
+
+ arrays->active_texture_unit =
+ arrays->active_texture_unit_stack[arrays->stack_index];
}
diff --git a/src/glx/x11/indirect_vertex_array.h b/src/glx/x11/indirect_vertex_array.h
index caab62b672..2867f6fd53 100644
--- a/src/glx/x11/indirect_vertex_array.h
+++ b/src/glx/x11/indirect_vertex_array.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004, 2005
* All Rights Reserved.
@@ -31,27 +32,34 @@ extern const GLuint __glXTypeSize_table[16];
#define __glXTypeSize(e) ((((e) & ~0x0f) != 0x1400) \
? 0 : __glXTypeSize_table[ (e) & 0x0f ])
-extern void __glXArrayDisableAll( __GLXattribute * state );
+extern void __glXArrayDisableAll(__GLXattribute * state);
-extern GLboolean __glXSetArrayEnable( __GLXattribute * state,
- GLenum key, unsigned index, GLboolean enable );
+extern GLboolean __glXSetArrayEnable(__GLXattribute * state,
+ GLenum key, unsigned index,
+ GLboolean enable);
-extern GLboolean __glXGetArrayEnable( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest );
-extern GLboolean __glXGetArraySize( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest );
-extern GLboolean __glXGetArrayType( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest );
-extern GLboolean __glXGetArrayStride( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest );
-extern GLboolean __glXGetArrayPointer( const __GLXattribute * const state,
- GLenum key, unsigned index, void ** dest );
-extern GLboolean __glXGetArrayNormalized( const __GLXattribute * const state,
- GLenum key, unsigned index, GLintptr * dest );
+extern GLboolean __glXGetArrayEnable(const __GLXattribute * const state,
+ GLenum key, unsigned index,
+ GLintptr * dest);
+extern GLboolean __glXGetArraySize(const __GLXattribute * const state,
+ GLenum key, unsigned index,
+ GLintptr * dest);
+extern GLboolean __glXGetArrayType(const __GLXattribute * const state,
+ GLenum key, unsigned index,
+ GLintptr * dest);
+extern GLboolean __glXGetArrayStride(const __GLXattribute * const state,
+ GLenum key, unsigned index,
+ GLintptr * dest);
+extern GLboolean __glXGetArrayPointer(const __GLXattribute * const state,
+ GLenum key, unsigned index,
+ void **dest);
+extern GLboolean __glXGetArrayNormalized(const __GLXattribute * const state,
+ GLenum key, unsigned index,
+ GLintptr * dest);
-extern void __glXPushArrayState( __GLXattribute * state );
-extern void __glXPopArrayState( __GLXattribute * state );
+extern void __glXPushArrayState(__GLXattribute * state);
+extern void __glXPopArrayState(__GLXattribute * state);
-extern GLuint __glXGetActiveTextureUnit( const __GLXattribute * const state );
+extern GLuint __glXGetActiveTextureUnit(const __GLXattribute * const state);
#endif /* INDIRECT_VERTEX_ARRAY_H */
diff --git a/src/glx/x11/indirect_vertex_array_priv.h b/src/glx/x11/indirect_vertex_array_priv.h
index ab97dc645f..240839cae7 100644
--- a/src/glx/x11/indirect_vertex_array_priv.h
+++ b/src/glx/x11/indirect_vertex_array_priv.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2004, 2005
* All Rights Reserved.
@@ -42,86 +43,87 @@
/**
* State descriptor for a single array of vertex data.
*/
-struct array_state {
+struct array_state
+{
/**
* Pointer to the application supplied data.
*/
- const void * data;
-
+ const void *data;
+
/**
* Enum representing the type of the application supplied data.
*/
- GLenum data_type;
+ GLenum data_type;
/**
* Stride value supplied by the application. This value is not used
* internally. It is only kept so that it can be queried by the
* application using glGet*v.
*/
- GLsizei user_stride;
+ GLsizei user_stride;
/**
* Calculated size, in bytes, of a single element in the array. This
* is calculated based on \c count and the size of the data type
* represented by \c data_type.
*/
- GLsizei element_size;
+ GLsizei element_size;
/**
* Actual byte-stride from one element to the next. This value will
* be equal to either \c user_stride or \c element_stride.
*/
- GLsizei true_stride;
+ GLsizei true_stride;
/**
* Number of data values in each element.
*/
- GLint count;
+ GLint count;
/**
* "Normalized" data is on the range [0,1] (unsigned) or [-1,1] (signed).
* This is used for mapping integral types to floating point types.
*/
- GLboolean normalized;
+ GLboolean normalized;
/**
* Pre-calculated GLX protocol command header.
*/
- uint32_t header[2];
-
+ uint32_t header[2];
+
/**
* Size of the header data. For simple data, like glColorPointerfv,
* this is 4. For complex data that requires either a count (e.g.,
* glWeightfvARB), an index (e.g., glVertexAttrib1fvARB), or a
* selector enum (e.g., glMultiTexCoord2fv) this is 8.
*/
- unsigned header_size;
-
+ unsigned header_size;
+
/**
* Set to \c GL_TRUE if this array is enabled. Otherwise, it is set
* to \c GL_FALSE.
*/
- GLboolean enabled;
+ GLboolean enabled;
/**
* For multi-arrayed data (e.g., texture coordinates, generic vertex
* program attributes, etc.), this specifies which array this is.
*/
- unsigned index;
-
+ unsigned index;
+
/**
* Per-array-type key. For most arrays, this will be the GL enum for
* that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
* for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
* etc.).
*/
- GLenum key;
+ GLenum key;
/**
* If this array can be used with the "classic" \c glDrawArrays protocol,
* this is set to \c GL_TRUE. Otherwise, it is set to \c GL_FALSE.
*/
- GLboolean old_DrawArrays_possible;
+ GLboolean old_DrawArrays_possible;
};
@@ -129,28 +131,29 @@ struct array_state {
* Array state that is pushed / poped by \c glPushClientAttrib and
* \c glPopClientAttrib.
*/
-struct array_stack_state {
+struct array_stack_state
+{
/**
* Pointer to the application supplied data.
*/
- const void * data;
-
+ const void *data;
+
/**
* Enum representing the type of the application supplied data.
*/
- GLenum data_type;
+ GLenum data_type;
/**
* Stride value supplied by the application. This value is not used
* internally. It is only kept so that it can be queried by the
* application using glGet*v.
*/
- GLsizei user_stride;
+ GLsizei user_stride;
/**
* Number of data values in each element.
*/
- GLint count;
+ GLint count;
/**
* Per-array-type key. For most arrays, this will be the GL enum for
@@ -158,30 +161,31 @@ struct array_stack_state {
* for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
* etc.).
*/
- GLenum key;
+ GLenum key;
/**
* For multi-arrayed data (e.g., texture coordinates, generic vertex
* program attributes, etc.), this specifies which array this is.
*/
- unsigned index;
+ unsigned index;
/**
* Set to \c GL_TRUE if this array is enabled. Otherwise, it is set
* to \c GL_FALSE.
*/
- GLboolean enabled;
+ GLboolean enabled;
};
/**
* Collection of all the vertex array state.
*/
-struct array_state_vector {
+struct array_state_vector
+{
/**
* Number of arrays tracked by \c ::arrays.
*/
- size_t num_arrays;
+ size_t num_arrays;
/**
* Array of vertex array state. This array contains all of the valid
@@ -190,13 +194,13 @@ struct array_state_vector {
* EXT_fog_coord, there won't be a GL_FOG_COORD_ARRAY entry in this
* array.
*/
- struct array_state * arrays;
+ struct array_state *arrays;
/**
* Number of currently enabled client-side arrays. The value of this
* field is only valid if \c array_info_cache_valid is true.
*/
- size_t enabled_client_array_count;
+ size_t enabled_client_array_count;
/**
* \name ARRAY_INFO cache.
@@ -214,12 +218,12 @@ struct array_state_vector {
* \c array_info_cache_buffer_size. \c array_info_cache_base stores a
* pointer to the true start of the buffer (i.e., what malloc returned).
*/
- /*@{*/
- size_t array_info_cache_size;
- size_t array_info_cache_buffer_size;
- void * array_info_cache;
- void * array_info_cache_base;
- /*@}*/
+ /*@{ */
+ size_t array_info_cache_size;
+ size_t array_info_cache_buffer_size;
+ void *array_info_cache;
+ void *array_info_cache_base;
+ /*@} */
/**
@@ -228,7 +232,7 @@ struct array_state_vector {
* modifying the array settings for an enabled array and enabling /
* disabling an array.
*/
- GLboolean array_info_cache_valid;
+ GLboolean array_info_cache_valid;
/**
* Is it possible to use the GL 1.1 / EXT_vertex_arrays protocol? Use
@@ -241,7 +245,7 @@ struct array_state_vector {
* opcodes for \c glDrawArrays. For servers that advertise one or the
* other, there should be a way to select which opcode to use.
*/
- GLboolean old_DrawArrays_possible;
+ GLboolean old_DrawArrays_possible;
/**
* Is it possible to use the new GL X.X / ARB_vertex_buffer_object
@@ -251,15 +255,15 @@ struct array_state_vector {
* This protocol has not yet been defined by the ARB, but is currently a
* work in progress. This field is a place-holder.
*/
- GLboolean new_DrawArrays_possible;
+ GLboolean new_DrawArrays_possible;
/**
* Active texture unit set by \c glClientActiveTexture.
*
* \sa __glXGetActiveTextureUnit
*/
- unsigned active_texture_unit;
-
+ unsigned active_texture_unit;
+
/**
* Number of supported texture units. Even if ARB_multitexture /
* GL 1.3 are not supported, this will be at least 1. When multitexture
@@ -271,7 +275,7 @@ struct array_state_vector {
* instead (if GL 2.0 / ARB_fragment_shader / ARB_fragment_program /
* NV_fragment_program are supported).
*/
- unsigned num_texture_units;
+ unsigned num_texture_units;
/**
* Number of generic vertex program attribs. If GL_ARB_vertex_program
@@ -279,7 +283,7 @@ struct array_state_vector {
* queries by calling \c glGetProgramiv with \c GL_VERTEX_PROGRAM_ARB
* and \c GL_MAX_PROGRAM_ATTRIBS_ARB.
*/
- unsigned num_vertex_program_attribs;
+ unsigned num_vertex_program_attribs;
/**
* \n Methods for implementing various GL functions.
@@ -294,15 +298,15 @@ struct array_state_vector {
* \todo
* Write code to plug these functions directly into the dispatch table.
*/
- /*@{*/
- void (*DrawArrays)( GLenum, GLint, GLsizei );
- void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
- const GLvoid *indices );
- /*@}*/
-
- struct array_stack_state * stack;
- unsigned active_texture_unit_stack[ __GL_CLIENT_ATTRIB_STACK_DEPTH ];
- unsigned stack_index;
+ /*@{ */
+ void (*DrawArrays) (GLenum, GLint, GLsizei);
+ void (*DrawElements) (GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices);
+ /*@} */
+
+ struct array_stack_state *stack;
+ unsigned active_texture_unit_stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
+ unsigned stack_index;
};
#endif /* _INDIRECT_VA_PRIVATE_ */
diff --git a/src/glx/x11/indirect_vertex_program.c b/src/glx/x11/indirect_vertex_program.c
index 0a1091eaef..7d0ab3f2a8 100644
--- a/src/glx/x11/indirect_vertex_program.c
+++ b/src/glx/x11/indirect_vertex_program.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* (C) Copyright IBM Corporation 2005
* All Rights Reserved.
@@ -31,96 +32,104 @@
#include <GL/glxproto.h>
static void
-do_vertex_attrib_enable( GLuint index, GLboolean val )
+do_vertex_attrib_enable(GLuint index, GLboolean val)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
- if ( ! __glXSetArrayEnable( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
- index, val ) ) {
- __glXSetError(gc, GL_INVALID_ENUM);
- }
+ if (!__glXSetArrayEnable(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
+ index, val)) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ }
}
-void __indirect_glEnableVertexAttribArrayARB( GLuint index )
+void
+__indirect_glEnableVertexAttribArrayARB(GLuint index)
{
- do_vertex_attrib_enable( index, GL_TRUE );
+ do_vertex_attrib_enable(index, GL_TRUE);
}
-void __indirect_glDisableVertexAttribArrayARB( GLuint index )
+void
+__indirect_glDisableVertexAttribArrayARB(GLuint index)
{
- do_vertex_attrib_enable( index, GL_FALSE );
+ do_vertex_attrib_enable(index, GL_FALSE);
}
static void
-get_parameter( unsigned opcode, unsigned size, GLenum target, GLuint index,
- void * params )
+get_parameter(unsigned opcode, unsigned size, GLenum target, GLuint index,
+ void *params)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
- Display * const dpy = gc->currentDpy;
- const GLuint cmdlen = 12;
-
- if (__builtin_expect(dpy != NULL, 1)) {
- GLubyte const * pc = __glXSetupVendorRequest(gc,
- X_GLXVendorPrivateWithReply,
- opcode, cmdlen);
-
- *((GLenum *)(pc + 0)) = target;
- *((GLuint *)(pc + 4)) = index;
- *((GLuint *)(pc + 8)) = 0;
-
- (void) __glXReadReply(dpy, size, params, GL_FALSE);
- UnlockDisplay(dpy); SyncHandle();
- }
- return;
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ Display *const dpy = gc->currentDpy;
+ const GLuint cmdlen = 12;
+
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const *pc = __glXSetupVendorRequest(gc,
+ X_GLXVendorPrivateWithReply,
+ opcode, cmdlen);
+
+ *((GLenum *) (pc + 0)) = target;
+ *((GLuint *) (pc + 4)) = index;
+ *((GLuint *) (pc + 8)) = 0;
+
+ (void) __glXReadReply(dpy, size, params, GL_FALSE);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ return;
}
-void __indirect_glGetProgramEnvParameterfvARB( GLenum target, GLuint index,
- GLfloat * params )
+void
+__indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index,
+ GLfloat * params)
{
- get_parameter( 1296, 4, target, index, params );
+ get_parameter(1296, 4, target, index, params);
}
-void __indirect_glGetProgramEnvParameterdvARB( GLenum target, GLuint index,
- GLdouble * params )
+void
+__indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index,
+ GLdouble * params)
{
- get_parameter( 1297, 8, target, index, params );
+ get_parameter(1297, 8, target, index, params);
}
-void __indirect_glGetProgramLocalParameterfvARB( GLenum target, GLuint index,
- GLfloat * params )
+void
+__indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index,
+ GLfloat * params)
{
- get_parameter( 1305, 4, target, index, params );
+ get_parameter(1305, 4, target, index, params);
}
-void __indirect_glGetProgramLocalParameterdvARB( GLenum target, GLuint index,
- GLdouble * params )
+void
+__indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index,
+ GLdouble * params)
{
- get_parameter( 1306, 8, target, index, params );
+ get_parameter(1306, 8, target, index, params);
}
-void __indirect_glGetVertexAttribPointervNV( GLuint index, GLenum pname,
- GLvoid ** pointer )
+void
+__indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname,
+ GLvoid ** pointer)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
-
- if ( pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB ) {
- __glXSetError( gc, GL_INVALID_ENUM );
- }
-
- if ( ! __glXGetArrayPointer( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
- index, pointer ) ) {
- __glXSetError( gc, GL_INVALID_VALUE );
- }
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+
+ if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ }
+
+ if (!__glXGetArrayPointer(state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
+ index, pointer)) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ }
}
@@ -131,149 +140,151 @@ void __indirect_glGetVertexAttribPointervNV( GLuint index, GLenum pname,
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
*/
static GLboolean
-get_attrib_array_data( __GLXattribute * state, GLuint index, GLenum cap,
- GLintptr * data )
+get_attrib_array_data(__GLXattribute * state, GLuint index, GLenum cap,
+ GLintptr * data)
{
- GLboolean retval = GL_FALSE;
- const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
+ GLboolean retval = GL_FALSE;
+ const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
+
+ switch (cap) {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
+ retval = __glXGetArrayEnable(state, attrib, index, data);
+ break;
- switch( cap ) {
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
- retval = __glXGetArrayEnable( state, attrib, index, data );
- break;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
+ retval = __glXGetArraySize(state, attrib, index, data);
+ break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
- retval = __glXGetArraySize( state, attrib, index, data );
- break;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
+ retval = __glXGetArrayStride(state, attrib, index, data);
+ break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
- retval = __glXGetArrayStride( state, attrib, index, data );
- break;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
+ retval = __glXGetArrayType(state, attrib, index, data);
+ break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
- retval = __glXGetArrayType( state, attrib, index, data );
- break;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
+ retval = __glXGetArrayNormalized(state, attrib, index, data);
+ break;
+ }
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
- retval = __glXGetArrayNormalized( state, attrib, index, data );
- break;
- }
-
- return retval;
+ return retval;
}
-static void get_vertex_attrib( __GLXcontext * gc, unsigned vop,
- GLuint index, GLenum pname,
- xReply * reply )
+static void
+get_vertex_attrib(__GLXcontext * gc, unsigned vop,
+ GLuint index, GLenum pname, xReply * reply)
{
- Display * const dpy = gc->currentDpy;
- GLubyte * const pc = __glXSetupVendorRequest(gc,
- X_GLXVendorPrivateWithReply,
- vop, 8);
-
- *((uint32_t *)(pc + 0)) = index;
- *((uint32_t *)(pc + 4)) = pname;
-
- (void) _XReply( dpy, reply, 0, False );
+ Display *const dpy = gc->currentDpy;
+ GLubyte *const pc = __glXSetupVendorRequest(gc,
+ X_GLXVendorPrivateWithReply,
+ vop, 8);
+
+ *((uint32_t *) (pc + 0)) = index;
+ *((uint32_t *) (pc + 4)) = pname;
+
+ (void) _XReply(dpy, reply, 0, False);
}
-void __indirect_glGetVertexAttribivARB( GLuint index, GLenum pname,
- GLint * params )
+void
+__indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
- Display * const dpy = gc->currentDpy;
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- xGLXSingleReply reply;
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ Display *const dpy = gc->currentDpy;
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ xGLXSingleReply reply;
- get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply );
+ get_vertex_attrib(gc, 1303, index, pname, (xReply *) & reply);
- if ( reply.size != 0 ) {
- GLintptr data;
+ if (reply.size != 0) {
+ GLintptr data;
- if ( get_attrib_array_data( state, index, pname, & data ) ) {
- *params = (GLint) data;
- }
- else {
- if (reply.size == 1) {
- *params = (GLint) reply.pad3;
- }
- else {
- _XRead(dpy, (void *) params, 4 * reply.size);
- }
- }
- }
+ if (get_attrib_array_data(state, index, pname, &data)) {
+ *params = (GLint) data;
+ }
+ else {
+ if (reply.size == 1) {
+ *params = (GLint) reply.pad3;
+ }
+ else {
+ _XRead(dpy, (void *) params, 4 * reply.size);
+ }
+ }
+ }
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
}
-void __indirect_glGetVertexAttribfvARB( GLuint index, GLenum pname,
- GLfloat * params )
+void
+__indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname,
+ GLfloat * params)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
- Display * const dpy = gc->currentDpy;
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- xGLXSingleReply reply;
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ Display *const dpy = gc->currentDpy;
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ xGLXSingleReply reply;
- get_vertex_attrib( gc, 1302, index, pname, (xReply *) & reply );
+ get_vertex_attrib(gc, 1302, index, pname, (xReply *) & reply);
- if ( reply.size != 0 ) {
- GLintptr data;
+ if (reply.size != 0) {
+ GLintptr data;
- if ( get_attrib_array_data( state, index, pname, & data ) ) {
- *params = (GLfloat) data;
- }
- else {
- if (reply.size == 1) {
- (void) memcpy( params, & reply.pad3, sizeof( GLfloat ) );
- }
- else {
- _XRead(dpy, (void *) params, 4 * reply.size);
- }
- }
- }
+ if (get_attrib_array_data(state, index, pname, &data)) {
+ *params = (GLfloat) data;
+ }
+ else {
+ if (reply.size == 1) {
+ (void) memcpy(params, &reply.pad3, sizeof(GLfloat));
+ }
+ else {
+ _XRead(dpy, (void *) params, 4 * reply.size);
+ }
+ }
+ }
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
}
-void __indirect_glGetVertexAttribdvARB( GLuint index, GLenum pname,
- GLdouble * params )
+void
+__indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname,
+ GLdouble * params)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
- Display * const dpy = gc->currentDpy;
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- xGLXSingleReply reply;
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ Display *const dpy = gc->currentDpy;
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ xGLXSingleReply reply;
- get_vertex_attrib( gc, 1301, index, pname, (xReply *) & reply );
+ get_vertex_attrib(gc, 1301, index, pname, (xReply *) & reply);
- if ( reply.size != 0 ) {
- GLintptr data;
+ if (reply.size != 0) {
+ GLintptr data;
- if ( get_attrib_array_data( state, index, pname, & data ) ) {
- *params = (GLdouble) data;
- }
- else {
- if (reply.size == 1) {
- (void) memcpy( params, & reply.pad3, sizeof( GLdouble ) );
- }
- else {
- _XRead(dpy, (void *) params, 8 * reply.size);
- }
- }
- }
+ if (get_attrib_array_data(state, index, pname, &data)) {
+ *params = (GLdouble) data;
+ }
+ else {
+ if (reply.size == 1) {
+ (void) memcpy(params, &reply.pad3, sizeof(GLdouble));
+ }
+ else {
+ _XRead(dpy, (void *) params, 8 * reply.size);
+ }
+ }
+ }
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
}
diff --git a/src/glx/x11/indirect_window_pos.c b/src/glx/x11/indirect_window_pos.c
index 533f8ef1a4..b24b481c43 100644
--- a/src/glx/x11/indirect_window_pos.c
+++ b/src/glx/x11/indirect_window_pos.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* (C) Copyright IBM Corporation 2004
@@ -27,72 +28,86 @@
#include <GL/gl.h>
#include "indirect.h"
-void __indirect_glWindowPos2dMESA(GLdouble x, GLdouble y)
+void
+__indirect_glWindowPos2dMESA(GLdouble x, GLdouble y)
{
- __indirect_glWindowPos3fMESA(x, y, 0.0);
+ __indirect_glWindowPos3fMESA(x, y, 0.0);
}
-void __indirect_glWindowPos2iMESA(GLint x, GLint y)
+void
+__indirect_glWindowPos2iMESA(GLint x, GLint y)
{
- __indirect_glWindowPos3fMESA(x, y, 0.0);
+ __indirect_glWindowPos3fMESA(x, y, 0.0);
}
-void __indirect_glWindowPos2fMESA(GLfloat x, GLfloat y)
+void
+__indirect_glWindowPos2fMESA(GLfloat x, GLfloat y)
{
- __indirect_glWindowPos3fMESA(x, y, 0.0);
+ __indirect_glWindowPos3fMESA(x, y, 0.0);
}
-void __indirect_glWindowPos2sMESA(GLshort x, GLshort y)
+void
+__indirect_glWindowPos2sMESA(GLshort x, GLshort y)
{
- __indirect_glWindowPos3fMESA(x, y, 0.0);
+ __indirect_glWindowPos3fMESA(x, y, 0.0);
}
-void __indirect_glWindowPos2dvMESA(const GLdouble * p)
+void
+__indirect_glWindowPos2dvMESA(const GLdouble * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+ __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
}
-void __indirect_glWindowPos2fvMESA(const GLfloat * p)
+void
+__indirect_glWindowPos2fvMESA(const GLfloat * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+ __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
}
-void __indirect_glWindowPos2ivMESA(const GLint * p)
+void
+__indirect_glWindowPos2ivMESA(const GLint * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+ __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
}
-void __indirect_glWindowPos2svMESA(const GLshort * p)
+void
+__indirect_glWindowPos2svMESA(const GLshort * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
+ __indirect_glWindowPos3fMESA(p[0], p[1], 0.0);
}
-void __indirect_glWindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
+void
+__indirect_glWindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
{
- __indirect_glWindowPos3fMESA(x, y, z);
+ __indirect_glWindowPos3fMESA(x, y, z);
}
-void __indirect_glWindowPos3iMESA(GLint x, GLint y, GLint z)
+void
+__indirect_glWindowPos3iMESA(GLint x, GLint y, GLint z)
{
- __indirect_glWindowPos3fMESA(x, y, z);
+ __indirect_glWindowPos3fMESA(x, y, z);
}
-void __indirect_glWindowPos3sMESA(GLshort x, GLshort y, GLshort z)
+void
+__indirect_glWindowPos3sMESA(GLshort x, GLshort y, GLshort z)
{
- __indirect_glWindowPos3fMESA(x, y, z);
+ __indirect_glWindowPos3fMESA(x, y, z);
}
-void __indirect_glWindowPos3dvMESA(const GLdouble * p)
+void
+__indirect_glWindowPos3dvMESA(const GLdouble * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
+ __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
}
-void __indirect_glWindowPos3ivMESA(const GLint * p)
+void
+__indirect_glWindowPos3ivMESA(const GLint * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
+ __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
}
-void __indirect_glWindowPos3svMESA(const GLshort * p)
+void
+__indirect_glWindowPos3svMESA(const GLshort * p)
{
- __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
+ __indirect_glWindowPos3fMESA(p[0], p[1], p[2]);
}
diff --git a/src/glx/x11/packrender.h b/src/glx/x11/packrender.h
index cee827663a..6db6ea721f 100644
--- a/src/glx/x11/packrender.h
+++ b/src/glx/x11/packrender.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
#ifndef __GLX_packrender_h__
#define __GLX_packrender_h__
@@ -48,23 +49,23 @@
#define __GLX_PAD(a) (((a)+3) & ~3)
/*
- ** Network size parameters
- */
+** Network size parameters
+*/
#define sz_double 8
/* Setup for all commands */
-#define __GLX_DECLARE_VARIABLES() \
- __GLXcontext *gc; \
- GLubyte *pc, *pixelHeaderPC; \
- GLuint compsize, cmdlen
-
-#define __GLX_LOAD_VARIABLES() \
- gc = __glXGetCurrentContext(); \
- pc = gc->pc; \
- /* Muffle compilers */ \
- cmdlen = 0; (void)cmdlen; \
- compsize = 0; (void)compsize; \
- pixelHeaderPC = 0; (void)pixelHeaderPC
+#define __GLX_DECLARE_VARIABLES() \
+ __GLXcontext *gc; \
+ GLubyte *pc, *pixelHeaderPC; \
+ GLuint compsize, cmdlen
+
+#define __GLX_LOAD_VARIABLES() \
+ gc = __glXGetCurrentContext(); \
+ pc = gc->pc; \
+ /* Muffle compilers */ \
+ cmdlen = 0; (void)cmdlen; \
+ compsize = 0; (void)compsize; \
+ pixelHeaderPC = 0; (void)pixelHeaderPC
/*
** Variable sized command support macro. This macro is used by calls
@@ -73,53 +74,53 @@
** If the buffer can't hold the command then it is flushed so that
** the command will fit in the next buffer.
*/
-#define __GLX_BEGIN_VARIABLE(opcode,size) \
- if (pc + (size) > gc->bufEnd) { \
- pc = __glXFlushRenderBuffer(gc, pc); \
- } \
- __GLX_PUT_SHORT(0,size); \
- __GLX_PUT_SHORT(2,opcode)
-
-#define __GLX_BEGIN_VARIABLE_LARGE(opcode,size) \
- pc = __glXFlushRenderBuffer(gc, pc); \
- __GLX_PUT_LONG(0,size); \
- __GLX_PUT_LONG(4,opcode)
-
-#define __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode,size) \
- if (pc + (size) > gc->bufEnd) { \
- pc = __glXFlushRenderBuffer(gc, pc); \
- } \
- __GLX_PUT_SHORT(0,size); \
- __GLX_PUT_SHORT(2,opcode); \
- pc += __GLX_RENDER_HDR_SIZE; \
- pixelHeaderPC = pc; \
- pc += __GLX_PIXEL_HDR_SIZE
-
-#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,size) \
- pc = __glXFlushRenderBuffer(gc, pc); \
- __GLX_PUT_LONG(0,size); \
- __GLX_PUT_LONG(4,opcode); \
- pc += __GLX_RENDER_LARGE_HDR_SIZE; \
- pixelHeaderPC = pc; \
- pc += __GLX_PIXEL_HDR_SIZE
-
-#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size) \
- if (pc + (size) > gc->bufEnd) { \
- pc = __glXFlushRenderBuffer(gc, pc); \
- } \
- __GLX_PUT_SHORT(0,size); \
- __GLX_PUT_SHORT(2,opcode); \
- pc += __GLX_RENDER_HDR_SIZE; \
- pixelHeaderPC = pc; \
- pc += __GLX_PIXEL_3D_HDR_SIZE
-
-#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size) \
- pc = __glXFlushRenderBuffer(gc, pc); \
- __GLX_PUT_LONG(0,size); \
- __GLX_PUT_LONG(4,opcode); \
- pc += __GLX_RENDER_LARGE_HDR_SIZE; \
- pixelHeaderPC = pc; \
- pc += __GLX_PIXEL_3D_HDR_SIZE
+#define __GLX_BEGIN_VARIABLE(opcode,size) \
+ if (pc + (size) > gc->bufEnd) { \
+ pc = __glXFlushRenderBuffer(gc, pc); \
+ } \
+ __GLX_PUT_SHORT(0,size); \
+ __GLX_PUT_SHORT(2,opcode)
+
+#define __GLX_BEGIN_VARIABLE_LARGE(opcode,size) \
+ pc = __glXFlushRenderBuffer(gc, pc); \
+ __GLX_PUT_LONG(0,size); \
+ __GLX_PUT_LONG(4,opcode)
+
+#define __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode,size) \
+ if (pc + (size) > gc->bufEnd) { \
+ pc = __glXFlushRenderBuffer(gc, pc); \
+ } \
+ __GLX_PUT_SHORT(0,size); \
+ __GLX_PUT_SHORT(2,opcode); \
+ pc += __GLX_RENDER_HDR_SIZE; \
+ pixelHeaderPC = pc; \
+ pc += __GLX_PIXEL_HDR_SIZE
+
+#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,size) \
+ pc = __glXFlushRenderBuffer(gc, pc); \
+ __GLX_PUT_LONG(0,size); \
+ __GLX_PUT_LONG(4,opcode); \
+ pc += __GLX_RENDER_LARGE_HDR_SIZE; \
+ pixelHeaderPC = pc; \
+ pc += __GLX_PIXEL_HDR_SIZE
+
+#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size) \
+ if (pc + (size) > gc->bufEnd) { \
+ pc = __glXFlushRenderBuffer(gc, pc); \
+ } \
+ __GLX_PUT_SHORT(0,size); \
+ __GLX_PUT_SHORT(2,opcode); \
+ pc += __GLX_RENDER_HDR_SIZE; \
+ pixelHeaderPC = pc; \
+ pc += __GLX_PIXEL_3D_HDR_SIZE
+
+#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size) \
+ pc = __glXFlushRenderBuffer(gc, pc); \
+ __GLX_PUT_LONG(0,size); \
+ __GLX_PUT_LONG(4,opcode); \
+ pc += __GLX_RENDER_LARGE_HDR_SIZE; \
+ pixelHeaderPC = pc; \
+ pc += __GLX_PIXEL_3D_HDR_SIZE
/*
** Fixed size command support macro. This macro is used by calls that
@@ -129,8 +130,8 @@
** before doing the storage work.
*/
#define __GLX_BEGIN(opcode,size) \
- __GLX_PUT_SHORT(0,size); \
- __GLX_PUT_SHORT(2,opcode)
+ __GLX_PUT_SHORT(0,size); \
+ __GLX_PUT_SHORT(2,opcode)
/*
** Finish a rendering command by advancing the pc. If the pc is now past
@@ -140,52 +141,52 @@
** rendering buffer is flushed out into the X protocol stream (which may
** or may not do I/O).
*/
-#define __GLX_END(size) \
- pc += size; \
- if (pc > gc->limit) { \
- (void) __glXFlushRenderBuffer(gc, pc); \
- } else { \
- gc->pc = pc; \
- }
+#define __GLX_END(size) \
+ pc += size; \
+ if (pc > gc->limit) { \
+ (void) __glXFlushRenderBuffer(gc, pc); \
+ } else { \
+ gc->pc = pc; \
+ }
/* Array copy macros */
-#define __GLX_MEM_COPY(dest,src,bytes) \
- if (src && dest) \
- memcpy(dest, src, bytes)
+#define __GLX_MEM_COPY(dest,src,bytes) \
+ if (src && dest) \
+ memcpy(dest, src, bytes)
/* Single item copy macros */
-#define __GLX_PUT_CHAR(offset,a) \
- *((INT8 *) (pc + offset)) = a
+#define __GLX_PUT_CHAR(offset,a) \
+ *((INT8 *) (pc + offset)) = a
#ifndef _CRAY
-#define __GLX_PUT_SHORT(offset,a) \
- *((INT16 *) (pc + offset)) = a
+#define __GLX_PUT_SHORT(offset,a) \
+ *((INT16 *) (pc + offset)) = a
-#define __GLX_PUT_LONG(offset,a) \
- *((INT32 *) (pc + offset)) = a
+#define __GLX_PUT_LONG(offset,a) \
+ *((INT32 *) (pc + offset)) = a
-#define __GLX_PUT_FLOAT(offset,a) \
- *((FLOAT32 *) (pc + offset)) = a
+#define __GLX_PUT_FLOAT(offset,a) \
+ *((FLOAT32 *) (pc + offset)) = a
#else
-#define __GLX_PUT_SHORT(offset,a) \
- { GLubyte *cp = (pc+offset); \
- int shift = (64-16) - ((int)(cp) >> (64-6)); \
- *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
+#define __GLX_PUT_SHORT(offset,a) \
+ { GLubyte *cp = (pc+offset); \
+ int shift = (64-16) - ((int)(cp) >> (64-6)); \
+ *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
-#define __GLX_PUT_LONG(offset,a) \
- { GLubyte *cp = (pc+offset); \
- int shift = (64-32) - ((int)(cp) >> (64-6)); \
- *(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
+#define __GLX_PUT_LONG(offset,a) \
+ { GLubyte *cp = (pc+offset); \
+ int shift = (64-32) - ((int)(cp) >> (64-6)); \
+ *(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
-#define __GLX_PUT_FLOAT(offset,a) \
- gl_put_float((pc + offset),a)
+#define __GLX_PUT_FLOAT(offset,a) \
+ gl_put_float((pc + offset),a)
-#define __GLX_PUT_DOUBLE(offset,a) \
- gl_put_double(pc + offset, a)
+#define __GLX_PUT_DOUBLE(offset,a) \
+ gl_put_double(pc + offset, a)
-extern void gl_put_float(/*GLubyte *, struct cray_single*/);
-extern void gl_put_double(/*GLubyte *, struct cray_double*/);
+extern void gl_put_float( /*GLubyte *, struct cray_single */ );
+extern void gl_put_double( /*GLubyte *, struct cray_double */ );
#endif
#ifndef _CRAY
@@ -195,48 +196,48 @@ extern void gl_put_double(/*GLubyte *, struct cray_double*/);
** This can certainly be done better for a particular machine
** architecture!
*/
-#define __GLX_PUT_DOUBLE(offset,a) \
- __GLX_MEM_COPY(pc + offset, &a, 8)
+#define __GLX_PUT_DOUBLE(offset,a) \
+ __GLX_MEM_COPY(pc + offset, &a, 8)
#else
-#define __GLX_PUT_DOUBLE(offset,a) \
- *((FLOAT64 *) (pc + offset)) = a
+#define __GLX_PUT_DOUBLE(offset,a) \
+ *((FLOAT64 *) (pc + offset)) = a
#endif
#endif
-#define __GLX_PUT_CHAR_ARRAY(offset,a,alen) \
- __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT8)
+#define __GLX_PUT_CHAR_ARRAY(offset,a,alen) \
+ __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT8)
#ifndef _CRAY
-#define __GLX_PUT_SHORT_ARRAY(offset,a,alen) \
- __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT16)
+#define __GLX_PUT_SHORT_ARRAY(offset,a,alen) \
+ __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT16)
-#define __GLX_PUT_LONG_ARRAY(offset,a,alen) \
- __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT32)
+#define __GLX_PUT_LONG_ARRAY(offset,a,alen) \
+ __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_INT32)
-#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen) \
- __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT32)
+#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen) \
+ __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT32)
-#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen) \
- __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT64)
+#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen) \
+ __GLX_MEM_COPY(pc + offset, a, alen * __GLX_SIZE_FLOAT64)
#else
-#define __GLX_PUT_SHORT_ARRAY(offset,a,alen) \
- gl_put_short_array((GLubyte *)(pc + offset), a, alen * __GLX_SIZE_INT16)
+#define __GLX_PUT_SHORT_ARRAY(offset,a,alen) \
+ gl_put_short_array((GLubyte *)(pc + offset), a, alen * __GLX_SIZE_INT16)
-#define __GLX_PUT_LONG_ARRAY(offset,a,alen) \
- gl_put_long_array((GLubyte *)(pc + offset), (long *)a, alen * __GLX_SIZE_INT32)
+#define __GLX_PUT_LONG_ARRAY(offset,a,alen) \
+ gl_put_long_array((GLubyte *)(pc + offset), (long *)a, alen * __GLX_SIZE_INT32)
-#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen) \
- gl_put_float_array((GLubyte *)(pc + offset), (float *)a, alen * __GLX_SIZE_FLOAT32)
+#define __GLX_PUT_FLOAT_ARRAY(offset,a,alen) \
+ gl_put_float_array((GLubyte *)(pc + offset), (float *)a, alen * __GLX_SIZE_FLOAT32)
-#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen) \
- gl_put_double_array((GLubyte *)(pc + offset), (double *)a, alen * __GLX_SIZE_FLOAT64)
+#define __GLX_PUT_DOUBLE_ARRAY(offset,a,alen) \
+ gl_put_double_array((GLubyte *)(pc + offset), (double *)a, alen * __GLX_SIZE_FLOAT64)
-extern gl_put_short_array (GLubyte *, short *, int);
-extern gl_put_long_array (GLubyte *, long *, int);
-extern gl_put_float_array (GLubyte *, float *, int);
-extern gl_put_double_array (GLubyte *, double *, int);
+extern gl_put_short_array(GLubyte *, short *, int);
+extern gl_put_long_array(GLubyte *, long *, int);
+extern gl_put_float_array(GLubyte *, float *, int);
+extern gl_put_double_array(GLubyte *, double *, int);
#endif /* _CRAY */
diff --git a/src/glx/x11/packsingle.h b/src/glx/x11/packsingle.h
index 9dbf8ec914..1a4d321094 100644
--- a/src/glx/x11/packsingle.h
+++ b/src/glx/x11/packsingle.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
#ifndef __GLX_packsingle_h__
#define __GLX_packsingle_h__
@@ -48,107 +49,107 @@
#define X_GLXSingle 0
/* Declare common variables used during a single command */
-#define __GLX_SINGLE_DECLARE_VARIABLES() \
- __GLXcontext *gc = __glXGetCurrentContext(); \
- GLubyte *pc, *pixelHeaderPC; \
- GLuint compsize, cmdlen; \
- Display *dpy = gc->currentDpy; \
- xGLXSingleReq *req
-
-#define __GLX_SINGLE_LOAD_VARIABLES() \
- pc = gc->pc; \
- /* Muffle compilers */ \
- pixelHeaderPC = 0; (void)pixelHeaderPC; \
- compsize = 0; (void)compsize; \
- cmdlen = 0; (void)cmdlen
+#define __GLX_SINGLE_DECLARE_VARIABLES() \
+ __GLXcontext *gc = __glXGetCurrentContext(); \
+ GLubyte *pc, *pixelHeaderPC; \
+ GLuint compsize, cmdlen; \
+ Display *dpy = gc->currentDpy; \
+ xGLXSingleReq *req
+
+#define __GLX_SINGLE_LOAD_VARIABLES() \
+ pc = gc->pc; \
+ /* Muffle compilers */ \
+ pixelHeaderPC = 0; (void)pixelHeaderPC; \
+ compsize = 0; (void)compsize; \
+ cmdlen = 0; (void)cmdlen
/* Start a single command */
-#define __GLX_SINGLE_BEGIN(opcode,bytes) \
- if (dpy) { \
- (void) __glXFlushRenderBuffer(gc, pc); \
- LockDisplay(dpy); \
- GetReqExtra(GLXSingle,bytes,req); \
- req->reqType = gc->majorOpcode; \
- req->glxCode = opcode; \
- req->contextTag = gc->currentContextTag; \
- pc = ((GLubyte *)(req) + sz_xGLXSingleReq)
+#define __GLX_SINGLE_BEGIN(opcode,bytes) \
+ if (dpy) { \
+ (void) __glXFlushRenderBuffer(gc, pc); \
+ LockDisplay(dpy); \
+ GetReqExtra(GLXSingle,bytes,req); \
+ req->reqType = gc->majorOpcode; \
+ req->glxCode = opcode; \
+ req->contextTag = gc->currentContextTag; \
+ pc = ((GLubyte *)(req) + sz_xGLXSingleReq)
/* End a single command */
-#define __GLX_SINGLE_END() \
- UnlockDisplay(dpy); \
- SyncHandle(); \
- }
+#define __GLX_SINGLE_END() \
+ UnlockDisplay(dpy); \
+ SyncHandle(); \
+ }
/* Store data to sending for a single command */
-#define __GLX_SINGLE_PUT_CHAR(offset,a) \
- *((INT8 *) (pc + offset)) = a
+#define __GLX_SINGLE_PUT_CHAR(offset,a) \
+ *((INT8 *) (pc + offset)) = a
#ifndef CRAY
-#define __GLX_SINGLE_PUT_SHORT(offset,a) \
- *((INT16 *) (pc + offset)) = a
+#define __GLX_SINGLE_PUT_SHORT(offset,a) \
+ *((INT16 *) (pc + offset)) = a
-#define __GLX_SINGLE_PUT_LONG(offset,a) \
- *((INT32 *) (pc + offset)) = a
+#define __GLX_SINGLE_PUT_LONG(offset,a) \
+ *((INT32 *) (pc + offset)) = a
-#define __GLX_SINGLE_PUT_FLOAT(offset,a) \
- *((FLOAT32 *) (pc + offset)) = a
+#define __GLX_SINGLE_PUT_FLOAT(offset,a) \
+ *((FLOAT32 *) (pc + offset)) = a
#else
-#define __GLX_SINGLE_PUT_SHORT(offset,a) \
- { GLubyte *cp = (pc+offset); \
- int shift = (64-16) - ((int)(cp) >> (64-6)); \
+#define __GLX_SINGLE_PUT_SHORT(offset,a) \
+ { GLubyte *cp = (pc+offset); \
+ int shift = (64-16) - ((int)(cp) >> (64-6)); \
*(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); }
-#define __GLX_SINGLE_PUT_LONG(offset,a) \
- { GLubyte *cp = (pc+offset); \
- int shift = (64-32) - ((int)(cp) >> (64-6)); \
+#define __GLX_SINGLE_PUT_LONG(offset,a) \
+ { GLubyte *cp = (pc+offset); \
+ int shift = (64-32) - ((int)(cp) >> (64-6)); \
*(int *)cp = (*(int *)cp & ~(0xffffffff << shift)) | ((a & 0xffffffff) << shift); }
-#define __GLX_SINGLE_PUT_FLOAT(offset,a) \
- gl_put_float(pc + offset, a)
+#define __GLX_SINGLE_PUT_FLOAT(offset,a) \
+ gl_put_float(pc + offset, a)
#endif
/* Read support macros */
-#define __GLX_SINGLE_READ_XREPLY() \
- (void) _XReply(dpy, (xReply*) &reply, 0, False)
+#define __GLX_SINGLE_READ_XREPLY() \
+ (void) _XReply(dpy, (xReply*) &reply, 0, False)
-#define __GLX_SINGLE_GET_RETVAL(a,cast) \
- a = (cast) reply.retval
+#define __GLX_SINGLE_GET_RETVAL(a,cast) \
+ a = (cast) reply.retval
-#define __GLX_SINGLE_GET_SIZE(a) \
- a = (GLint) reply.size
+#define __GLX_SINGLE_GET_SIZE(a) \
+ a = (GLint) reply.size
#ifndef _CRAY
-#define __GLX_SINGLE_GET_CHAR(p) \
- *p = *(GLbyte *)&reply.pad3;
+#define __GLX_SINGLE_GET_CHAR(p) \
+ *p = *(GLbyte *)&reply.pad3;
-#define __GLX_SINGLE_GET_SHORT(p) \
- *p = *(GLshort *)&reply.pad3;
+#define __GLX_SINGLE_GET_SHORT(p) \
+ *p = *(GLshort *)&reply.pad3;
-#define __GLX_SINGLE_GET_LONG(p) \
- *p = *(GLint *)&reply.pad3;
+#define __GLX_SINGLE_GET_LONG(p) \
+ *p = *(GLint *)&reply.pad3;
-#define __GLX_SINGLE_GET_FLOAT(p) \
- *p = *(GLfloat *)&reply.pad3;
+#define __GLX_SINGLE_GET_FLOAT(p) \
+ *p = *(GLfloat *)&reply.pad3;
#else
-#define __GLX_SINGLE_GET_CHAR(p) \
- *p = reply.pad3 >> 24;
+#define __GLX_SINGLE_GET_CHAR(p) \
+ *p = reply.pad3 >> 24;
-#define __GLX_SINGLE_GET_SHORT(p) \
- {int t = reply.pad3 >> 16; \
- *p = (t & 0x8000) ? (t | ~0xffff) : (t & 0xffff);}
+#define __GLX_SINGLE_GET_SHORT(p) \
+ {int t = reply.pad3 >> 16; \
+ *p = (t & 0x8000) ? (t | ~0xffff) : (t & 0xffff);}
-#define __GLX_SINGLE_GET_LONG(p) \
- {int t = reply.pad3; \
- *p = (t & 0x80000000) ? (t | ~0xffffffff) : (t & 0xffffffff);}
+#define __GLX_SINGLE_GET_LONG(p) \
+ {int t = reply.pad3; \
+ *p = (t & 0x80000000) ? (t | ~0xffffffff) : (t & 0xffffffff);}
#define PAD3OFFSET 16
-#define __GLX_SINGLE_GET_FLOAT(p) \
- *p = gl_ntoh_float((GLubyte *)&reply + PAD3OFFSET);
+#define __GLX_SINGLE_GET_FLOAT(p) \
+ *p = gl_ntoh_float((GLubyte *)&reply + PAD3OFFSET);
-#define __GLX_SINGLE_GET_DOUBLE(p) \
- *p = gl_ntoh_double((GLubyte *)&reply + PAD3OFFSET);
+#define __GLX_SINGLE_GET_DOUBLE(p) \
+ *p = gl_ntoh_double((GLubyte *)&reply + PAD3OFFSET);
extern float gl_ntoh_float(GLubyte *);
extern float gl_ntoh_double(GLubyte *);
@@ -157,57 +158,57 @@ extern float gl_ntoh_double(GLubyte *);
#ifndef _CRAY
#ifdef __GLX_ALIGN64
-#define __GLX_SINGLE_GET_DOUBLE(p) \
- __GLX_MEM_COPY(p, &reply.pad3, 8)
+#define __GLX_SINGLE_GET_DOUBLE(p) \
+ __GLX_MEM_COPY(p, &reply.pad3, 8)
#else
-#define __GLX_SINGLE_GET_DOUBLE(p) \
- *p = *(GLdouble *)&reply.pad3
+#define __GLX_SINGLE_GET_DOUBLE(p) \
+ *p = *(GLdouble *)&reply.pad3
#endif
#endif
-
+
/* Get an array of typed data */
-#define __GLX_SINGLE_GET_VOID_ARRAY(a,alen) \
-{ \
- GLint slop = alen*__GLX_SIZE_INT8 & 3; \
- _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8); \
- if (slop) _XEatData(dpy,4-slop); \
-}
-
-#define __GLX_SINGLE_GET_CHAR_ARRAY(a,alen) \
-{ \
- GLint slop = alen*__GLX_SIZE_INT8 & 3; \
- _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8); \
- if (slop) _XEatData(dpy,4-slop); \
-}
-
-
-#define __GLX_SINGLE_GET_SHORT_ARRAY(a,alen) \
-{ \
- GLint slop = (alen*__GLX_SIZE_INT16) & 3; \
- _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT16);\
- if (slop) _XEatData(dpy,4-slop); \
-}
-
-#define __GLX_SINGLE_GET_LONG_ARRAY(a,alen) \
- _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT32);
+#define __GLX_SINGLE_GET_VOID_ARRAY(a,alen) \
+ { \
+ GLint slop = alen*__GLX_SIZE_INT8 & 3; \
+ _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8); \
+ if (slop) _XEatData(dpy,4-slop); \
+ }
+
+#define __GLX_SINGLE_GET_CHAR_ARRAY(a,alen) \
+ { \
+ GLint slop = alen*__GLX_SIZE_INT8 & 3; \
+ _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT8); \
+ if (slop) _XEatData(dpy,4-slop); \
+ }
+
+
+#define __GLX_SINGLE_GET_SHORT_ARRAY(a,alen) \
+ { \
+ GLint slop = (alen*__GLX_SIZE_INT16) & 3; \
+ _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT16); \
+ if (slop) _XEatData(dpy,4-slop); \
+ }
+
+#define __GLX_SINGLE_GET_LONG_ARRAY(a,alen) \
+ _XRead(dpy,(char *)a,alen*__GLX_SIZE_INT32);
#ifndef _CRAY
-#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen) \
- _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT32);
+#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen) \
+ _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT32);
-#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen) \
- _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT64);
+#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen) \
+ _XRead(dpy,(char *)a,alen*__GLX_SIZE_FLOAT64);
#else
-#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen) \
- gl_get_float_array(dpy,a,alen);
+#define __GLX_SINGLE_GET_FLOAT_ARRAY(a,alen) \
+ gl_get_float_array(dpy,a,alen);
-#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen) \
- gl_get_double_array(dpy, a, alen);
+#define __GLX_SINGLE_GET_DOUBLE_ARRAY(a,alen) \
+ gl_get_double_array(dpy, a, alen);
-extern void gl_get_float_array(Display *dpy, float *a, int alen);
-extern void gl_get_double_array(Display *dpy, double *a, int alen);
+extern void gl_get_float_array(Display * dpy, float *a, int alen);
+extern void gl_get_double_array(Display * dpy, double *a, int alen);
#endif
#endif /* !__GLX_packsingle_h__ */
diff --git a/src/glx/x11/pixel.c b/src/glx/x11/pixel.c
index 2174305b0c..c5d3ca4521 100644
--- a/src/glx/x11/pixel.c
+++ b/src/glx/x11/pixel.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -31,46 +32,46 @@
#include "packrender.h"
static const GLubyte MsbToLsbTable[256] = {
- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
- 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
- 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
- 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
- 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
- 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
- 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
- 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
- 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
- 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
- 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
- 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
- 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
- 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
- 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
- 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
- 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
- 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
- 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
- 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
- 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
- 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
- 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
- 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
- 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
- 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
- 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
- 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
- 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
- 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
- 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
- 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
};
static const GLubyte LowBitsMask[9] = {
- 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
+ 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
};
static const GLubyte HighBitsMask[9] = {
- 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff,
+ 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff,
};
@@ -79,76 +80,80 @@ static const GLubyte HighBitsMask[9] = {
** data is transfered into the destImage buffer. Return in modes the
** set of pixel modes that are to be done by the server.
*/
-static void FillBitmap(__GLXcontext *gc, GLint width, GLint height,
- GLenum format, const GLvoid *userdata,
- GLubyte *destImage)
+static void
+FillBitmap(__GLXcontext * gc, GLint width, GLint height,
+ GLenum format, const GLvoid * userdata, GLubyte * destImage)
{
- const __GLXattribute * state = gc->client_state_private;
- GLint rowLength = state->storeUnpack.rowLength;
- GLint alignment = state->storeUnpack.alignment;
- GLint skipPixels = state->storeUnpack.skipPixels;
- GLint skipRows = state->storeUnpack.skipRows;
- GLint lsbFirst = state->storeUnpack.lsbFirst;
- GLint elementsLeft, bitOffset, currentByte, nextByte, highBitMask;
- GLint lowBitMask, i;
- GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
- const GLubyte *start, *iter;
+ const __GLXattribute *state = gc->client_state_private;
+ GLint rowLength = state->storeUnpack.rowLength;
+ GLint alignment = state->storeUnpack.alignment;
+ GLint skipPixels = state->storeUnpack.skipPixels;
+ GLint skipRows = state->storeUnpack.skipRows;
+ GLint lsbFirst = state->storeUnpack.lsbFirst;
+ GLint elementsLeft, bitOffset, currentByte, nextByte, highBitMask;
+ GLint lowBitMask, i;
+ GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
+ const GLubyte *start, *iter;
- if (rowLength > 0) {
- groupsPerRow = rowLength;
- } else {
- groupsPerRow = width;
- }
- components = __glElementsPerGroup(format,GL_BITMAP);
- rowSize = (groupsPerRow * components + 7) >> 3;
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- start = ((const GLubyte*) userdata) + skipRows * rowSize +
- ((skipPixels * components) >> 3);
- bitOffset = (skipPixels * components) & 7;
- highBitMask = LowBitsMask[8-bitOffset];
- lowBitMask = HighBitsMask[bitOffset];
- elementsPerRow = width * components;
- for (i = 0; i < height; i++) {
- elementsLeft = elementsPerRow;
- iter = start;
- while (elementsLeft) {
- /* First retrieve low bits from current byte */
- if (lsbFirst) {
- currentByte = MsbToLsbTable[iter[0]];
- } else {
- currentByte = iter[0];
- }
- if (bitOffset) {
- /* Need to read next byte to finish current byte */
- if (elementsLeft > (8 - bitOffset)) {
- if (lsbFirst) {
- nextByte = MsbToLsbTable[iter[1]];
- } else {
- nextByte = iter[1];
- }
- currentByte =
- ((currentByte & highBitMask) << bitOffset) |
- ((nextByte & lowBitMask) >> (8 - bitOffset));
- } else {
- currentByte =
- ((currentByte & highBitMask) << bitOffset);
- }
- }
- if (elementsLeft >= 8) {
- *destImage = currentByte;
- elementsLeft -= 8;
- } else {
- *destImage = currentByte & HighBitsMask[elementsLeft];
- elementsLeft = 0;
- }
- destImage++;
- iter++;
- }
- start += rowSize;
- }
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ }
+ else {
+ groupsPerRow = width;
+ }
+ components = __glElementsPerGroup(format, GL_BITMAP);
+ rowSize = (groupsPerRow * components + 7) >> 3;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ start = ((const GLubyte *) userdata) + skipRows * rowSize +
+ ((skipPixels * components) >> 3);
+ bitOffset = (skipPixels * components) & 7;
+ highBitMask = LowBitsMask[8 - bitOffset];
+ lowBitMask = HighBitsMask[bitOffset];
+ elementsPerRow = width * components;
+ for (i = 0; i < height; i++) {
+ elementsLeft = elementsPerRow;
+ iter = start;
+ while (elementsLeft) {
+ /* First retrieve low bits from current byte */
+ if (lsbFirst) {
+ currentByte = MsbToLsbTable[iter[0]];
+ }
+ else {
+ currentByte = iter[0];
+ }
+ if (bitOffset) {
+ /* Need to read next byte to finish current byte */
+ if (elementsLeft > (8 - bitOffset)) {
+ if (lsbFirst) {
+ nextByte = MsbToLsbTable[iter[1]];
+ }
+ else {
+ nextByte = iter[1];
+ }
+ currentByte =
+ ((currentByte & highBitMask) << bitOffset) |
+ ((nextByte & lowBitMask) >> (8 - bitOffset));
+ }
+ else {
+ currentByte = ((currentByte & highBitMask) << bitOffset);
+ }
+ }
+ if (elementsLeft >= 8) {
+ *destImage = currentByte;
+ elementsLeft -= 8;
+ }
+ else {
+ *destImage = currentByte & HighBitsMask[elementsLeft];
+ elementsLeft = 0;
+ }
+ destImage++;
+ iter++;
+ }
+ start += rowSize;
+ }
}
/*
@@ -156,209 +161,224 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height,
** The internal packed array format used has LSB_FIRST = FALSE and
** ALIGNMENT = 1.
*/
-void __glFillImage(__GLXcontext *gc, GLint dim, GLint width, GLint height,
- GLint depth, GLenum format, GLenum type,
- const GLvoid *userdata, GLubyte *newimage, GLubyte *modes)
+void
+__glFillImage(__GLXcontext * gc, GLint dim, GLint width, GLint height,
+ GLint depth, GLenum format, GLenum type,
+ const GLvoid * userdata, GLubyte * newimage, GLubyte * modes)
{
- const __GLXattribute * state = gc->client_state_private;
- GLint rowLength = state->storeUnpack.rowLength;
- GLint imageHeight = state->storeUnpack.imageHeight;
- GLint alignment = state->storeUnpack.alignment;
- GLint skipPixels = state->storeUnpack.skipPixels;
- GLint skipRows = state->storeUnpack.skipRows;
- GLint skipImages = state->storeUnpack.skipImages;
- GLint swapBytes = state->storeUnpack.swapEndian;
- GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
- GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k;
- const GLubyte *start, *iter, *itera, *iterb, *iterc;
- GLubyte *iter2;
+ const __GLXattribute *state = gc->client_state_private;
+ GLint rowLength = state->storeUnpack.rowLength;
+ GLint imageHeight = state->storeUnpack.imageHeight;
+ GLint alignment = state->storeUnpack.alignment;
+ GLint skipPixels = state->storeUnpack.skipPixels;
+ GLint skipRows = state->storeUnpack.skipRows;
+ GLint skipImages = state->storeUnpack.skipImages;
+ GLint swapBytes = state->storeUnpack.swapEndian;
+ GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
+ GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k;
+ const GLubyte *start, *iter, *itera, *iterb, *iterc;
+ GLubyte *iter2;
- if (type == GL_BITMAP) {
- FillBitmap(gc, width, height, format, userdata, newimage);
- } else {
- components = __glElementsPerGroup(format,type);
- if (rowLength > 0) {
- groupsPerRow = rowLength;
- } else {
- groupsPerRow = width;
- }
- if (imageHeight > 0) {
- rowsPerImage = imageHeight;
- } else {
- rowsPerImage = height;
- }
+ if (type == GL_BITMAP) {
+ FillBitmap(gc, width, height, format, userdata, newimage);
+ }
+ else {
+ components = __glElementsPerGroup(format, type);
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ }
+ else {
+ groupsPerRow = width;
+ }
+ if (imageHeight > 0) {
+ rowsPerImage = imageHeight;
+ }
+ else {
+ rowsPerImage = height;
+ }
- elementSize = __glBytesPerElement(type);
- groupSize = elementSize * components;
- if (elementSize == 1) swapBytes = 0;
+ elementSize = __glBytesPerElement(type);
+ groupSize = elementSize * components;
+ if (elementSize == 1)
+ swapBytes = 0;
- rowSize = groupsPerRow * groupSize;
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- imageSize = rowSize * rowsPerImage;
- start = ((const GLubyte*) userdata) + skipImages * imageSize +
- skipRows * rowSize + skipPixels * groupSize;
- iter2 = newimage;
- elementsPerRow = width * components;
+ rowSize = groupsPerRow * groupSize;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ imageSize = rowSize * rowsPerImage;
+ start = ((const GLubyte *) userdata) + skipImages * imageSize +
+ skipRows * rowSize + skipPixels * groupSize;
+ iter2 = newimage;
+ elementsPerRow = width * components;
- if (swapBytes) {
- itera = start;
- for (h = 0; h < depth; h++) {
- iterb = itera;
- for (i = 0; i < height; i++) {
- iterc = iterb;
- for (j = 0; j < elementsPerRow; j++) {
- for (k = 1; k <= elementSize; k++) {
- iter2[k-1] = iterc[elementSize - k];
- }
- iter2 += elementSize;
- iterc += elementSize;
- }
- iterb += rowSize;
- }
- itera += imageSize;
- }
- } else {
- itera = start;
- for (h = 0; h < depth; h++) {
- if (rowSize == elementsPerRow * elementSize) {
- /* Ha! This is mondo easy! */
- __GLX_MEM_COPY(iter2, itera,
- elementsPerRow * elementSize * height);
- iter2 += elementsPerRow * elementSize * height;
- } else {
- iter = itera;
- for (i = 0; i < height; i++) {
- __GLX_MEM_COPY(iter2, iter, elementsPerRow*elementSize);
- iter2 += elementsPerRow * elementSize;
- iter += rowSize;
- }
- }
- itera += imageSize;
- }
- }
- }
+ if (swapBytes) {
+ itera = start;
+ for (h = 0; h < depth; h++) {
+ iterb = itera;
+ for (i = 0; i < height; i++) {
+ iterc = iterb;
+ for (j = 0; j < elementsPerRow; j++) {
+ for (k = 1; k <= elementSize; k++) {
+ iter2[k - 1] = iterc[elementSize - k];
+ }
+ iter2 += elementSize;
+ iterc += elementSize;
+ }
+ iterb += rowSize;
+ }
+ itera += imageSize;
+ }
+ }
+ else {
+ itera = start;
+ for (h = 0; h < depth; h++) {
+ if (rowSize == elementsPerRow * elementSize) {
+ /* Ha! This is mondo easy! */
+ __GLX_MEM_COPY(iter2, itera,
+ elementsPerRow * elementSize * height);
+ iter2 += elementsPerRow * elementSize * height;
+ }
+ else {
+ iter = itera;
+ for (i = 0; i < height; i++) {
+ __GLX_MEM_COPY(iter2, iter, elementsPerRow * elementSize);
+ iter2 += elementsPerRow * elementSize;
+ iter += rowSize;
+ }
+ }
+ itera += imageSize;
+ }
+ }
+ }
- /* Setup store modes that describe what we just did */
- if (modes) {
- if ( dim < 3 ) {
- (void) memcpy( modes, __glXDefaultPixelStore + 4, 20 );
- }
- else {
- (void) memcpy( modes, __glXDefaultPixelStore + 0, 36 );
- }
- }
+ /* Setup store modes that describe what we just did */
+ if (modes) {
+ if (dim < 3) {
+ (void) memcpy(modes, __glXDefaultPixelStore + 4, 20);
+ }
+ else {
+ (void) memcpy(modes, __glXDefaultPixelStore + 0, 36);
+ }
+ }
}
/*
** Empty a bitmap in LSB_FIRST=GL_FALSE and ALIGNMENT=4 format packing it
** into the clients memory using the pixel store PACK modes.
*/
-static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height,
- GLenum format, const GLubyte *sourceImage,
- GLvoid *userdata)
+static void
+EmptyBitmap(__GLXcontext * gc, GLint width, GLint height,
+ GLenum format, const GLubyte * sourceImage, GLvoid * userdata)
{
- const __GLXattribute * state = gc->client_state_private;
- GLint rowLength = state->storePack.rowLength;
- GLint alignment = state->storePack.alignment;
- GLint skipPixels = state->storePack.skipPixels;
- GLint skipRows = state->storePack.skipRows;
- GLint lsbFirst = state->storePack.lsbFirst;
- GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
- GLint sourceRowSize, sourcePadding, sourceSkip;
- GLubyte *start, *iter;
- GLint elementsLeft, bitOffset, currentByte, highBitMask, lowBitMask;
- GLint writeMask, i;
- GLubyte writeByte;
+ const __GLXattribute *state = gc->client_state_private;
+ GLint rowLength = state->storePack.rowLength;
+ GLint alignment = state->storePack.alignment;
+ GLint skipPixels = state->storePack.skipPixels;
+ GLint skipRows = state->storePack.skipRows;
+ GLint lsbFirst = state->storePack.lsbFirst;
+ GLint components, groupsPerRow, rowSize, padding, elementsPerRow;
+ GLint sourceRowSize, sourcePadding, sourceSkip;
+ GLubyte *start, *iter;
+ GLint elementsLeft, bitOffset, currentByte, highBitMask, lowBitMask;
+ GLint writeMask, i;
+ GLubyte writeByte;
- components = __glElementsPerGroup(format,GL_BITMAP);
- if (rowLength > 0) {
- groupsPerRow = rowLength;
- } else {
- groupsPerRow = width;
- }
+ components = __glElementsPerGroup(format, GL_BITMAP);
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ }
+ else {
+ groupsPerRow = width;
+ }
- rowSize = (groupsPerRow * components + 7) >> 3;
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- sourceRowSize = (width * components + 7) >> 3;
- sourcePadding = (sourceRowSize % 4);
- if (sourcePadding) {
- sourceSkip = 4 - sourcePadding;
- } else {
- sourceSkip = 0;
- }
- start = ((GLubyte*) userdata) + skipRows * rowSize +
- ((skipPixels * components) >> 3);
- bitOffset = (skipPixels * components) & 7;
- highBitMask = LowBitsMask[8-bitOffset];
- lowBitMask = HighBitsMask[bitOffset];
- elementsPerRow = width * components;
- for (i = 0; i < height; i++) {
- elementsLeft = elementsPerRow;
- iter = start;
- writeMask = highBitMask;
- writeByte = 0;
- while (elementsLeft) {
- /* Set up writeMask (to write to current byte) */
- if (elementsLeft + bitOffset < 8) {
- /* Need to trim writeMask */
- writeMask &= HighBitsMask[bitOffset+elementsLeft];
- }
+ rowSize = (groupsPerRow * components + 7) >> 3;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ sourceRowSize = (width * components + 7) >> 3;
+ sourcePadding = (sourceRowSize % 4);
+ if (sourcePadding) {
+ sourceSkip = 4 - sourcePadding;
+ }
+ else {
+ sourceSkip = 0;
+ }
+ start = ((GLubyte *) userdata) + skipRows * rowSize +
+ ((skipPixels * components) >> 3);
+ bitOffset = (skipPixels * components) & 7;
+ highBitMask = LowBitsMask[8 - bitOffset];
+ lowBitMask = HighBitsMask[bitOffset];
+ elementsPerRow = width * components;
+ for (i = 0; i < height; i++) {
+ elementsLeft = elementsPerRow;
+ iter = start;
+ writeMask = highBitMask;
+ writeByte = 0;
+ while (elementsLeft) {
+ /* Set up writeMask (to write to current byte) */
+ if (elementsLeft + bitOffset < 8) {
+ /* Need to trim writeMask */
+ writeMask &= HighBitsMask[bitOffset + elementsLeft];
+ }
- if (lsbFirst) {
- currentByte = MsbToLsbTable[iter[0]];
- } else {
- currentByte = iter[0];
- }
+ if (lsbFirst) {
+ currentByte = MsbToLsbTable[iter[0]];
+ }
+ else {
+ currentByte = iter[0];
+ }
- if (bitOffset) {
- writeByte |= (sourceImage[0] >> bitOffset);
- currentByte = (currentByte & ~writeMask) |
- (writeByte & writeMask);
- writeByte = (sourceImage[0] << (8 - bitOffset));
- } else {
- currentByte = (currentByte & ~writeMask) |
- (sourceImage[0] & writeMask);
- }
+ if (bitOffset) {
+ writeByte |= (sourceImage[0] >> bitOffset);
+ currentByte = (currentByte & ~writeMask) |
+ (writeByte & writeMask);
+ writeByte = (sourceImage[0] << (8 - bitOffset));
+ }
+ else {
+ currentByte = (currentByte & ~writeMask) |
+ (sourceImage[0] & writeMask);
+ }
- if (lsbFirst) {
- iter[0] = MsbToLsbTable[currentByte];
- } else {
- iter[0] = currentByte;
- }
+ if (lsbFirst) {
+ iter[0] = MsbToLsbTable[currentByte];
+ }
+ else {
+ iter[0] = currentByte;
+ }
- if (elementsLeft >= 8) {
- elementsLeft -= 8;
- } else {
- elementsLeft = 0;
- }
- sourceImage++;
- iter++;
- writeMask = 0xff;
- }
- if (writeByte) {
- /* Some data left over that still needs writing */
- writeMask &= lowBitMask;
- if (lsbFirst) {
- currentByte = MsbToLsbTable[iter[0]];
- } else {
- currentByte = iter[0];
- }
- currentByte = (currentByte & ~writeMask) | (writeByte & writeMask);
- if (lsbFirst) {
- iter[0] = MsbToLsbTable[currentByte];
- } else {
- iter[0] = currentByte;
- }
- }
- start += rowSize;
- sourceImage += sourceSkip;
- }
+ if (elementsLeft >= 8) {
+ elementsLeft -= 8;
+ }
+ else {
+ elementsLeft = 0;
+ }
+ sourceImage++;
+ iter++;
+ writeMask = 0xff;
+ }
+ if (writeByte) {
+ /* Some data left over that still needs writing */
+ writeMask &= lowBitMask;
+ if (lsbFirst) {
+ currentByte = MsbToLsbTable[iter[0]];
+ }
+ else {
+ currentByte = iter[0];
+ }
+ currentByte = (currentByte & ~writeMask) | (writeByte & writeMask);
+ if (lsbFirst) {
+ iter[0] = MsbToLsbTable[currentByte];
+ }
+ else {
+ iter[0] = currentByte;
+ }
+ }
+ start += rowSize;
+ sourceImage += sourceSkip;
+ }
}
/*
@@ -368,70 +388,75 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height,
** Named __glEmptyImage() because it is the opposite of __glFillImage().
*/
/* ARGSUSED */
-void __glEmptyImage(__GLXcontext *gc, GLint dim, GLint width, GLint height,
- GLint depth, GLenum format, GLenum type,
- const GLubyte *sourceImage, GLvoid *userdata)
+void
+__glEmptyImage(__GLXcontext * gc, GLint dim, GLint width, GLint height,
+ GLint depth, GLenum format, GLenum type,
+ const GLubyte * sourceImage, GLvoid * userdata)
{
- const __GLXattribute * state = gc->client_state_private;
- GLint rowLength = state->storePack.rowLength;
- GLint imageHeight = state->storePack.imageHeight;
- GLint alignment = state->storePack.alignment;
- GLint skipPixels = state->storePack.skipPixels;
- GLint skipRows = state->storePack.skipRows;
- GLint skipImages = state->storePack.skipImages;
- GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
- GLint elementsPerRow, sourceRowSize, sourcePadding, h, i;
- GLint imageSize, rowsPerImage;
- GLubyte *start, *iter, *itera;
+ const __GLXattribute *state = gc->client_state_private;
+ GLint rowLength = state->storePack.rowLength;
+ GLint imageHeight = state->storePack.imageHeight;
+ GLint alignment = state->storePack.alignment;
+ GLint skipPixels = state->storePack.skipPixels;
+ GLint skipRows = state->storePack.skipRows;
+ GLint skipImages = state->storePack.skipImages;
+ GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize;
+ GLint elementsPerRow, sourceRowSize, sourcePadding, h, i;
+ GLint imageSize, rowsPerImage;
+ GLubyte *start, *iter, *itera;
- if (type == GL_BITMAP) {
- EmptyBitmap(gc, width, height, format, sourceImage, userdata);
- } else {
- components = __glElementsPerGroup(format,type);
- if (rowLength > 0) {
- groupsPerRow = rowLength;
- } else {
- groupsPerRow = width;
- }
- if (imageHeight > 0) {
- rowsPerImage = imageHeight;
- } else {
- rowsPerImage = height;
- }
- elementSize = __glBytesPerElement(type);
- groupSize = elementSize * components;
- rowSize = groupsPerRow * groupSize;
- padding = (rowSize % alignment);
- if (padding) {
- rowSize += alignment - padding;
- }
- sourceRowSize = width * groupSize;
- sourcePadding = (sourceRowSize % 4);
- if (sourcePadding) {
- sourceRowSize += 4 - sourcePadding;
- }
- imageSize = sourceRowSize * rowsPerImage;
- start = ((GLubyte*) userdata) + skipImages * imageSize +
- skipRows * rowSize + skipPixels * groupSize;
- elementsPerRow = width * components;
+ if (type == GL_BITMAP) {
+ EmptyBitmap(gc, width, height, format, sourceImage, userdata);
+ }
+ else {
+ components = __glElementsPerGroup(format, type);
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ }
+ else {
+ groupsPerRow = width;
+ }
+ if (imageHeight > 0) {
+ rowsPerImage = imageHeight;
+ }
+ else {
+ rowsPerImage = height;
+ }
+ elementSize = __glBytesPerElement(type);
+ groupSize = elementSize * components;
+ rowSize = groupsPerRow * groupSize;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ sourceRowSize = width * groupSize;
+ sourcePadding = (sourceRowSize % 4);
+ if (sourcePadding) {
+ sourceRowSize += 4 - sourcePadding;
+ }
+ imageSize = sourceRowSize * rowsPerImage;
+ start = ((GLubyte *) userdata) + skipImages * imageSize +
+ skipRows * rowSize + skipPixels * groupSize;
+ elementsPerRow = width * components;
- itera = start;
- for (h = 0; h < depth; h++) {
- if ((rowSize == sourceRowSize) && (sourcePadding == 0)) {
- /* Ha! This is mondo easy! */
- __GLX_MEM_COPY(itera, sourceImage,
- elementsPerRow * elementSize * height);
- sourceImage += elementsPerRow * elementSize * height;
- } else {
- iter = itera;
- for (i = 0; i < height; i++) {
- __GLX_MEM_COPY(iter, sourceImage,
- elementsPerRow * elementSize);
- sourceImage += sourceRowSize;
- iter += rowSize;
- }
- }
- itera += imageSize;
- }
- }
+ itera = start;
+ for (h = 0; h < depth; h++) {
+ if ((rowSize == sourceRowSize) && (sourcePadding == 0)) {
+ /* Ha! This is mondo easy! */
+ __GLX_MEM_COPY(itera, sourceImage,
+ elementsPerRow * elementSize * height);
+ sourceImage += elementsPerRow * elementSize * height;
+ }
+ else {
+ iter = itera;
+ for (i = 0; i < height; i++) {
+ __GLX_MEM_COPY(iter, sourceImage,
+ elementsPerRow * elementSize);
+ sourceImage += sourceRowSize;
+ iter += rowSize;
+ }
+ }
+ itera += imageSize;
+ }
+ }
}
diff --git a/src/glx/x11/pixelstore.c b/src/glx/x11/pixelstore.c
index 0bc16854ae..e6bed20a49 100644
--- a/src/glx/x11/pixelstore.c
+++ b/src/glx/x11/pixelstore.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -42,148 +43,157 @@
* \sa __indirect_glPixelStorei, __indirect_glPixelStoref
*/
static void
-send_PixelStore( __GLXcontext * gc, unsigned sop, GLenum pname,
- const void * param )
+send_PixelStore(__GLXcontext * gc, unsigned sop, GLenum pname,
+ const void *param)
{
- Display * const dpy = gc->currentDpy;
- const GLuint cmdlen = 8;
- if (__builtin_expect(dpy != NULL, 1)) {
- GLubyte const * pc = __glXSetupSingleRequest(gc, sop, cmdlen);
- (void) memcpy((void *)(pc + 0), (void *)(&pname), 4);
- (void) memcpy((void *)(pc + 4), param, 4);
- UnlockDisplay(dpy); SyncHandle();
- }
- return;
+ Display *const dpy = gc->currentDpy;
+ const GLuint cmdlen = 8;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const *pc = __glXSetupSingleRequest(gc, sop, cmdlen);
+ (void) memcpy((void *) (pc + 0), (void *) (&pname), 4);
+ (void) memcpy((void *) (pc + 4), param, 4);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ return;
}
/*
** Specify parameters that control the storage format of pixel arrays.
*/
-void __indirect_glPixelStoref(GLenum pname, GLfloat param)
+void
+__indirect_glPixelStoref(GLenum pname, GLfloat param)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = gc->client_state_private;
- Display *dpy = gc->currentDpy;
- GLuint a;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = gc->client_state_private;
+ Display *dpy = gc->currentDpy;
+ GLuint a;
- if (!dpy) return;
+ if (!dpy)
+ return;
- switch (pname) {
- case GL_PACK_ROW_LENGTH:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.rowLength = a;
- break;
- case GL_PACK_IMAGE_HEIGHT:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.imageHeight = a;
- break;
- case GL_PACK_SKIP_ROWS:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.skipRows = a;
- break;
- case GL_PACK_SKIP_PIXELS:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.skipPixels = a;
- break;
- case GL_PACK_SKIP_IMAGES:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.skipImages = a;
- break;
- case GL_PACK_ALIGNMENT:
- a = (GLint) (param + 0.5);
- switch (a) {
- case 1: case 2: case 4: case 8:
- state->storePack.alignment = a;
- break;
- default:
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- break;
- case GL_PACK_SWAP_BYTES:
- state->storePack.swapEndian = (param != 0);
- break;
- case GL_PACK_LSB_FIRST:
- state->storePack.lsbFirst = (param != 0);
- break;
+ switch (pname) {
+ case GL_PACK_ROW_LENGTH:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.rowLength = a;
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.imageHeight = a;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.skipRows = a;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.skipPixels = a;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.skipImages = a;
+ break;
+ case GL_PACK_ALIGNMENT:
+ a = (GLint) (param + 0.5);
+ switch (a) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ state->storePack.alignment = a;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ break;
+ case GL_PACK_SWAP_BYTES:
+ state->storePack.swapEndian = (param != 0);
+ break;
+ case GL_PACK_LSB_FIRST:
+ state->storePack.lsbFirst = (param != 0);
+ break;
- case GL_UNPACK_ROW_LENGTH:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.rowLength = a;
- break;
- case GL_UNPACK_IMAGE_HEIGHT:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.imageHeight = a;
- break;
- case GL_UNPACK_SKIP_ROWS:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.skipRows = a;
- break;
- case GL_UNPACK_SKIP_PIXELS:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.skipPixels = a;
- break;
- case GL_UNPACK_SKIP_IMAGES:
- a = (GLuint) (param + 0.5);
- if (((GLint) a) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.skipImages = a;
- break;
- case GL_UNPACK_ALIGNMENT:
- a = (GLint) (param + 0.5);
- switch (a) {
- case 1: case 2: case 4: case 8:
- state->storeUnpack.alignment = a;
- break;
- default:
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- break;
- case GL_UNPACK_SWAP_BYTES:
- state->storeUnpack.swapEndian = (param != 0);
- break;
- case GL_UNPACK_LSB_FIRST:
- state->storeUnpack.lsbFirst = (param != 0);
- break;
+ case GL_UNPACK_ROW_LENGTH:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.rowLength = a;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.imageHeight = a;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.skipRows = a;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.skipPixels = a;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ a = (GLuint) (param + 0.5);
+ if (((GLint) a) < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.skipImages = a;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ a = (GLint) (param + 0.5);
+ switch (a) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ state->storeUnpack.alignment = a;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ state->storeUnpack.swapEndian = (param != 0);
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ state->storeUnpack.lsbFirst = (param != 0);
+ break;
/* Group all of the pixel store modes that need to be sent to the
* server here. Care must be used to only send modes to the server that
@@ -191,128 +201,136 @@ void __indirect_glPixelStoref(GLenum pname, GLfloat param)
* server. GL_PACK_INVERT_MESA is safe in this respect, but other,
* future modes may not be.
*/
- case GL_PACK_INVERT_MESA:
- send_PixelStore( gc, X_GLsop_PixelStoref, pname, & param );
- break;
+ case GL_PACK_INVERT_MESA:
+ send_PixelStore(gc, X_GLsop_PixelStoref, pname, &param);
+ break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- break;
- }
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ break;
+ }
}
-void __indirect_glPixelStorei(GLenum pname, GLint param)
+void
+__indirect_glPixelStorei(GLenum pname, GLint param)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = gc->client_state_private;
- Display *dpy = gc->currentDpy;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = gc->client_state_private;
+ Display *dpy = gc->currentDpy;
- if (!dpy) return;
+ if (!dpy)
+ return;
- switch (pname) {
- case GL_PACK_ROW_LENGTH:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.rowLength = param;
- break;
- case GL_PACK_IMAGE_HEIGHT:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.imageHeight = param;
- break;
- case GL_PACK_SKIP_ROWS:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.skipRows = param;
- break;
- case GL_PACK_SKIP_PIXELS:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.skipPixels = param;
- break;
- case GL_PACK_SKIP_IMAGES:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storePack.skipImages = param;
- break;
- case GL_PACK_ALIGNMENT:
- switch (param) {
- case 1: case 2: case 4: case 8:
- state->storePack.alignment = param;
- break;
- default:
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- break;
- case GL_PACK_SWAP_BYTES:
- state->storePack.swapEndian = (param != 0);
- break;
- case GL_PACK_LSB_FIRST:
- state->storePack.lsbFirst = (param != 0);
- break;
+ switch (pname) {
+ case GL_PACK_ROW_LENGTH:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.rowLength = param;
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.imageHeight = param;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.skipRows = param;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.skipPixels = param;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storePack.skipImages = param;
+ break;
+ case GL_PACK_ALIGNMENT:
+ switch (param) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ state->storePack.alignment = param;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ break;
+ case GL_PACK_SWAP_BYTES:
+ state->storePack.swapEndian = (param != 0);
+ break;
+ case GL_PACK_LSB_FIRST:
+ state->storePack.lsbFirst = (param != 0);
+ break;
- case GL_UNPACK_ROW_LENGTH:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.rowLength = param;
- break;
- case GL_UNPACK_IMAGE_HEIGHT:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.imageHeight = param;
- break;
- case GL_UNPACK_SKIP_ROWS:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.skipRows = param;
- break;
- case GL_UNPACK_SKIP_PIXELS:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.skipPixels = param;
- break;
- case GL_UNPACK_SKIP_IMAGES:
- if (param < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- state->storeUnpack.skipImages = param;
- break;
- case GL_UNPACK_ALIGNMENT:
- switch (param) {
- case 1: case 2: case 4: case 8:
- state->storeUnpack.alignment = param;
- break;
- default:
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- break;
- case GL_UNPACK_SWAP_BYTES:
- state->storeUnpack.swapEndian = (param != 0);
- break;
- case GL_UNPACK_LSB_FIRST:
- state->storeUnpack.lsbFirst = (param != 0);
- break;
+ case GL_UNPACK_ROW_LENGTH:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.rowLength = param;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.imageHeight = param;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.skipRows = param;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.skipPixels = param;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ if (param < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ state->storeUnpack.skipImages = param;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ switch (param) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ state->storeUnpack.alignment = param;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ state->storeUnpack.swapEndian = (param != 0);
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ state->storeUnpack.lsbFirst = (param != 0);
+ break;
/* Group all of the pixel store modes that need to be sent to the
* server here. Care must be used to only send modes to the server that
@@ -320,12 +338,12 @@ void __indirect_glPixelStorei(GLenum pname, GLint param)
* server. GL_PACK_INVERT_MESA is safe in this respect, but other,
* future modes may not be.
*/
- case GL_PACK_INVERT_MESA:
- send_PixelStore( gc, X_GLsop_PixelStorei, pname, & param );
- break;
+ case GL_PACK_INVERT_MESA:
+ send_PixelStore(gc, X_GLsop_PixelStorei, pname, &param);
+ break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- break;
- }
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ break;
+ }
}
diff --git a/src/glx/x11/render2.c b/src/glx/x11/render2.c
index 025becbd19..f1740bcffb 100644
--- a/src/glx/x11/render2.c
+++ b/src/glx/x11/render2.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -38,320 +39,344 @@
** use the pixel header. See renderpix.c for those routines.
*/
-void __indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
- GLint order, const GLdouble *pnts)
+void
+__indirect_glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+ GLint order, const GLdouble * pnts)
{
- __GLX_DECLARE_VARIABLES();
- GLint k;
+ __GLX_DECLARE_VARIABLES();
+ GLint k;
- __GLX_LOAD_VARIABLES();
- k = __glMap1d_size(target);
- if (k == 0) {
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- } else if (stride < k || order <= 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- compsize = k * order * __GLX_SIZE_FLOAT64;
- cmdlen = 28+compsize;
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ k = __glMap1d_size(target);
+ if (k == 0) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+ else if (stride < k || order <= 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ compsize = k * order * __GLX_SIZE_FLOAT64;
+ cmdlen = 28 + compsize;
+ if (!gc->currentDpy)
+ return;
- if (cmdlen <= gc->maxSmallRenderCommandSize) {
- /* Use GLXRender protocol to send small command */
- __GLX_BEGIN_VARIABLE(X_GLrop_Map1d,cmdlen);
- __GLX_PUT_DOUBLE(4,u1);
- __GLX_PUT_DOUBLE(12,u2);
- __GLX_PUT_LONG(20,target);
- __GLX_PUT_LONG(24,order);
- /*
- ** NOTE: the doubles that follow are not aligned because of 3
- ** longs preceeding
- */
- __glFillMap1d(k, order, stride, pnts, (pc+28));
- __GLX_END(cmdlen);
- } else {
- /* Use GLXRenderLarge protocol to send command */
- __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1d,cmdlen+4);
- __GLX_PUT_DOUBLE(8,u1);
- __GLX_PUT_DOUBLE(16,u2);
- __GLX_PUT_LONG(24,target);
- __GLX_PUT_LONG(28,order);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ /* Use GLXRender protocol to send small command */
+ __GLX_BEGIN_VARIABLE(X_GLrop_Map1d, cmdlen);
+ __GLX_PUT_DOUBLE(4, u1);
+ __GLX_PUT_DOUBLE(12, u2);
+ __GLX_PUT_LONG(20, target);
+ __GLX_PUT_LONG(24, order);
+ /*
+ ** NOTE: the doubles that follow are not aligned because of 3
+ ** longs preceeding
+ */
+ __glFillMap1d(k, order, stride, pnts, (pc + 28));
+ __GLX_END(cmdlen);
+ }
+ else {
+ /* Use GLXRenderLarge protocol to send command */
+ __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1d, cmdlen + 4);
+ __GLX_PUT_DOUBLE(8, u1);
+ __GLX_PUT_DOUBLE(16, u2);
+ __GLX_PUT_LONG(24, target);
+ __GLX_PUT_LONG(28, order);
- /*
- ** NOTE: the doubles that follow are not aligned because of 3
- ** longs preceeding
- */
- if (stride != k) {
- GLubyte *buf;
+ /*
+ ** NOTE: the doubles that follow are not aligned because of 3
+ ** longs preceeding
+ */
+ if (stride != k) {
+ GLubyte *buf;
- buf = (GLubyte *) Xmalloc(compsize);
- if (!buf) {
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- return;
- }
- __glFillMap1d(k, order, stride, pnts, buf);
- __glXSendLargeCommand(gc, pc, 32, buf, compsize);
- Xfree((char*) buf);
- } else {
- /* Data is already packed. Just send it out */
- __glXSendLargeCommand(gc, pc, 32, pnts, compsize);
- }
- }
+ buf = (GLubyte *) Xmalloc(compsize);
+ if (!buf) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+ __glFillMap1d(k, order, stride, pnts, buf);
+ __glXSendLargeCommand(gc, pc, 32, buf, compsize);
+ Xfree((char *) buf);
+ }
+ else {
+ /* Data is already packed. Just send it out */
+ __glXSendLargeCommand(gc, pc, 32, pnts, compsize);
+ }
+ }
}
-void __indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
- GLint order, const GLfloat *pnts)
+void
+__indirect_glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+ GLint order, const GLfloat * pnts)
{
- __GLX_DECLARE_VARIABLES();
- GLint k;
+ __GLX_DECLARE_VARIABLES();
+ GLint k;
- __GLX_LOAD_VARIABLES();
- k = __glMap1f_size(target);
- if (k == 0) {
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- } else if (stride < k || order <= 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- compsize = k * order * __GLX_SIZE_FLOAT32;
- cmdlen = 20+compsize;
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ k = __glMap1f_size(target);
+ if (k == 0) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+ else if (stride < k || order <= 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ compsize = k * order * __GLX_SIZE_FLOAT32;
+ cmdlen = 20 + compsize;
+ if (!gc->currentDpy)
+ return;
- /*
+ /*
** The order that arguments are packed is different from the order
** for glMap1d.
*/
- if (cmdlen <= gc->maxSmallRenderCommandSize) {
- /* Use GLXRender protocol to send small command */
- __GLX_BEGIN_VARIABLE(X_GLrop_Map1f,cmdlen);
- __GLX_PUT_LONG(4,target);
- __GLX_PUT_FLOAT(8,u1);
- __GLX_PUT_FLOAT(12,u2);
- __GLX_PUT_LONG(16,order);
- __glFillMap1f(k, order, stride, pnts, (GLubyte*) (pc+20));
- __GLX_END(cmdlen);
- } else {
- /* Use GLXRenderLarge protocol to send command */
- __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1f,cmdlen+4);
- __GLX_PUT_LONG(8,target);
- __GLX_PUT_FLOAT(12,u1);
- __GLX_PUT_FLOAT(16,u2);
- __GLX_PUT_LONG(20,order);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ /* Use GLXRender protocol to send small command */
+ __GLX_BEGIN_VARIABLE(X_GLrop_Map1f, cmdlen);
+ __GLX_PUT_LONG(4, target);
+ __GLX_PUT_FLOAT(8, u1);
+ __GLX_PUT_FLOAT(12, u2);
+ __GLX_PUT_LONG(16, order);
+ __glFillMap1f(k, order, stride, pnts, (GLubyte *) (pc + 20));
+ __GLX_END(cmdlen);
+ }
+ else {
+ /* Use GLXRenderLarge protocol to send command */
+ __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map1f, cmdlen + 4);
+ __GLX_PUT_LONG(8, target);
+ __GLX_PUT_FLOAT(12, u1);
+ __GLX_PUT_FLOAT(16, u2);
+ __GLX_PUT_LONG(20, order);
- if (stride != k) {
- GLubyte *buf;
+ if (stride != k) {
+ GLubyte *buf;
- buf = (GLubyte *) Xmalloc(compsize);
- if (!buf) {
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- return;
- }
- __glFillMap1f(k, order, stride, pnts, buf);
- __glXSendLargeCommand(gc, pc, 24, buf, compsize);
- Xfree((char*) buf);
- } else {
- /* Data is already packed. Just send it out */
- __glXSendLargeCommand(gc, pc, 24, pnts, compsize);
- }
- }
+ buf = (GLubyte *) Xmalloc(compsize);
+ if (!buf) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+ __glFillMap1f(k, order, stride, pnts, buf);
+ __glXSendLargeCommand(gc, pc, 24, buf, compsize);
+ Xfree((char *) buf);
+ }
+ else {
+ /* Data is already packed. Just send it out */
+ __glXSendLargeCommand(gc, pc, 24, pnts, compsize);
+ }
+ }
}
-void __indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustr, GLint uord,
- GLdouble v1, GLdouble v2, GLint vstr, GLint vord,
- const GLdouble *pnts)
+void
+__indirect_glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustr,
+ GLint uord, GLdouble v1, GLdouble v2, GLint vstr,
+ GLint vord, const GLdouble * pnts)
{
- __GLX_DECLARE_VARIABLES();
- GLint k;
+ __GLX_DECLARE_VARIABLES();
+ GLint k;
- __GLX_LOAD_VARIABLES();
- k = __glMap2d_size(target);
- if (k == 0) {
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- } else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- compsize = k * uord * vord * __GLX_SIZE_FLOAT64;
- cmdlen = 48+compsize;
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ k = __glMap2d_size(target);
+ if (k == 0) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+ else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ compsize = k * uord * vord * __GLX_SIZE_FLOAT64;
+ cmdlen = 48 + compsize;
+ if (!gc->currentDpy)
+ return;
- if (cmdlen <= gc->maxSmallRenderCommandSize) {
- /* Use GLXRender protocol to send small command */
- __GLX_BEGIN_VARIABLE(X_GLrop_Map2d,cmdlen);
- __GLX_PUT_DOUBLE(4,u1);
- __GLX_PUT_DOUBLE(12,u2);
- __GLX_PUT_DOUBLE(20,v1);
- __GLX_PUT_DOUBLE(28,v2);
- __GLX_PUT_LONG(36,target);
- __GLX_PUT_LONG(40,uord);
- __GLX_PUT_LONG(44,vord);
- /*
- ** Pack into a u-major ordering.
- ** NOTE: the doubles that follow are not aligned because of 5
- ** longs preceeding
- */
- __glFillMap2d(k, uord, vord, ustr, vstr, pnts, (GLdouble*) (pc+48));
- __GLX_END(cmdlen);
- } else {
- /* Use GLXRenderLarge protocol to send command */
- __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2d,cmdlen+4);
- __GLX_PUT_DOUBLE(8,u1);
- __GLX_PUT_DOUBLE(16,u2);
- __GLX_PUT_DOUBLE(24,v1);
- __GLX_PUT_DOUBLE(32,v2);
- __GLX_PUT_LONG(40,target);
- __GLX_PUT_LONG(44,uord);
- __GLX_PUT_LONG(48,vord);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ /* Use GLXRender protocol to send small command */
+ __GLX_BEGIN_VARIABLE(X_GLrop_Map2d, cmdlen);
+ __GLX_PUT_DOUBLE(4, u1);
+ __GLX_PUT_DOUBLE(12, u2);
+ __GLX_PUT_DOUBLE(20, v1);
+ __GLX_PUT_DOUBLE(28, v2);
+ __GLX_PUT_LONG(36, target);
+ __GLX_PUT_LONG(40, uord);
+ __GLX_PUT_LONG(44, vord);
+ /*
+ ** Pack into a u-major ordering.
+ ** NOTE: the doubles that follow are not aligned because of 5
+ ** longs preceeding
+ */
+ __glFillMap2d(k, uord, vord, ustr, vstr, pnts, (GLdouble *) (pc + 48));
+ __GLX_END(cmdlen);
+ }
+ else {
+ /* Use GLXRenderLarge protocol to send command */
+ __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2d, cmdlen + 4);
+ __GLX_PUT_DOUBLE(8, u1);
+ __GLX_PUT_DOUBLE(16, u2);
+ __GLX_PUT_DOUBLE(24, v1);
+ __GLX_PUT_DOUBLE(32, v2);
+ __GLX_PUT_LONG(40, target);
+ __GLX_PUT_LONG(44, uord);
+ __GLX_PUT_LONG(48, vord);
- /*
- ** NOTE: the doubles that follow are not aligned because of 5
- ** longs preceeding
- */
- if ((vstr != k) || (ustr != k*vord)) {
- GLdouble *buf;
+ /*
+ ** NOTE: the doubles that follow are not aligned because of 5
+ ** longs preceeding
+ */
+ if ((vstr != k) || (ustr != k * vord)) {
+ GLdouble *buf;
- buf = (GLdouble *) Xmalloc(compsize);
- if (!buf) {
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- return;
- }
- /*
- ** Pack into a u-major ordering.
- */
- __glFillMap2d(k, uord, vord, ustr, vstr, pnts, buf);
- __glXSendLargeCommand(gc, pc, 52, buf, compsize);
- Xfree((char*) buf);
- } else {
- /* Data is already packed. Just send it out */
- __glXSendLargeCommand(gc, pc, 52, pnts, compsize);
- }
- }
+ buf = (GLdouble *) Xmalloc(compsize);
+ if (!buf) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+ /*
+ ** Pack into a u-major ordering.
+ */
+ __glFillMap2d(k, uord, vord, ustr, vstr, pnts, buf);
+ __glXSendLargeCommand(gc, pc, 52, buf, compsize);
+ Xfree((char *) buf);
+ }
+ else {
+ /* Data is already packed. Just send it out */
+ __glXSendLargeCommand(gc, pc, 52, pnts, compsize);
+ }
+ }
}
-void __indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustr, GLint uord,
- GLfloat v1, GLfloat v2, GLint vstr, GLint vord,
- const GLfloat *pnts)
+void
+__indirect_glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustr,
+ GLint uord, GLfloat v1, GLfloat v2, GLint vstr, GLint vord,
+ const GLfloat * pnts)
{
- __GLX_DECLARE_VARIABLES();
- GLint k;
+ __GLX_DECLARE_VARIABLES();
+ GLint k;
- __GLX_LOAD_VARIABLES();
- k = __glMap2f_size(target);
- if (k == 0) {
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- } else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
- compsize = k * uord * vord * __GLX_SIZE_FLOAT32;
- cmdlen = 32+compsize;
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ k = __glMap2f_size(target);
+ if (k == 0) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+ else if (vstr < k || ustr < k || vord <= 0 || uord <= 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+ compsize = k * uord * vord * __GLX_SIZE_FLOAT32;
+ cmdlen = 32 + compsize;
+ if (!gc->currentDpy)
+ return;
- /*
+ /*
** The order that arguments are packed is different from the order
** for glMap2d.
*/
- if (cmdlen <= gc->maxSmallRenderCommandSize) {
- /* Use GLXRender protocol to send small command */
- __GLX_BEGIN_VARIABLE(X_GLrop_Map2f,cmdlen);
- __GLX_PUT_LONG(4,target);
- __GLX_PUT_FLOAT(8,u1);
- __GLX_PUT_FLOAT(12,u2);
- __GLX_PUT_LONG(16,uord);
- __GLX_PUT_FLOAT(20,v1);
- __GLX_PUT_FLOAT(24,v2);
- __GLX_PUT_LONG(28,vord);
- /*
- ** Pack into a u-major ordering.
- */
- __glFillMap2f(k, uord, vord, ustr, vstr, pnts, (GLfloat*) (pc+32));
- __GLX_END(cmdlen);
- } else {
- /* Use GLXRenderLarge protocol to send command */
- __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2f,cmdlen+4);
- __GLX_PUT_LONG(8,target);
- __GLX_PUT_FLOAT(12,u1);
- __GLX_PUT_FLOAT(16,u2);
- __GLX_PUT_LONG(20,uord);
- __GLX_PUT_FLOAT(24,v1);
- __GLX_PUT_FLOAT(28,v2);
- __GLX_PUT_LONG(32,vord);
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ /* Use GLXRender protocol to send small command */
+ __GLX_BEGIN_VARIABLE(X_GLrop_Map2f, cmdlen);
+ __GLX_PUT_LONG(4, target);
+ __GLX_PUT_FLOAT(8, u1);
+ __GLX_PUT_FLOAT(12, u2);
+ __GLX_PUT_LONG(16, uord);
+ __GLX_PUT_FLOAT(20, v1);
+ __GLX_PUT_FLOAT(24, v2);
+ __GLX_PUT_LONG(28, vord);
+ /*
+ ** Pack into a u-major ordering.
+ */
+ __glFillMap2f(k, uord, vord, ustr, vstr, pnts, (GLfloat *) (pc + 32));
+ __GLX_END(cmdlen);
+ }
+ else {
+ /* Use GLXRenderLarge protocol to send command */
+ __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_Map2f, cmdlen + 4);
+ __GLX_PUT_LONG(8, target);
+ __GLX_PUT_FLOAT(12, u1);
+ __GLX_PUT_FLOAT(16, u2);
+ __GLX_PUT_LONG(20, uord);
+ __GLX_PUT_FLOAT(24, v1);
+ __GLX_PUT_FLOAT(28, v2);
+ __GLX_PUT_LONG(32, vord);
- if ((vstr != k) || (ustr != k*vord)) {
- GLfloat *buf;
+ if ((vstr != k) || (ustr != k * vord)) {
+ GLfloat *buf;
- buf = (GLfloat *) Xmalloc(compsize);
- if (!buf) {
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- return;
- }
- /*
- ** Pack into a u-major ordering.
- */
- __glFillMap2f(k, uord, vord, ustr, vstr, pnts, buf);
- __glXSendLargeCommand(gc, pc, 36, buf, compsize);
- Xfree((char*) buf);
- } else {
- /* Data is already packed. Just send it out */
- __glXSendLargeCommand(gc, pc, 36, pnts, compsize);
- }
- }
+ buf = (GLfloat *) Xmalloc(compsize);
+ if (!buf) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+ /*
+ ** Pack into a u-major ordering.
+ */
+ __glFillMap2f(k, uord, vord, ustr, vstr, pnts, buf);
+ __glXSendLargeCommand(gc, pc, 36, buf, compsize);
+ Xfree((char *) buf);
+ }
+ else {
+ /* Data is already packed. Just send it out */
+ __glXSendLargeCommand(gc, pc, 36, pnts, compsize);
+ }
+ }
}
-void __indirect_glEnable(GLenum cap)
+void
+__indirect_glEnable(GLenum cap)
{
- __GLX_DECLARE_VARIABLES();
+ __GLX_DECLARE_VARIABLES();
- __GLX_LOAD_VARIABLES();
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ if (!gc->currentDpy)
+ return;
- switch(cap) {
- case GL_COLOR_ARRAY:
- case GL_EDGE_FLAG_ARRAY:
- case GL_INDEX_ARRAY:
- case GL_NORMAL_ARRAY:
- case GL_TEXTURE_COORD_ARRAY:
- case GL_VERTEX_ARRAY:
- case GL_SECONDARY_COLOR_ARRAY:
- case GL_FOG_COORD_ARRAY:
- __indirect_glEnableClientState(cap);
- return;
- default:
- break;
- }
+ switch (cap) {
+ case GL_COLOR_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_VERTEX_ARRAY:
+ case GL_SECONDARY_COLOR_ARRAY:
+ case GL_FOG_COORD_ARRAY:
+ __indirect_glEnableClientState(cap);
+ return;
+ default:
+ break;
+ }
- __GLX_BEGIN(X_GLrop_Enable,8);
- __GLX_PUT_LONG(4,cap);
- __GLX_END(8);
+ __GLX_BEGIN(X_GLrop_Enable, 8);
+ __GLX_PUT_LONG(4, cap);
+ __GLX_END(8);
}
-void __indirect_glDisable(GLenum cap)
+void
+__indirect_glDisable(GLenum cap)
{
- __GLX_DECLARE_VARIABLES();
+ __GLX_DECLARE_VARIABLES();
- __GLX_LOAD_VARIABLES();
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ if (!gc->currentDpy)
+ return;
- switch(cap) {
- case GL_COLOR_ARRAY:
- case GL_EDGE_FLAG_ARRAY:
- case GL_INDEX_ARRAY:
- case GL_NORMAL_ARRAY:
- case GL_TEXTURE_COORD_ARRAY:
- case GL_VERTEX_ARRAY:
- case GL_SECONDARY_COLOR_ARRAY:
- case GL_FOG_COORD_ARRAY:
- __indirect_glDisableClientState(cap);
- return;
- default:
- break;
- }
+ switch (cap) {
+ case GL_COLOR_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_VERTEX_ARRAY:
+ case GL_SECONDARY_COLOR_ARRAY:
+ case GL_FOG_COORD_ARRAY:
+ __indirect_glDisableClientState(cap);
+ return;
+ default:
+ break;
+ }
- __GLX_BEGIN(X_GLrop_Disable,8);
- __GLX_PUT_LONG(4,cap);
- __GLX_END(8);
+ __GLX_BEGIN(X_GLrop_Disable, 8);
+ __GLX_PUT_LONG(4, cap);
+ __GLX_END(8);
}
diff --git a/src/glx/x11/renderpix.c b/src/glx/x11/renderpix.c
index 0b7b77c742..e7d7c04dc6 100644
--- a/src/glx/x11/renderpix.c
+++ b/src/glx/x11/renderpix.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -82,42 +83,43 @@
* broken.
*/
void
-__glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type, const GLvoid *src,
- GLubyte *pc, GLubyte *modes)
+__glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
+ GLint width, GLint height, GLint depth,
+ GLenum format, GLenum type, const GLvoid * src,
+ GLubyte * pc, GLubyte * modes)
{
- if ( !gc->fastImageUnpack || (src == NULL) ) {
- /* Allocate a temporary holding buffer */
- GLubyte *buf = (GLubyte *) Xmalloc(compsize);
- if (!buf) {
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- return;
- }
+ if (!gc->fastImageUnpack || (src == NULL)) {
+ /* Allocate a temporary holding buffer */
+ GLubyte *buf = (GLubyte *) Xmalloc(compsize);
+ if (!buf) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
- /* Apply pixel store unpack modes to copy data into buf */
- if ( src != NULL ) {
- (*gc->fillImage)(gc, dim, width, height, depth, format, type,
- src, buf, modes);
- }
- else {
- if ( dim < 3 ) {
- (void) memcpy( modes, __glXDefaultPixelStore + 4, 20 );
- }
- else {
- (void) memcpy( modes, __glXDefaultPixelStore + 0, 36 );
- }
- }
+ /* Apply pixel store unpack modes to copy data into buf */
+ if (src != NULL) {
+ (*gc->fillImage) (gc, dim, width, height, depth, format, type,
+ src, buf, modes);
+ }
+ else {
+ if (dim < 3) {
+ (void) memcpy(modes, __glXDefaultPixelStore + 4, 20);
+ }
+ else {
+ (void) memcpy(modes, __glXDefaultPixelStore + 0, 36);
+ }
+ }
- /* Send large command */
- __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize);
+ /* Send large command */
+ __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize);
- /* Free buffer */
- Xfree((char*) buf);
- } else {
- /* Just send the data straight as is */
- __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, pc, compsize);
- }
+ /* Free buffer */
+ Xfree((char *) buf);
+ }
+ else {
+ /* Just send the data straight as is */
+ __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, pc, compsize);
+ }
}
/************************************************************************/
@@ -129,81 +131,89 @@ __glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
* The \c fastImageUnpack path, which is thankfully never used, is completely
* broken.
*/
-void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *row,
- const GLvoid *column)
+void
+__indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
+ GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid * row,
+ const GLvoid * column)
{
- __GLX_DECLARE_VARIABLES();
- GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len;
+ __GLX_DECLARE_VARIABLES();
+ GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len;
- __GLX_LOAD_VARIABLES();
- compsize = __glImageSize(width, 1, 1, format, type, 0);
- compsize2 = __glImageSize(height, 1, 1, format, type, 0);
- totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
- hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE);
- image1len = __GLX_PAD(compsize);
- image2len = __GLX_PAD(compsize2);
- cmdlen = totalhdrlen + image1len + image2len;
- if (!gc->currentDpy) return;
+ __GLX_LOAD_VARIABLES();
+ compsize = __glImageSize(width, 1, 1, format, type, 0);
+ compsize2 = __glImageSize(height, 1, 1, format, type, 0);
+ totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
+ hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE);
+ image1len = __GLX_PAD(compsize);
+ image2len = __GLX_PAD(compsize2);
+ cmdlen = totalhdrlen + image1len + image2len;
+ if (!gc->currentDpy)
+ return;
- if (cmdlen <= gc->maxSmallRenderCommandSize) {
- /* Use GLXRender protocol to send small command */
- __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen);
- __GLX_PUT_LONG(0,target);
- __GLX_PUT_LONG(4,internalformat);
- __GLX_PUT_LONG(8,width);
- __GLX_PUT_LONG(12,height);
- __GLX_PUT_LONG(16,format);
- __GLX_PUT_LONG(20,type);
- pc += hdrlen;
- if (compsize > 0) {
- (*gc->fillImage)(gc, 1, width, 1, 1, format, type,
- row, pc, pixelHeaderPC);
- pc += image1len;
- }
- if (compsize2 > 0) {
- (*gc->fillImage)(gc, 1, height, 1, 1, format, type,
- column, pc, NULL);
- pc += image2len;
- }
- if ((compsize == 0) && (compsize2 == 0)) {
- /* Setup default store modes */
- (void) memcpy( pixelHeaderPC, __glXDefaultPixelStore + 4, 20 );
- }
- __GLX_END(0);
- } else {
- const GLint bufsize = image1len + image2len;
+ if (cmdlen <= gc->maxSmallRenderCommandSize) {
+ /* Use GLXRender protocol to send small command */
+ __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen);
+ __GLX_PUT_LONG(0, target);
+ __GLX_PUT_LONG(4, internalformat);
+ __GLX_PUT_LONG(8, width);
+ __GLX_PUT_LONG(12, height);
+ __GLX_PUT_LONG(16, format);
+ __GLX_PUT_LONG(20, type);
+ pc += hdrlen;
+ if (compsize > 0) {
+ (*gc->fillImage) (gc, 1, width, 1, 1, format, type,
+ row, pc, pixelHeaderPC);
+ pc += image1len;
+ }
+ if (compsize2 > 0) {
+ (*gc->fillImage) (gc, 1, height, 1, 1, format, type,
+ column, pc, NULL);
+ pc += image2len;
+ }
+ if ((compsize == 0) && (compsize2 == 0)) {
+ /* Setup default store modes */
+ (void) memcpy(pixelHeaderPC, __glXDefaultPixelStore + 4, 20);
+ }
+ __GLX_END(0);
+ }
+ else {
+ const GLint bufsize = image1len + image2len;
- /* Use GLXRenderLarge protocol to send command */
- __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,cmdlen+4);
- __GLX_PUT_LONG(0,target);
- __GLX_PUT_LONG(4,internalformat);
- __GLX_PUT_LONG(8,width);
- __GLX_PUT_LONG(12,height);
- __GLX_PUT_LONG(16,format);
- __GLX_PUT_LONG(20,type);
- pc += hdrlen;
+ /* Use GLXRenderLarge protocol to send command */
+ __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,
+ cmdlen + 4);
+ __GLX_PUT_LONG(0, target);
+ __GLX_PUT_LONG(4, internalformat);
+ __GLX_PUT_LONG(8, width);
+ __GLX_PUT_LONG(12, height);
+ __GLX_PUT_LONG(16, format);
+ __GLX_PUT_LONG(20, type);
+ pc += hdrlen;
- if (!gc->fastImageUnpack) {
- /* Allocate a temporary holding buffer */
- GLubyte *buf = (GLubyte *) Xmalloc(bufsize);
- if (!buf) {
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- return;
- }
- (*gc->fillImage)(gc, 1, width, 1, 1, format, type, row, buf, pixelHeaderPC);
+ if (!gc->fastImageUnpack) {
+ /* Allocate a temporary holding buffer */
+ GLubyte *buf = (GLubyte *) Xmalloc(bufsize);
+ if (!buf) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+ (*gc->fillImage) (gc, 1, width, 1, 1, format, type, row, buf,
+ pixelHeaderPC);
- (*gc->fillImage)(gc, 1, height, 1, 1, format, type, column,
- buf + image1len, pixelHeaderPC);
+ (*gc->fillImage) (gc, 1, height, 1, 1, format, type, column,
+ buf + image1len, pixelHeaderPC);
- /* Send large command */
- __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), buf, bufsize);
- /* Free buffer */
- Xfree((char*) buf);
- } else {
- /* Just send the data straight as is */
- __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), pc, bufsize);
- }
- }
+ /* Send large command */
+ __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf,
+ bufsize);
+ /* Free buffer */
+ Xfree((char *) buf);
+ }
+ else {
+ /* Just send the data straight as is */
+ __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), pc,
+ bufsize);
+ }
+ }
}
diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c
index a97d4c7def..9732b6ef04 100644
--- a/src/glx/x11/single2.c
+++ b/src/glx/x11/single2.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -37,55 +38,59 @@
#include "indirect_vertex_array.h"
/* Used for GL_ARB_transpose_matrix */
-static void TransposeMatrixf(GLfloat m[16])
+static void
+TransposeMatrixf(GLfloat m[16])
{
- int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < i; j++) {
- GLfloat tmp = m[i*4+j];
- m[i*4+j] = m[j*4+i];
- m[j*4+i] = tmp;
- }
- }
+ int i, j;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < i; j++) {
+ GLfloat tmp = m[i * 4 + j];
+ m[i * 4 + j] = m[j * 4 + i];
+ m[j * 4 + i] = tmp;
+ }
+ }
}
/* Used for GL_ARB_transpose_matrix */
-static void TransposeMatrixb(GLboolean m[16])
+static void
+TransposeMatrixb(GLboolean m[16])
{
- int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < i; j++) {
- GLboolean tmp = m[i*4+j];
- m[i*4+j] = m[j*4+i];
- m[j*4+i] = tmp;
- }
- }
+ int i, j;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < i; j++) {
+ GLboolean tmp = m[i * 4 + j];
+ m[i * 4 + j] = m[j * 4 + i];
+ m[j * 4 + i] = tmp;
+ }
+ }
}
/* Used for GL_ARB_transpose_matrix */
-static void TransposeMatrixd(GLdouble m[16])
+static void
+TransposeMatrixd(GLdouble m[16])
{
- int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < i; j++) {
- GLdouble tmp = m[i*4+j];
- m[i*4+j] = m[j*4+i];
- m[j*4+i] = tmp;
- }
- }
+ int i, j;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < i; j++) {
+ GLdouble tmp = m[i * 4 + j];
+ m[i * 4 + j] = m[j * 4 + i];
+ m[j * 4 + i] = tmp;
+ }
+ }
}
/* Used for GL_ARB_transpose_matrix */
-static void TransposeMatrixi(GLint m[16])
+static void
+TransposeMatrixi(GLint m[16])
{
- int i, j;
- for (i = 0; i < 4; i++) {
- for (j = 0; j < i; j++) {
- GLint tmp = m[i*4+j];
- m[i*4+j] = m[j*4+i];
- m[j*4+i] = tmp;
- }
- }
+ int i, j;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < i; j++) {
+ GLint tmp = m[i * 4 + j];
+ m[i * 4 + j] = m[j * 4 + i];
+ m[j * 4 + i] = tmp;
+ }
+ }
}
@@ -94,41 +99,42 @@ static void TransposeMatrixi(GLint m[16])
* that are not transpose-matrix enums are unaffected.
*/
static GLenum
-RemapTransposeEnum( GLenum e )
+RemapTransposeEnum(GLenum e)
{
- switch( e ) {
- case GL_TRANSPOSE_MODELVIEW_MATRIX:
- case GL_TRANSPOSE_PROJECTION_MATRIX:
- case GL_TRANSPOSE_TEXTURE_MATRIX:
- return e - (GL_TRANSPOSE_MODELVIEW_MATRIX - GL_MODELVIEW_MATRIX);
- case GL_TRANSPOSE_COLOR_MATRIX:
- return GL_COLOR_MATRIX;
- default:
- return e;
- };
+ switch (e) {
+ case GL_TRANSPOSE_MODELVIEW_MATRIX:
+ case GL_TRANSPOSE_PROJECTION_MATRIX:
+ case GL_TRANSPOSE_TEXTURE_MATRIX:
+ return e - (GL_TRANSPOSE_MODELVIEW_MATRIX - GL_MODELVIEW_MATRIX);
+ case GL_TRANSPOSE_COLOR_MATRIX:
+ return GL_COLOR_MATRIX;
+ default:
+ return e;
+ };
}
-GLenum __indirect_glGetError(void)
+GLenum
+__indirect_glGetError(void)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
- GLuint retval = GL_NO_ERROR;
- xGLXGetErrorReply reply;
-
- if (gc->error) {
- /* Use internal error first */
- retval = gc->error;
- gc->error = GL_NO_ERROR;
- return retval;
- }
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_GetError,0);
- __GLX_SINGLE_READ_XREPLY();
- retval = reply.error;
- __GLX_SINGLE_END();
-
- return retval;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ GLuint retval = GL_NO_ERROR;
+ xGLXGetErrorReply reply;
+
+ if (gc->error) {
+ /* Use internal error first */
+ retval = gc->error;
+ gc->error = GL_NO_ERROR;
+ return retval;
+ }
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_GetError, 0);
+ __GLX_SINGLE_READ_XREPLY();
+ retval = reply.error;
+ __GLX_SINGLE_END();
+
+ return retval;
}
@@ -139,447 +145,473 @@ GLenum __indirect_glGetError(void)
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
*/
static GLboolean
-get_client_data( __GLXcontext * gc, GLenum cap, GLintptr * data )
+get_client_data(__GLXcontext * gc, GLenum cap, GLintptr * data)
{
- GLboolean retval = GL_TRUE;
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- const GLint tex_unit = __glXGetActiveTextureUnit( state );
-
-
- switch( cap ) {
- case GL_VERTEX_ARRAY:
- case GL_NORMAL_ARRAY:
- case GL_COLOR_ARRAY:
- case GL_INDEX_ARRAY:
- case GL_EDGE_FLAG_ARRAY:
- case GL_SECONDARY_COLOR_ARRAY:
- case GL_FOG_COORD_ARRAY:
- retval = __glXGetArrayEnable( state, cap, 0, data );
- break;
-
- case GL_VERTEX_ARRAY_SIZE:
- retval = __glXGetArraySize( state, GL_VERTEX_ARRAY, 0, data );
- break;
- case GL_COLOR_ARRAY_SIZE:
- retval = __glXGetArraySize( state, GL_COLOR_ARRAY, 0, data );
- break;
- case GL_SECONDARY_COLOR_ARRAY_SIZE:
- retval = __glXGetArraySize( state, GL_SECONDARY_COLOR_ARRAY, 0, data );
- break;
-
- case GL_VERTEX_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_VERTEX_ARRAY, 0, data );
- break;
- case GL_NORMAL_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_NORMAL_ARRAY, 0, data );
- break;
- case GL_INDEX_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_INDEX_ARRAY, 0, data );
- break;
- case GL_COLOR_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_COLOR_ARRAY, 0, data );
- break;
- case GL_SECONDARY_COLOR_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_SECONDARY_COLOR_ARRAY, 0, data );
- break;
- case GL_FOG_COORD_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_FOG_COORD_ARRAY, 0, data );
- break;
-
- case GL_VERTEX_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_VERTEX_ARRAY, 0, data );
- break;
- case GL_NORMAL_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_NORMAL_ARRAY, 0, data );
- break;
- case GL_INDEX_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_INDEX_ARRAY, 0, data );
- break;
- case GL_EDGE_FLAG_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_EDGE_FLAG_ARRAY, 0, data );
- break;
- case GL_COLOR_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_COLOR_ARRAY, 0, data );
- break;
- case GL_SECONDARY_COLOR_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_SECONDARY_COLOR_ARRAY, 0, data );
- break;
- case GL_FOG_COORD_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_FOG_COORD_ARRAY, 0, data );
- break;
-
- case GL_TEXTURE_COORD_ARRAY:
- retval = __glXGetArrayEnable( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
- break;
- case GL_TEXTURE_COORD_ARRAY_SIZE:
- retval = __glXGetArraySize( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
- break;
- case GL_TEXTURE_COORD_ARRAY_TYPE:
- retval = __glXGetArrayType( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
- break;
- case GL_TEXTURE_COORD_ARRAY_STRIDE:
- retval = __glXGetArrayStride( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
- break;
-
- case GL_MAX_ELEMENTS_VERTICES:
- case GL_MAX_ELEMENTS_INDICES:
- retval = GL_TRUE;
- *data = ~0UL;
- break;
-
-
- case GL_PACK_ROW_LENGTH:
- *data = (GLintptr)state->storePack.rowLength;
- break;
- case GL_PACK_IMAGE_HEIGHT:
- *data = (GLintptr)state->storePack.imageHeight;
- break;
- case GL_PACK_SKIP_ROWS:
- *data = (GLintptr)state->storePack.skipRows;
- break;
- case GL_PACK_SKIP_PIXELS:
- *data = (GLintptr)state->storePack.skipPixels;
- break;
- case GL_PACK_SKIP_IMAGES:
- *data = (GLintptr)state->storePack.skipImages;
- break;
- case GL_PACK_ALIGNMENT:
- *data = (GLintptr)state->storePack.alignment;
- break;
- case GL_PACK_SWAP_BYTES:
- *data = (GLintptr)state->storePack.swapEndian;
- break;
- case GL_PACK_LSB_FIRST:
- *data = (GLintptr)state->storePack.lsbFirst;
- break;
- case GL_UNPACK_ROW_LENGTH:
- *data = (GLintptr)state->storeUnpack.rowLength;
- break;
- case GL_UNPACK_IMAGE_HEIGHT:
- *data = (GLintptr)state->storeUnpack.imageHeight;
- break;
- case GL_UNPACK_SKIP_ROWS:
- *data = (GLintptr)state->storeUnpack.skipRows;
- break;
- case GL_UNPACK_SKIP_PIXELS:
- *data = (GLintptr)state->storeUnpack.skipPixels;
- break;
- case GL_UNPACK_SKIP_IMAGES:
- *data = (GLintptr)state->storeUnpack.skipImages;
- break;
- case GL_UNPACK_ALIGNMENT:
- *data = (GLintptr)state->storeUnpack.alignment;
- break;
- case GL_UNPACK_SWAP_BYTES:
- *data = (GLintptr)state->storeUnpack.swapEndian;
- break;
- case GL_UNPACK_LSB_FIRST:
- *data = (GLintptr)state->storeUnpack.lsbFirst;
- break;
- case GL_CLIENT_ATTRIB_STACK_DEPTH:
- *data = (GLintptr)(gc->attributes.stackPointer - gc->attributes.stack);
- break;
- case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
- *data = (GLintptr)__GL_CLIENT_ATTRIB_STACK_DEPTH;
- break;
- case GL_CLIENT_ACTIVE_TEXTURE:
- *data = (GLintptr)(tex_unit + GL_TEXTURE0);
- break;
-
- default:
- retval = GL_FALSE;
- break;
- }
-
-
- return retval;
+ GLboolean retval = GL_TRUE;
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ const GLint tex_unit = __glXGetActiveTextureUnit(state);
+
+
+ switch (cap) {
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_SECONDARY_COLOR_ARRAY:
+ case GL_FOG_COORD_ARRAY:
+ retval = __glXGetArrayEnable(state, cap, 0, data);
+ break;
+
+ case GL_VERTEX_ARRAY_SIZE:
+ retval = __glXGetArraySize(state, GL_VERTEX_ARRAY, 0, data);
+ break;
+ case GL_COLOR_ARRAY_SIZE:
+ retval = __glXGetArraySize(state, GL_COLOR_ARRAY, 0, data);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE:
+ retval = __glXGetArraySize(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
+ break;
+
+ case GL_VERTEX_ARRAY_TYPE:
+ retval = __glXGetArrayType(state, GL_VERTEX_ARRAY, 0, data);
+ break;
+ case GL_NORMAL_ARRAY_TYPE:
+ retval = __glXGetArrayType(state, GL_NORMAL_ARRAY, 0, data);
+ break;
+ case GL_INDEX_ARRAY_TYPE:
+ retval = __glXGetArrayType(state, GL_INDEX_ARRAY, 0, data);
+ break;
+ case GL_COLOR_ARRAY_TYPE:
+ retval = __glXGetArrayType(state, GL_COLOR_ARRAY, 0, data);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE:
+ retval = __glXGetArrayType(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
+ break;
+ case GL_FOG_COORD_ARRAY_TYPE:
+ retval = __glXGetArrayType(state, GL_FOG_COORD_ARRAY, 0, data);
+ break;
+
+ case GL_VERTEX_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_VERTEX_ARRAY, 0, data);
+ break;
+ case GL_NORMAL_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_NORMAL_ARRAY, 0, data);
+ break;
+ case GL_INDEX_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_INDEX_ARRAY, 0, data);
+ break;
+ case GL_EDGE_FLAG_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_EDGE_FLAG_ARRAY, 0, data);
+ break;
+ case GL_COLOR_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_COLOR_ARRAY, 0, data);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_SECONDARY_COLOR_ARRAY, 0, data);
+ break;
+ case GL_FOG_COORD_ARRAY_STRIDE:
+ retval = __glXGetArrayStride(state, GL_FOG_COORD_ARRAY, 0, data);
+ break;
+
+ case GL_TEXTURE_COORD_ARRAY:
+ retval =
+ __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ retval =
+ __glXGetArraySize(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ retval =
+ __glXGetArrayType(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ retval =
+ __glXGetArrayStride(state, GL_TEXTURE_COORD_ARRAY, tex_unit, data);
+ break;
+
+ case GL_MAX_ELEMENTS_VERTICES:
+ case GL_MAX_ELEMENTS_INDICES:
+ retval = GL_TRUE;
+ *data = ~0UL;
+ break;
+
+
+ case GL_PACK_ROW_LENGTH:
+ *data = (GLintptr) state->storePack.rowLength;
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ *data = (GLintptr) state->storePack.imageHeight;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *data = (GLintptr) state->storePack.skipRows;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *data = (GLintptr) state->storePack.skipPixels;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ *data = (GLintptr) state->storePack.skipImages;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *data = (GLintptr) state->storePack.alignment;
+ break;
+ case GL_PACK_SWAP_BYTES:
+ *data = (GLintptr) state->storePack.swapEndian;
+ break;
+ case GL_PACK_LSB_FIRST:
+ *data = (GLintptr) state->storePack.lsbFirst;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *data = (GLintptr) state->storeUnpack.rowLength;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ *data = (GLintptr) state->storeUnpack.imageHeight;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *data = (GLintptr) state->storeUnpack.skipRows;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *data = (GLintptr) state->storeUnpack.skipPixels;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ *data = (GLintptr) state->storeUnpack.skipImages;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *data = (GLintptr) state->storeUnpack.alignment;
+ break;
+ case GL_UNPACK_SWAP_BYTES:
+ *data = (GLintptr) state->storeUnpack.swapEndian;
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ *data = (GLintptr) state->storeUnpack.lsbFirst;
+ break;
+ case GL_CLIENT_ATTRIB_STACK_DEPTH:
+ *data = (GLintptr) (gc->attributes.stackPointer - gc->attributes.stack);
+ break;
+ case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+ *data = (GLintptr) __GL_CLIENT_ATTRIB_STACK_DEPTH;
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE:
+ *data = (GLintptr) (tex_unit + GL_TEXTURE0);
+ break;
+
+ default:
+ retval = GL_FALSE;
+ break;
+ }
+
+
+ return retval;
}
-void __indirect_glGetBooleanv(GLenum val, GLboolean *b)
+void
+__indirect_glGetBooleanv(GLenum val, GLboolean * b)
{
- const GLenum origVal = val;
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXSingleReply reply;
-
- val = RemapTransposeEnum( val );
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_GetBooleanv,4);
- __GLX_SINGLE_PUT_LONG(0,val);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_GET_SIZE(compsize);
-
- if (compsize == 0) {
- /*
- ** Error occured; don't modify user's buffer.
- */
- } else {
- GLintptr data;
-
- /*
- ** We still needed to send the request to the server in order to
- ** find out whether it was legal to make a query (it's illegal,
- ** for example, to call a query between glBegin() and glEnd()).
- */
-
- if ( get_client_data( gc, val, & data ) ) {
- *b = (GLboolean) data;
- }
- else {
- /*
- ** Not a local value, so use what we got from the server.
- */
- if (compsize == 1) {
- __GLX_SINGLE_GET_CHAR(b);
- } else {
- __GLX_SINGLE_GET_CHAR_ARRAY(b,compsize);
- if (val != origVal) {
- /* matrix transpose */
- TransposeMatrixb(b);
- }
- }
- }
- }
- __GLX_SINGLE_END();
+ const GLenum origVal = val;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ xGLXSingleReply reply;
+
+ val = RemapTransposeEnum(val);
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_GetBooleanv, 4);
+ __GLX_SINGLE_PUT_LONG(0, val);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_GET_SIZE(compsize);
+
+ if (compsize == 0) {
+ /*
+ ** Error occured; don't modify user's buffer.
+ */
+ }
+ else {
+ GLintptr data;
+
+ /*
+ ** We still needed to send the request to the server in order to
+ ** find out whether it was legal to make a query (it's illegal,
+ ** for example, to call a query between glBegin() and glEnd()).
+ */
+
+ if (get_client_data(gc, val, &data)) {
+ *b = (GLboolean) data;
+ }
+ else {
+ /*
+ ** Not a local value, so use what we got from the server.
+ */
+ if (compsize == 1) {
+ __GLX_SINGLE_GET_CHAR(b);
+ }
+ else {
+ __GLX_SINGLE_GET_CHAR_ARRAY(b, compsize);
+ if (val != origVal) {
+ /* matrix transpose */
+ TransposeMatrixb(b);
+ }
+ }
+ }
+ }
+ __GLX_SINGLE_END();
}
-void __indirect_glGetDoublev(GLenum val, GLdouble *d)
+void
+__indirect_glGetDoublev(GLenum val, GLdouble * d)
{
- const GLenum origVal = val;
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXSingleReply reply;
-
- val = RemapTransposeEnum( val );
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_GetDoublev,4);
- __GLX_SINGLE_PUT_LONG(0,val);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_GET_SIZE(compsize);
-
- if (compsize == 0) {
- /*
- ** Error occured; don't modify user's buffer.
- */
- } else {
- GLintptr data;
-
- /*
- ** We still needed to send the request to the server in order to
- ** find out whether it was legal to make a query (it's illegal,
- ** for example, to call a query between glBegin() and glEnd()).
- */
-
- if ( get_client_data( gc, val, & data ) ) {
- *d = (GLdouble) data;
- }
- else {
- /*
- ** Not a local value, so use what we got from the server.
- */
- if (compsize == 1) {
- __GLX_SINGLE_GET_DOUBLE(d);
- } else {
- __GLX_SINGLE_GET_DOUBLE_ARRAY(d,compsize);
- if (val != origVal) {
- /* matrix transpose */
- TransposeMatrixd(d);
- }
- }
- }
- }
- __GLX_SINGLE_END();
+ const GLenum origVal = val;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ xGLXSingleReply reply;
+
+ val = RemapTransposeEnum(val);
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_GetDoublev, 4);
+ __GLX_SINGLE_PUT_LONG(0, val);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_GET_SIZE(compsize);
+
+ if (compsize == 0) {
+ /*
+ ** Error occured; don't modify user's buffer.
+ */
+ }
+ else {
+ GLintptr data;
+
+ /*
+ ** We still needed to send the request to the server in order to
+ ** find out whether it was legal to make a query (it's illegal,
+ ** for example, to call a query between glBegin() and glEnd()).
+ */
+
+ if (get_client_data(gc, val, &data)) {
+ *d = (GLdouble) data;
+ }
+ else {
+ /*
+ ** Not a local value, so use what we got from the server.
+ */
+ if (compsize == 1) {
+ __GLX_SINGLE_GET_DOUBLE(d);
+ }
+ else {
+ __GLX_SINGLE_GET_DOUBLE_ARRAY(d, compsize);
+ if (val != origVal) {
+ /* matrix transpose */
+ TransposeMatrixd(d);
+ }
+ }
+ }
+ }
+ __GLX_SINGLE_END();
}
-void __indirect_glGetFloatv(GLenum val, GLfloat *f)
+void
+__indirect_glGetFloatv(GLenum val, GLfloat * f)
{
- const GLenum origVal = val;
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXSingleReply reply;
-
- val = RemapTransposeEnum( val );
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_GetFloatv,4);
- __GLX_SINGLE_PUT_LONG(0,val);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_GET_SIZE(compsize);
-
- if (compsize == 0) {
- /*
- ** Error occured; don't modify user's buffer.
- */
- } else {
- GLintptr data;
-
- /*
- ** We still needed to send the request to the server in order to
- ** find out whether it was legal to make a query (it's illegal,
- ** for example, to call a query between glBegin() and glEnd()).
- */
-
- if ( get_client_data( gc, val, & data ) ) {
- *f = (GLfloat) data;
- }
- else {
- /*
- ** Not a local value, so use what we got from the server.
- */
- if (compsize == 1) {
- __GLX_SINGLE_GET_FLOAT(f);
- } else {
- __GLX_SINGLE_GET_FLOAT_ARRAY(f,compsize);
- if (val != origVal) {
- /* matrix transpose */
- TransposeMatrixf(f);
- }
- }
- }
- }
- __GLX_SINGLE_END();
+ const GLenum origVal = val;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ xGLXSingleReply reply;
+
+ val = RemapTransposeEnum(val);
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_GetFloatv, 4);
+ __GLX_SINGLE_PUT_LONG(0, val);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_GET_SIZE(compsize);
+
+ if (compsize == 0) {
+ /*
+ ** Error occured; don't modify user's buffer.
+ */
+ }
+ else {
+ GLintptr data;
+
+ /*
+ ** We still needed to send the request to the server in order to
+ ** find out whether it was legal to make a query (it's illegal,
+ ** for example, to call a query between glBegin() and glEnd()).
+ */
+
+ if (get_client_data(gc, val, &data)) {
+ *f = (GLfloat) data;
+ }
+ else {
+ /*
+ ** Not a local value, so use what we got from the server.
+ */
+ if (compsize == 1) {
+ __GLX_SINGLE_GET_FLOAT(f);
+ }
+ else {
+ __GLX_SINGLE_GET_FLOAT_ARRAY(f, compsize);
+ if (val != origVal) {
+ /* matrix transpose */
+ TransposeMatrixf(f);
+ }
+ }
+ }
+ }
+ __GLX_SINGLE_END();
}
-void __indirect_glGetIntegerv(GLenum val, GLint *i)
+void
+__indirect_glGetIntegerv(GLenum val, GLint * i)
{
- const GLenum origVal = val;
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXSingleReply reply;
-
- val = RemapTransposeEnum( val );
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv,4);
- __GLX_SINGLE_PUT_LONG(0,val);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_GET_SIZE(compsize);
-
- if (compsize == 0) {
- /*
- ** Error occured; don't modify user's buffer.
- */
- } else {
- GLintptr data;
-
- /*
- ** We still needed to send the request to the server in order to
- ** find out whether it was legal to make a query (it's illegal,
- ** for example, to call a query between glBegin() and glEnd()).
- */
-
- if ( get_client_data( gc, val, & data ) ) {
- *i = (GLint) data;
- }
- else {
- /*
- ** Not a local value, so use what we got from the server.
- */
- if (compsize == 1) {
- __GLX_SINGLE_GET_LONG(i);
- } else {
- __GLX_SINGLE_GET_LONG_ARRAY(i,compsize);
- if (val != origVal) {
- /* matrix transpose */
- TransposeMatrixi(i);
- }
- }
- }
- }
- __GLX_SINGLE_END();
+ const GLenum origVal = val;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ xGLXSingleReply reply;
+
+ val = RemapTransposeEnum(val);
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv, 4);
+ __GLX_SINGLE_PUT_LONG(0, val);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_GET_SIZE(compsize);
+
+ if (compsize == 0) {
+ /*
+ ** Error occured; don't modify user's buffer.
+ */
+ }
+ else {
+ GLintptr data;
+
+ /*
+ ** We still needed to send the request to the server in order to
+ ** find out whether it was legal to make a query (it's illegal,
+ ** for example, to call a query between glBegin() and glEnd()).
+ */
+
+ if (get_client_data(gc, val, &data)) {
+ *i = (GLint) data;
+ }
+ else {
+ /*
+ ** Not a local value, so use what we got from the server.
+ */
+ if (compsize == 1) {
+ __GLX_SINGLE_GET_LONG(i);
+ }
+ else {
+ __GLX_SINGLE_GET_LONG_ARRAY(i, compsize);
+ if (val != origVal) {
+ /* matrix transpose */
+ TransposeMatrixi(i);
+ }
+ }
+ }
+ }
+ __GLX_SINGLE_END();
}
/*
** Send all pending commands to server.
*/
-void __indirect_glFlush(void)
+void
+__indirect_glFlush(void)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
+ __GLX_SINGLE_DECLARE_VARIABLES();
- if (!dpy) return;
+ if (!dpy)
+ return;
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_Flush,0);
- __GLX_SINGLE_END();
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_Flush, 0);
+ __GLX_SINGLE_END();
- /* And finally flush the X protocol data */
- XFlush(dpy);
+ /* And finally flush the X protocol data */
+ XFlush(dpy);
}
-void __indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
+void
+__indirect_glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
+ __GLX_SINGLE_DECLARE_VARIABLES();
- if (!dpy) return;
+ if (!dpy)
+ return;
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_FeedbackBuffer,8);
- __GLX_SINGLE_PUT_LONG(0,size);
- __GLX_SINGLE_PUT_LONG(4,type);
- __GLX_SINGLE_END();
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_FeedbackBuffer, 8);
+ __GLX_SINGLE_PUT_LONG(0, size);
+ __GLX_SINGLE_PUT_LONG(4, type);
+ __GLX_SINGLE_END();
- gc->feedbackBuf = buffer;
+ gc->feedbackBuf = buffer;
}
-void __indirect_glSelectBuffer(GLsizei numnames, GLuint *buffer)
+void
+__indirect_glSelectBuffer(GLsizei numnames, GLuint * buffer)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
+ __GLX_SINGLE_DECLARE_VARIABLES();
- if (!dpy) return;
+ if (!dpy)
+ return;
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_SelectBuffer,4);
- __GLX_SINGLE_PUT_LONG(0,numnames);
- __GLX_SINGLE_END();
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_SelectBuffer, 4);
+ __GLX_SINGLE_PUT_LONG(0, numnames);
+ __GLX_SINGLE_END();
- gc->selectBuf = buffer;
+ gc->selectBuf = buffer;
}
-GLint __indirect_glRenderMode(GLenum mode)
+GLint
+__indirect_glRenderMode(GLenum mode)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
- GLint retval = 0;
- xGLXRenderModeReply reply;
-
- if (!dpy) return -1;
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_RenderMode,4);
- __GLX_SINGLE_PUT_LONG(0,mode);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_GET_RETVAL(retval,GLint);
-
- if (reply.newMode != mode) {
- /*
- ** Switch to new mode did not take effect, therefore an error
- ** occured. When an error happens the server won't send us any
- ** other data.
- */
- } else {
- /* Read the feedback or selection data */
- if (gc->renderMode == GL_FEEDBACK) {
- __GLX_SINGLE_GET_SIZE(compsize);
- __GLX_SINGLE_GET_FLOAT_ARRAY(gc->feedbackBuf, compsize);
- } else
- if (gc->renderMode == GL_SELECT) {
- __GLX_SINGLE_GET_SIZE(compsize);
- __GLX_SINGLE_GET_LONG_ARRAY(gc->selectBuf, compsize);
- }
- gc->renderMode = mode;
- }
- __GLX_SINGLE_END();
-
- return retval;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ GLint retval = 0;
+ xGLXRenderModeReply reply;
+
+ if (!dpy)
+ return -1;
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_RenderMode, 4);
+ __GLX_SINGLE_PUT_LONG(0, mode);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_GET_RETVAL(retval, GLint);
+
+ if (reply.newMode != mode) {
+ /*
+ ** Switch to new mode did not take effect, therefore an error
+ ** occured. When an error happens the server won't send us any
+ ** other data.
+ */
+ }
+ else {
+ /* Read the feedback or selection data */
+ if (gc->renderMode == GL_FEEDBACK) {
+ __GLX_SINGLE_GET_SIZE(compsize);
+ __GLX_SINGLE_GET_FLOAT_ARRAY(gc->feedbackBuf, compsize);
+ }
+ else if (gc->renderMode == GL_SELECT) {
+ __GLX_SINGLE_GET_SIZE(compsize);
+ __GLX_SINGLE_GET_LONG_ARRAY(gc->selectBuf, compsize);
+ }
+ gc->renderMode = mode;
+ }
+ __GLX_SINGLE_END();
+
+ return retval;
}
-void __indirect_glFinish(void)
+void
+__indirect_glFinish(void)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXSingleReply reply;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ xGLXSingleReply reply;
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_Finish,0);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_END();
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_Finish, 0);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_END();
}
@@ -587,241 +619,247 @@ void __indirect_glFinish(void)
* Extract the major and minor version numbers from a version string.
*/
static void
-version_from_string( const char * ver,
- int * major_version, int * minor_version )
+version_from_string(const char *ver, int *major_version, int *minor_version)
{
- const char * end;
- long major;
- long minor;
-
- major = strtol( ver, (char **) & end, 10 );
- minor = strtol( end + 1, NULL, 10 );
- *major_version = major;
- *minor_version = minor;
+ const char *end;
+ long major;
+ long minor;
+
+ major = strtol(ver, (char **) &end, 10);
+ minor = strtol(end + 1, NULL, 10);
+ *major_version = major;
+ *minor_version = minor;
}
-const GLubyte *__indirect_glGetString(GLenum name)
+const GLubyte *
+__indirect_glGetString(GLenum name)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- Display *dpy = gc->currentDpy;
- GLubyte *s = NULL;
+ __GLXcontext *gc = __glXGetCurrentContext();
+ Display *dpy = gc->currentDpy;
+ GLubyte *s = NULL;
- if (!dpy) return 0;
+ if (!dpy)
+ return 0;
- /*
+ /*
** Return the cached copy if the string has already been fetched
*/
- switch(name) {
- case GL_VENDOR:
- if (gc->vendor) return gc->vendor;
- break;
- case GL_RENDERER:
- if (gc->renderer) return gc->renderer;
- break;
- case GL_VERSION:
- if (gc->version) return gc->version;
- break;
- case GL_EXTENSIONS:
- if (gc->extensions) return gc->extensions;
- break;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return 0;
- }
-
- /*
+ switch (name) {
+ case GL_VENDOR:
+ if (gc->vendor)
+ return gc->vendor;
+ break;
+ case GL_RENDERER:
+ if (gc->renderer)
+ return gc->renderer;
+ break;
+ case GL_VERSION:
+ if (gc->version)
+ return gc->version;
+ break;
+ case GL_EXTENSIONS:
+ if (gc->extensions)
+ return gc->extensions;
+ break;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return 0;
+ }
+
+ /*
** Get requested string from server
*/
- (void) __glXFlushRenderBuffer( gc, gc->pc );
- s = (GLubyte *) __glXGetStringFromServer( dpy, gc->majorOpcode,
- X_GLsop_GetString, gc->currentContextTag,
- name );
- if (!s) {
- /* Throw data on the floor */
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- /*
- ** Update local cache
- */
- switch(name) {
- case GL_VENDOR:
- gc->vendor = s;
- break;
-
- case GL_RENDERER:
- gc->renderer = s;
- break;
-
- case GL_VERSION: {
- int client_major;
- int client_minor;
-
- version_from_string( (char *) s,
- & gc->server_major, & gc->server_minor );
- __glXGetGLVersion( & client_major, & client_minor );
-
- if ( (gc->server_major < client_major)
- || ((gc->server_major == client_major)
- && (gc->server_minor <= client_minor)) ) {
- gc->version = s;
- }
- else {
- /* Allow 7 bytes for the client-side GL version. This allows
- * for upto version 999.999. I'm not holding my breath for
- * that one! The extra 4 is for the ' ()\0' that will be
- * added.
- */
- const size_t size = 7 + strlen( (char *) s ) + 4;
-
- gc->version = Xmalloc( size );
- if ( gc->version == NULL ) {
- /* If we couldn't allocate memory for the new string,
- * make a best-effort and just copy the client-side version
- * to the string and use that. It probably doesn't
- * matter what is done here. If there not memory available
- * for a short string, the system is probably going to die
- * soon anyway.
- */
- snprintf( (char *) s, strlen( (char *) s ) + 1, "%u.%u",
- client_major, client_minor );
- gc->version = s;
- }
- else {
- snprintf( (char *)gc->version, size, "%u.%u (%s)",
- client_major, client_minor, s );
- Xfree( s );
- s = gc->version;
- }
- }
- break;
- }
-
- case GL_EXTENSIONS: {
- int major = 1;
- int minor = 0;
-
- /* This code is currently disabled. I was reminded that some
- * vendors intentionally exclude some extensions from their
- * extension string that are part of the core version they
- * advertise. In particular, on Nvidia drivers this means that
- * the functionality is supported by the driver, but is not
- * hardware accelerated. For example, a TNT will show core
- * version 1.5, but most of the post-1.2 functionality is a
- * software fallback.
- *
- * I don't want to break applications that rely on this odd
- * behavior. At the same time, the code is written and tested,
- * so I didn't want to throw it away. Therefore, the code is here
- * but disabled. In the future, we may wish to and an environment
- * variable to enable it.
- */
-
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ s = (GLubyte *) __glXGetStringFromServer(dpy, gc->majorOpcode,
+ X_GLsop_GetString,
+ gc->currentContextTag, name);
+ if (!s) {
+ /* Throw data on the floor */
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ }
+ else {
+ /*
+ ** Update local cache
+ */
+ switch (name) {
+ case GL_VENDOR:
+ gc->vendor = s;
+ break;
+
+ case GL_RENDERER:
+ gc->renderer = s;
+ break;
+
+ case GL_VERSION:{
+ int client_major;
+ int client_minor;
+
+ version_from_string((char *) s,
+ &gc->server_major, &gc->server_minor);
+ __glXGetGLVersion(&client_major, &client_minor);
+
+ if ((gc->server_major < client_major)
+ || ((gc->server_major == client_major)
+ && (gc->server_minor <= client_minor))) {
+ gc->version = s;
+ }
+ else {
+ /* Allow 7 bytes for the client-side GL version. This allows
+ * for upto version 999.999. I'm not holding my breath for
+ * that one! The extra 4 is for the ' ()\0' that will be
+ * added.
+ */
+ const size_t size = 7 + strlen((char *) s) + 4;
+
+ gc->version = Xmalloc(size);
+ if (gc->version == NULL) {
+ /* If we couldn't allocate memory for the new string,
+ * make a best-effort and just copy the client-side version
+ * to the string and use that. It probably doesn't
+ * matter what is done here. If there not memory available
+ * for a short string, the system is probably going to die
+ * soon anyway.
+ */
+ snprintf((char *) s, strlen((char *) s) + 1, "%u.%u",
+ client_major, client_minor);
+ gc->version = s;
+ }
+ else {
+ snprintf((char *) gc->version, size, "%u.%u (%s)",
+ client_major, client_minor, s);
+ Xfree(s);
+ s = gc->version;
+ }
+ }
+ break;
+ }
+
+ case GL_EXTENSIONS:{
+ int major = 1;
+ int minor = 0;
+
+ /* This code is currently disabled. I was reminded that some
+ * vendors intentionally exclude some extensions from their
+ * extension string that are part of the core version they
+ * advertise. In particular, on Nvidia drivers this means that
+ * the functionality is supported by the driver, but is not
+ * hardware accelerated. For example, a TNT will show core
+ * version 1.5, but most of the post-1.2 functionality is a
+ * software fallback.
+ *
+ * I don't want to break applications that rely on this odd
+ * behavior. At the same time, the code is written and tested,
+ * so I didn't want to throw it away. Therefore, the code is here
+ * but disabled. In the future, we may wish to and an environment
+ * variable to enable it.
+ */
+
#if 0
- /* Call glGetString just to make sure that gc->server_major and
- * gc->server_minor are set. This version may be higher than we
- * can completely support, but it may imply support for some
- * extensions that we can support.
- *
- * For example, at the time of this writing, the client-side
- * library only supports upto core GL version 1.2. However, cubic
- * textures, multitexture, multisampling, and some other 1.3
- * features are supported. If the server reports back version
- * 1.3, but does not report all of those extensions, we will
- * enable them.
- */
- (void *) glGetString( GL_VERSION );
- major = gc->server_major,
- minor = gc->server_minor;
+ /* Call glGetString just to make sure that gc->server_major and
+ * gc->server_minor are set. This version may be higher than we
+ * can completely support, but it may imply support for some
+ * extensions that we can support.
+ *
+ * For example, at the time of this writing, the client-side
+ * library only supports upto core GL version 1.2. However, cubic
+ * textures, multitexture, multisampling, and some other 1.3
+ * features are supported. If the server reports back version
+ * 1.3, but does not report all of those extensions, we will
+ * enable them.
+ */
+ (void *) glGetString(GL_VERSION);
+ major = gc->server_major, minor = gc->server_minor;
#endif
- __glXCalculateUsableGLExtensions( gc, (char *) s, major, minor );
- XFree( s );
- s = gc->extensions;
- break;
- }
- }
- }
- return s;
+ __glXCalculateUsableGLExtensions(gc, (char *) s, major, minor);
+ XFree(s);
+ s = gc->extensions;
+ break;
+ }
+ }
+ }
+ return s;
}
-GLboolean __indirect_glIsEnabled(GLenum cap)
+GLboolean
+__indirect_glIsEnabled(GLenum cap)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- xGLXSingleReply reply;
- GLboolean retval = 0;
- GLintptr enable;
-
- if (!dpy) return 0;
-
- switch(cap) {
- case GL_VERTEX_ARRAY:
- case GL_NORMAL_ARRAY:
- case GL_COLOR_ARRAY:
- case GL_INDEX_ARRAY:
- case GL_EDGE_FLAG_ARRAY:
- case GL_SECONDARY_COLOR_ARRAY:
- case GL_FOG_COORD_ARRAY:
- retval = __glXGetArrayEnable( state, cap, 0, & enable );
- assert( retval );
- return (GLboolean) enable;
- break;
- case GL_TEXTURE_COORD_ARRAY:
- retval = __glXGetArrayEnable( state, GL_TEXTURE_COORD_ARRAY,
- __glXGetActiveTextureUnit( state ), & enable );
- assert( retval );
- return (GLboolean) enable;
- break;
- }
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_IsEnabled,4);
- __GLX_SINGLE_PUT_LONG(0,cap);
- __GLX_SINGLE_READ_XREPLY();
- __GLX_SINGLE_GET_RETVAL(retval, GLboolean);
- __GLX_SINGLE_END();
- return retval;
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ xGLXSingleReply reply;
+ GLboolean retval = 0;
+ GLintptr enable;
+
+ if (!dpy)
+ return 0;
+
+ switch (cap) {
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_INDEX_ARRAY:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_SECONDARY_COLOR_ARRAY:
+ case GL_FOG_COORD_ARRAY:
+ retval = __glXGetArrayEnable(state, cap, 0, &enable);
+ assert(retval);
+ return (GLboolean) enable;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ retval = __glXGetArrayEnable(state, GL_TEXTURE_COORD_ARRAY,
+ __glXGetActiveTextureUnit(state), &enable);
+ assert(retval);
+ return (GLboolean) enable;
+ break;
+ }
+
+ __GLX_SINGLE_LOAD_VARIABLES();
+ __GLX_SINGLE_BEGIN(X_GLsop_IsEnabled, 4);
+ __GLX_SINGLE_PUT_LONG(0, cap);
+ __GLX_SINGLE_READ_XREPLY();
+ __GLX_SINGLE_GET_RETVAL(retval, GLboolean);
+ __GLX_SINGLE_END();
+ return retval;
}
-void __indirect_glGetPointerv(GLenum pname, void **params)
+void
+__indirect_glGetPointerv(GLenum pname, void **params)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
- Display *dpy = gc->currentDpy;
-
- if (!dpy) return;
-
- switch(pname) {
- case GL_VERTEX_ARRAY_POINTER:
- case GL_NORMAL_ARRAY_POINTER:
- case GL_COLOR_ARRAY_POINTER:
- case GL_INDEX_ARRAY_POINTER:
- case GL_EDGE_FLAG_ARRAY_POINTER:
- __glXGetArrayPointer( state, pname - GL_VERTEX_ARRAY_POINTER
- + GL_VERTEX_ARRAY,
- 0, params );
- return;
- case GL_TEXTURE_COORD_ARRAY_POINTER:
- __glXGetArrayPointer( state, GL_TEXTURE_COORD_ARRAY,
- __glXGetActiveTextureUnit( state ), params );
- return;
- case GL_SECONDARY_COLOR_ARRAY_POINTER:
- case GL_FOG_COORD_ARRAY_POINTER:
- __glXGetArrayPointer( state, pname - GL_FOG_COORD_ARRAY_POINTER
- + GL_FOG_COORD_ARRAY,
- 0, params );
- return;
- case GL_FEEDBACK_BUFFER_POINTER:
- *params = (void *)gc->feedbackBuf;
- return;
- case GL_SELECTION_BUFFER_POINTER:
- *params = (void *)gc->selectBuf;
- return;
- default:
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
+ Display *dpy = gc->currentDpy;
+
+ if (!dpy)
+ return;
+
+ switch (pname) {
+ case GL_VERTEX_ARRAY_POINTER:
+ case GL_NORMAL_ARRAY_POINTER:
+ case GL_COLOR_ARRAY_POINTER:
+ case GL_INDEX_ARRAY_POINTER:
+ case GL_EDGE_FLAG_ARRAY_POINTER:
+ __glXGetArrayPointer(state, pname - GL_VERTEX_ARRAY_POINTER
+ + GL_VERTEX_ARRAY, 0, params);
+ return;
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
+ __glXGetArrayPointer(state, GL_TEXTURE_COORD_ARRAY,
+ __glXGetActiveTextureUnit(state), params);
+ return;
+ case GL_SECONDARY_COLOR_ARRAY_POINTER:
+ case GL_FOG_COORD_ARRAY_POINTER:
+ __glXGetArrayPointer(state, pname - GL_FOG_COORD_ARRAY_POINTER
+ + GL_FOG_COORD_ARRAY, 0, params);
+ return;
+ case GL_FEEDBACK_BUFFER_POINTER:
+ *params = (void *) gc->feedbackBuf;
+ return;
+ case GL_SELECTION_BUFFER_POINTER:
+ *params = (void *) gc->selectBuf;
+ return;
+ default:
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
}
-
diff --git a/src/glx/x11/singlepix.c b/src/glx/x11/singlepix.c
index a093931bd2..032696a540 100644
--- a/src/glx/x11/singlepix.c
+++ b/src/glx/x11/singlepix.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -36,153 +37,160 @@
#include "glapioffsets.h"
#include <GL/glxproto.h>
-void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
- GLvoid *row, GLvoid *column, GLvoid *span)
+void
+__indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
+ GLvoid * row, GLvoid * column, GLvoid * span)
{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXGetSeparableFilterReply reply;
- GLubyte *rowBuf, *colBuf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13));
- __GLX_SINGLE_PUT_LONG(0,target);
- __GLX_SINGLE_PUT_LONG(4,format);
- __GLX_SINGLE_PUT_LONG(8,type);
- __GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
- __GLX_SINGLE_READ_XREPLY();
- compsize = reply.length << 2;
-
- if (compsize != 0) {
- GLint width, height;
- GLint widthsize, heightsize;
-
- width = reply.width;
- height = reply.height;
-
- widthsize = __glImageSize(width,1,1,format, type, 0);
- heightsize = __glImageSize(height,1,1,format, type, 0);
-
- /* Allocate a holding buffer to transform the data from */
- rowBuf = (GLubyte*) Xmalloc(widthsize);
- if (!rowBuf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- UnlockDisplay(dpy);
- SyncHandle();
- return;
- } else {
- __GLX_SINGLE_GET_CHAR_ARRAY(((char*)rowBuf),widthsize);
- __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row);
- Xfree((char*) rowBuf);
- }
- colBuf = (GLubyte*) Xmalloc(heightsize);
- if (!colBuf) {
- /* Throw data away */
- _XEatData(dpy, compsize - __GLX_PAD(widthsize));
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- UnlockDisplay(dpy);
- SyncHandle();
- return;
- } else {
- __GLX_SINGLE_GET_CHAR_ARRAY(((char*)colBuf),heightsize);
- __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column);
- Xfree((char*) colBuf);
- }
- } else {
- /*
- ** don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-
+ __GLX_SINGLE_DECLARE_VARIABLES();
+ const __GLXattribute *state;
+ xGLXGetSeparableFilterReply reply;
+ GLubyte *rowBuf, *colBuf;
+
+ if (!dpy)
+ return;
+ __GLX_SINGLE_LOAD_VARIABLES();
+ state = gc->client_state_private;
+
+ /* Send request */
+ __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13));
+ __GLX_SINGLE_PUT_LONG(0, target);
+ __GLX_SINGLE_PUT_LONG(4, format);
+ __GLX_SINGLE_PUT_LONG(8, type);
+ __GLX_SINGLE_PUT_CHAR(12, state->storePack.swapEndian);
+ __GLX_SINGLE_READ_XREPLY();
+ compsize = reply.length << 2;
+
+ if (compsize != 0) {
+ GLint width, height;
+ GLint widthsize, heightsize;
+
+ width = reply.width;
+ height = reply.height;
+
+ widthsize = __glImageSize(width, 1, 1, format, type, 0);
+ heightsize = __glImageSize(height, 1, 1, format, type, 0);
+
+ /* Allocate a holding buffer to transform the data from */
+ rowBuf = (GLubyte *) Xmalloc(widthsize);
+ if (!rowBuf) {
+ /* Throw data away */
+ _XEatData(dpy, compsize);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return;
+ }
+ else {
+ __GLX_SINGLE_GET_CHAR_ARRAY(((char *) rowBuf), widthsize);
+ __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row);
+ Xfree((char *) rowBuf);
+ }
+ colBuf = (GLubyte *) Xmalloc(heightsize);
+ if (!colBuf) {
+ /* Throw data away */
+ _XEatData(dpy, compsize - __GLX_PAD(widthsize));
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return;
+ }
+ else {
+ __GLX_SINGLE_GET_CHAR_ARRAY(((char *) colBuf), heightsize);
+ __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column);
+ Xfree((char *) colBuf);
+ }
+ }
+ else {
+ /*
+ ** don't modify user's buffer.
+ */
+ }
+ __GLX_SINGLE_END();
+
}
#define CONCAT(a,b) a ## b
#define NAME(o) CONCAT(gl_dispatch_stub_, o)
-void NAME(_gloffset_GetSeparableFilter)(GLenum target, GLenum format, GLenum type,
- GLvoid *row, GLvoid *column, GLvoid *span)
+void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format,
+ GLenum type, GLvoid * row,
+ GLvoid * column, GLvoid * span)
{
- __GLXcontext * const gc = __glXGetCurrentContext();
+ __GLXcontext *const gc = __glXGetCurrentContext();
#ifdef GLX_DIRECT_RENDERING
- if (gc->driContext) {
- CALL_GetSeparableFilter(GET_DISPATCH(),
- (target, format, type, row, column, span));
- return;
- } else
+ if (gc->driContext) {
+ CALL_GetSeparableFilter(GET_DISPATCH(),
+ (target, format, type, row, column, span));
+ return;
+ }
+ else
#endif
- {
- Display *const dpy = gc->currentDpy;
- const GLuint cmdlen = __GLX_PAD(13);
-
- if (dpy != NULL) {
- const __GLXattribute * const state = gc->client_state_private;
- xGLXGetSeparableFilterReply reply;
- GLubyte const *pc =
- __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
- X_GLvop_GetSeparableFilterEXT, cmdlen);
- unsigned compsize;
-
-
- (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
- (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
- (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
- *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-
- (void) _XReply(dpy, (xReply *) & reply, 0, False);
-
- compsize = reply.length << 2;
-
- if (compsize != 0) {
- const GLint width = reply.width;
- const GLint height = reply.height;
- const GLint widthsize =
- __glImageSize(width, 1, 1, format, type, 0);
- const GLint heightsize =
- __glImageSize(height, 1, 1, format, type, 0);
- GLubyte * const buf =
- (GLubyte*) Xmalloc((widthsize > heightsize) ? widthsize : heightsize);
-
- if (buf == NULL) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return;
- } else {
- int extra;
-
- extra = 4 - (widthsize & 3);
- _XRead(dpy, (char *)buf, widthsize);
- if (extra < 4) {
- _XEatData(dpy, extra);
- }
-
- __glEmptyImage(gc, 1, width, 1, 1, format, type, buf,
- row);
-
- extra = 4 - (heightsize & 3);
- _XRead(dpy, (char *)buf, heightsize);
- if (extra < 4) {
- _XEatData(dpy, extra);
- }
-
- __glEmptyImage(gc, 1, height, 1, 1, format, type, buf,
- column);
-
- Xfree((char*) buf);
- }
- }
- }
- }
+ {
+ Display *const dpy = gc->currentDpy;
+ const GLuint cmdlen = __GLX_PAD(13);
+
+ if (dpy != NULL) {
+ const __GLXattribute *const state = gc->client_state_private;
+ xGLXGetSeparableFilterReply reply;
+ GLubyte const *pc =
+ __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+ X_GLvop_GetSeparableFilterEXT, cmdlen);
+ unsigned compsize;
+
+
+ (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+ (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+ (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+ *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+ compsize = reply.length << 2;
+
+ if (compsize != 0) {
+ const GLint width = reply.width;
+ const GLint height = reply.height;
+ const GLint widthsize =
+ __glImageSize(width, 1, 1, format, type, 0);
+ const GLint heightsize =
+ __glImageSize(height, 1, 1, format, type, 0);
+ GLubyte *const buf =
+ (GLubyte *) Xmalloc((widthsize > heightsize) ? widthsize :
+ heightsize);
+
+ if (buf == NULL) {
+ /* Throw data away */
+ _XEatData(dpy, compsize);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return;
+ }
+ else {
+ int extra;
+
+ extra = 4 - (widthsize & 3);
+ _XRead(dpy, (char *) buf, widthsize);
+ if (extra < 4) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, row);
+
+ extra = 4 - (heightsize & 3);
+ _XRead(dpy, (char *) buf, heightsize);
+ if (extra < 4) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 1, height, 1, 1, format, type, buf, column);
+
+ Xfree((char *) buf);
+ }
+ }
+ }
+ }
}
diff --git a/src/glx/x11/vertarr.c b/src/glx/x11/vertarr.c
index 031aa48427..23f6370261 100644
--- a/src/glx/x11/vertarr.c
+++ b/src/glx/x11/vertarr.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
@@ -45,153 +46,168 @@
* happen.
*/
/*@{*/
-void __indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid * pointer )
+void
+__indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid * pointer)
{
- (void) count; __indirect_glColorPointer( size, type, stride, pointer );
+ (void) count;
+ __indirect_glColorPointer(size, type, stride, pointer);
}
-void __indirect_glEdgeFlagPointerEXT(GLsizei stride,
- GLsizei count, const GLboolean * pointer )
+void
+__indirect_glEdgeFlagPointerEXT(GLsizei stride,
+ GLsizei count, const GLboolean * pointer)
{
- (void) count; __indirect_glEdgeFlagPointer( stride, pointer );
+ (void) count;
+ __indirect_glEdgeFlagPointer(stride, pointer);
}
-void __indirect_glIndexPointerEXT(GLenum type, GLsizei stride,
- GLsizei count, const GLvoid * pointer )
+void
+__indirect_glIndexPointerEXT(GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid * pointer)
{
- (void) count; __indirect_glIndexPointer( type, stride, pointer );
+ (void) count;
+ __indirect_glIndexPointer(type, stride, pointer);
}
-void __indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid * pointer )
+void
+__indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+ const GLvoid * pointer)
{
- (void) count; __indirect_glNormalPointer( type, stride, pointer );
+ (void) count;
+ __indirect_glNormalPointer(type, stride, pointer);
}
-void __indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid * pointer )
+void
+__indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid * pointer)
{
- (void) count; __indirect_glTexCoordPointer( size, type, stride, pointer );
+ (void) count;
+ __indirect_glTexCoordPointer(size, type, stride, pointer);
}
-void __indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid * pointer )
+void
+__indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+ GLsizei count, const GLvoid * pointer)
{
- (void) count; __indirect_glVertexPointer( size, type, stride, pointer );
+ (void) count;
+ __indirect_glVertexPointer(size, type, stride, pointer);
}
+
/*@}*/
/*****************************************************************************/
-void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
+void
+__indirect_glInterleavedArrays(GLenum format, GLsizei stride,
+ const GLvoid * pointer)
{
- __GLXcontext *gc = __glXGetCurrentContext();
- __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
+ __GLXcontext *gc = __glXGetCurrentContext();
+ __GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
#define NONE {0, 0, 0}
#define F(x) {GL_FLOAT, x, x * sizeof(GLfloat)}
#define UB4 {GL_UNSIGNED_BYTE, 4, 4 * sizeof(GLubyte)}
- /* Each row in this array describes the elements of a particular
- * interleaved array mode. Each column describes, in the order in which
- * they appear in the interleaved arrays, one of the four possible types
- * of vertex data that can appear in an interleaved array.
- */
- struct {
+ /* Each row in this array describes the elements of a particular
+ * interleaved array mode. Each column describes, in the order in which
+ * they appear in the interleaved arrays, one of the four possible types
+ * of vertex data that can appear in an interleaved array.
+ */
+ struct
+ {
/**
* The enum describing the GL type, as would be passed to the
* appropriate gl*Pointer function.
*/
- GLushort type;
+ GLushort type;
/**
* Number of elements in the subarray, as would be passed (as the
* \c size parameter) to the appropriate gl*Pointer function.
*/
- GLubyte count;
-
+ GLubyte count;
+
/**
* True size of a single element in the subarray, as would be passed
* (as the \c stride parameter) to the appropriate gl*Pointer
* function.
*/
- GLubyte size;
- }
- static const modes[14][4] = {
+ GLubyte size;
+ }
+ static const modes[14][4] = {
/* texture color normal vertex */
- {NONE, NONE, NONE, F(2)}, /* GL_V2F */
- {NONE, NONE, NONE, F(3)}, /* GL_V3F */
- {NONE, UB4, NONE, F(2)}, /* GL_C4UB_V2F */
- {NONE, UB4, NONE, F(3)}, /* GL_C4UB_V3F */
- {NONE, F(3), NONE, F(3)}, /* GL_C3F_V3F */
- {NONE, NONE, F(3), F(3)}, /* GL_N3F_V3F */
- {NONE, F(4), F(3), F(3)}, /* GL_C4F_N3F_V3F */
- {F(2), NONE, NONE, F(3)}, /* GL_T2F_V3F */
- {F(4), NONE, NONE, F(4)}, /* GL_T4F_V4F */
- {F(2), UB4, NONE, F(3)}, /* GL_T2F_C4UB_V3F */
- {F(2), F(3), NONE, F(3)}, /* GL_T2F_C3F_V3F */
- {F(2), NONE, F(3), F(3)}, /* GL_T2F_N3F_V3F */
- {F(2), F(4), F(3), F(3)}, /* GL_T2F_C4F_N3F_V3F */
- {F(4), F(4), F(3), F(4)}, /* GL_T4F_C4F_N3F_V4F */
- };
+ {NONE, NONE, NONE, F(2)}, /* GL_V2F */
+ {NONE, NONE, NONE, F(3)}, /* GL_V3F */
+ {NONE, UB4, NONE, F(2)}, /* GL_C4UB_V2F */
+ {NONE, UB4, NONE, F(3)}, /* GL_C4UB_V3F */
+ {NONE, F(3), NONE, F(3)}, /* GL_C3F_V3F */
+ {NONE, NONE, F(3), F(3)}, /* GL_N3F_V3F */
+ {NONE, F(4), F(3), F(3)}, /* GL_C4F_N3F_V3F */
+ {F(2), NONE, NONE, F(3)}, /* GL_T2F_V3F */
+ {F(4), NONE, NONE, F(4)}, /* GL_T4F_V4F */
+ {F(2), UB4, NONE, F(3)}, /* GL_T2F_C4UB_V3F */
+ {F(2), F(3), NONE, F(3)}, /* GL_T2F_C3F_V3F */
+ {F(2), NONE, F(3), F(3)}, /* GL_T2F_N3F_V3F */
+ {F(2), F(4), F(3), F(3)}, /* GL_T2F_C4F_N3F_V3F */
+ {F(4), F(4), F(3), F(4)}, /* GL_T4F_C4F_N3F_V4F */
+ };
#undef NONE
#undef F
#undef UB4
- GLint trueStride, size;
- int offsets[4];
- unsigned i;
- const int idx = format - GL_V2F;
-
-
- /* All valid formats are on the range [GL_V2F, GL_V2F+0x0D]. Since idx
- * is just the format biased by -GL_V2F, all valid idx values are on the
- * range [0, 0x0D].
- */
- if ( (idx < 0) || (idx > 0x0D) ) {
- __glXSetError(gc, GL_INVALID_ENUM);
- return;
- }
-
- if ( stride < 0 ) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
-
-
- /* If the 'count' for a subarray is non-zero, then the offset of its
- * first element is at the currently accumulated 'size'.
- */
- size = 0;
- for ( i = 0 ; i < 4 ; i++ ) {
- offsets[i] = (modes[idx][i].count != 0) ? size : -1;
- size += modes[idx][i].size;
- }
-
- trueStride = (stride == 0) ? size : stride;
-
- __glXArrayDisableAll( state );
-
- if ( offsets[0] >= 0 ) {
- __indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- __indirect_glTexCoordPointer( modes[idx][0].count, GL_FLOAT,
- trueStride,
- (const char *) pointer );
- }
- if ( offsets[1] >= 0 ) {
- __indirect_glEnableClientState(GL_COLOR_ARRAY);
- __indirect_glColorPointer( modes[idx][1].count, modes[idx][1].type,
- trueStride,
- (const char *) pointer + offsets[1] );
- }
- if ( offsets[2] >= 0 ) {
- __indirect_glEnableClientState(GL_NORMAL_ARRAY);
- __indirect_glNormalPointer( GL_FLOAT, trueStride,
- (const char *)pointer + offsets[2] );
- }
- __indirect_glEnableClientState(GL_VERTEX_ARRAY);
- __indirect_glVertexPointer( modes[idx][3].count, GL_FLOAT,
- trueStride,
- (const char *)pointer + offsets[3] );
+ GLint trueStride, size;
+ int offsets[4];
+ unsigned i;
+ const int idx = format - GL_V2F;
+
+
+ /* All valid formats are on the range [GL_V2F, GL_V2F+0x0D]. Since idx
+ * is just the format biased by -GL_V2F, all valid idx values are on the
+ * range [0, 0x0D].
+ */
+ if ((idx < 0) || (idx > 0x0D)) {
+ __glXSetError(gc, GL_INVALID_ENUM);
+ return;
+ }
+
+ if (stride < 0) {
+ __glXSetError(gc, GL_INVALID_VALUE);
+ return;
+ }
+
+
+ /* If the 'count' for a subarray is non-zero, then the offset of its
+ * first element is at the currently accumulated 'size'.
+ */
+ size = 0;
+ for (i = 0; i < 4; i++) {
+ offsets[i] = (modes[idx][i].count != 0) ? size : -1;
+ size += modes[idx][i].size;
+ }
+
+ trueStride = (stride == 0) ? size : stride;
+
+ __glXArrayDisableAll(state);
+
+ if (offsets[0] >= 0) {
+ __indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ __indirect_glTexCoordPointer(modes[idx][0].count, GL_FLOAT,
+ trueStride, (const char *) pointer);
+ }
+ if (offsets[1] >= 0) {
+ __indirect_glEnableClientState(GL_COLOR_ARRAY);
+ __indirect_glColorPointer(modes[idx][1].count, modes[idx][1].type,
+ trueStride,
+ (const char *) pointer + offsets[1]);
+ }
+ if (offsets[2] >= 0) {
+ __indirect_glEnableClientState(GL_NORMAL_ARRAY);
+ __indirect_glNormalPointer(GL_FLOAT, trueStride,
+ (const char *) pointer + offsets[2]);
+ }
+ __indirect_glEnableClientState(GL_VERTEX_ARRAY);
+ __indirect_glVertexPointer(modes[idx][3].count, GL_FLOAT,
+ trueStride,
+ (const char *) pointer + offsets[3]);
}
diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h
index 2aec3211db..30e2c9e534 100644
--- a/src/glx/x11/xf86dri.h
+++ b/src/glx/x11/xf86dri.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -41,79 +42,80 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
-#define X_XF86DRIQueryVersion 0
-#define X_XF86DRIQueryDirectRenderingCapable 1
-#define X_XF86DRIOpenConnection 2
-#define X_XF86DRICloseConnection 3
-#define X_XF86DRIGetClientDriverName 4
-#define X_XF86DRICreateContext 5
-#define X_XF86DRIDestroyContext 6
-#define X_XF86DRICreateDrawable 7
-#define X_XF86DRIDestroyDrawable 8
-#define X_XF86DRIGetDrawableInfo 9
-#define X_XF86DRIGetDeviceInfo 10
+#define X_XF86DRIQueryVersion 0
+#define X_XF86DRIQueryDirectRenderingCapable 1
+#define X_XF86DRIOpenConnection 2
+#define X_XF86DRICloseConnection 3
+#define X_XF86DRIGetClientDriverName 4
+#define X_XF86DRICreateContext 5
+#define X_XF86DRIDestroyContext 6
+#define X_XF86DRICreateDrawable 7
+#define X_XF86DRIDestroyDrawable 8
+#define X_XF86DRIGetDrawableInfo 9
+#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
-#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
-#define X_XF86DRICloseFullScreen 13 /* Deprecated */
+#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
+#define X_XF86DRICloseFullScreen 13 /* Deprecated */
-#define XF86DRINumberEvents 0
+#define XF86DRINumberEvents 0
-#define XF86DRIClientNotLocal 0
-#define XF86DRIOperationNotSupported 1
-#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
+#define XF86DRIClientNotLocal 0
+#define XF86DRIOperationNotSupported 1
+#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
#ifndef _XF86DRI_SERVER_
_XFUNCPROTOBEGIN
+ Bool XF86DRIQueryExtension(Display * dpy, int *event_base,
+ int *error_base);
-Bool XF86DRIQueryExtension( Display *dpy, int *event_base, int *error_base );
+Bool XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+ int *patchVersion);
-Bool XF86DRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion,
- int *patchVersion );
+Bool XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
+ Bool * isCapable);
-Bool XF86DRIQueryDirectRenderingCapable( Display *dpy, int screen,
- Bool *isCapable );
+Bool XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
+ char **busIDString);
-Bool XF86DRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA,
- char **busIDString );
+Bool XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-Bool XF86DRIAuthConnection( Display *dpy, int screen, drm_magic_t magic );
+Bool XF86DRICloseConnection(Display * dpy, int screen);
-Bool XF86DRICloseConnection( Display *dpy, int screen );
+Bool XF86DRIGetClientDriverName(Display * dpy, int screen,
+ int *ddxDriverMajorVersion,
+ int *ddxDriverMinorVersion,
+ int *ddxDriverPatchVersion,
+ char **clientDriverName);
-Bool XF86DRIGetClientDriverName( Display *dpy, int screen,
- int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
- int *ddxDriverPatchVersion, char **clientDriverName );
+Bool XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
+ XID * ptr_to_returned_context_id,
+ drm_context_t * hHWContext);
-Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual,
- XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
+Bool XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
+ XID * ptr_to_returned_context_id,
+ drm_context_t * hHWContext);
-Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID,
- XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
+extern Bool XF86DRIDestroyContext(Display * dpy, int screen, XID context_id);
-extern Bool XF86DRIDestroyContext( Display *dpy, int screen,
- XID context_id );
+extern Bool XF86DRICreateDrawable(Display * dpy, int screen,
+ XID drawable, drm_drawable_t * hHWDrawable);
-extern Bool XF86DRICreateDrawable( Display *dpy, int screen,
- XID drawable, drm_drawable_t *hHWDrawable );
+extern Bool XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable);
-extern Bool XF86DRIDestroyDrawable( Display *dpy, int screen,
- XID drawable);
+Bool XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+ unsigned int *index, unsigned int *stamp,
+ int *X, int *Y, int *W, int *H,
+ int *numClipRects, drm_clip_rect_t ** pClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects,
+ drm_clip_rect_t ** pBackClipRects);
-Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable,
- unsigned int *index, unsigned int *stamp,
- int *X, int *Y, int *W, int *H,
- int *numClipRects, drm_clip_rect_t ** pClipRects,
- int *backX, int *backY,
- int *numBackClipRects, drm_clip_rect_t **pBackClipRects );
-
-Bool XF86DRIGetDeviceInfo( Display *dpy, int screen,
- drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize,
- int *fbStride, int *devPrivateSize, void **pDevPrivate );
+Bool XF86DRIGetDeviceInfo(Display * dpy, int screen,
+ drm_handle_t * hFrameBuffer, int *fbOrigin,
+ int *fbSize, int *fbStride, int *devPrivateSize,
+ void **pDevPrivate);
_XFUNCPROTOEND
-
#endif /* _XF86DRI_SERVER_ */
-
#endif /* _XF86DRI_H_ */
-
diff --git a/src/glx/x11/xf86dristr.h b/src/glx/x11/xf86dristr.h
index b834bd1a1a..f3d13297dd 100644
--- a/src/glx/x11/xf86dristr.h
+++ b/src/glx/x11/xf86dristr.h
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -54,287 +55,312 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XF86DRI_MINOR_VERSION 1
#define XF86DRI_PATCH_VERSION 0
-typedef struct _XF86DRIQueryVersion {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIQueryVersion */
- CARD16 length B16;
+typedef struct _XF86DRIQueryVersion
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIQueryVersion */
+ CARD16 length B16;
} xXF86DRIQueryVersionReq;
#define sz_xXF86DRIQueryVersionReq 4
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD16 majorVersion B16; /* major version of DRI protocol */
- CARD16 minorVersion B16; /* minor version of DRI protocol */
- CARD32 patchVersion B32; /* patch version of DRI protocol */
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of DRI protocol */
+ CARD16 minorVersion B16; /* minor version of DRI protocol */
+ CARD32 patchVersion B32; /* patch version of DRI protocol */
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xXF86DRIQueryVersionReply;
#define sz_xXF86DRIQueryVersionReply 32
-typedef struct _XF86DRIQueryDirectRenderingCapable {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
- CARD16 length B16;
- CARD32 screen B32;
+typedef struct _XF86DRIQueryDirectRenderingCapable
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
+ CARD16 length B16;
+ CARD32 screen B32;
} xXF86DRIQueryDirectRenderingCapableReq;
#define sz_xXF86DRIQueryDirectRenderingCapableReq 8
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- BOOL isCapable;
- BOOL pad2;
- BOOL pad3;
- BOOL pad4;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
- CARD32 pad9 B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL isCapable;
+ BOOL pad2;
+ BOOL pad3;
+ BOOL pad4;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+ CARD32 pad8 B32;
+ CARD32 pad9 B32;
} xXF86DRIQueryDirectRenderingCapableReply;
#define sz_xXF86DRIQueryDirectRenderingCapableReply 32
-typedef struct _XF86DRIOpenConnection {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIOpenConnection */
- CARD16 length B16;
- CARD32 screen B32;
+typedef struct _XF86DRIOpenConnection
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIOpenConnection */
+ CARD16 length B16;
+ CARD32 screen B32;
} xXF86DRIOpenConnectionReq;
#define sz_xXF86DRIOpenConnectionReq 8
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hSAREALow B32;
- CARD32 hSAREAHigh B32;
- CARD32 busIdStringLength B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 hSAREALow B32;
+ CARD32 hSAREAHigh B32;
+ CARD32 busIdStringLength B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+ CARD32 pad8 B32;
} xXF86DRIOpenConnectionReply;
#define sz_xXF86DRIOpenConnectionReply 32
-typedef struct _XF86DRIAuthConnection {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 magic B32;
+typedef struct _XF86DRIAuthConnection
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseConnection */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 magic B32;
} xXF86DRIAuthConnectionReq;
#define sz_xXF86DRIAuthConnectionReq 12
-typedef struct {
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 authenticated B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct
+{
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 authenticated B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xXF86DRIAuthConnectionReply;
#define zx_xXF86DRIAuthConnectionReply 32
-typedef struct _XF86DRICloseConnection {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
+typedef struct _XF86DRICloseConnection
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseConnection */
+ CARD16 length B16;
+ CARD32 screen B32;
} xXF86DRICloseConnectionReq;
#define sz_xXF86DRICloseConnectionReq 8
-typedef struct _XF86DRIGetClientDriverName {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetClientDriverName */
- CARD16 length B16;
- CARD32 screen B32;
+typedef struct _XF86DRIGetClientDriverName
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIGetClientDriverName */
+ CARD16 length B16;
+ CARD32 screen B32;
} xXF86DRIGetClientDriverNameReq;
#define sz_xXF86DRIGetClientDriverNameReq 8
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 ddxDriverMajorVersion B32;
- CARD32 ddxDriverMinorVersion B32;
- CARD32 ddxDriverPatchVersion B32;
- CARD32 clientDriverNameLength B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 ddxDriverMajorVersion B32;
+ CARD32 ddxDriverMinorVersion B32;
+ CARD32 ddxDriverPatchVersion B32;
+ CARD32 clientDriverNameLength B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xXF86DRIGetClientDriverNameReply;
#define sz_xXF86DRIGetClientDriverNameReply 32
-typedef struct _XF86DRICreateContext {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateContext */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 visual B32;
- CARD32 context B32;
+typedef struct _XF86DRICreateContext
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICreateContext */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 visual B32;
+ CARD32 context B32;
} xXF86DRICreateContextReq;
#define sz_xXF86DRICreateContextReq 16
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hHWContext B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 hHWContext B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xXF86DRICreateContextReply;
#define sz_xXF86DRICreateContextReply 32
-typedef struct _XF86DRIDestroyContext {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroyContext */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 context B32;
+typedef struct _XF86DRIDestroyContext
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIDestroyContext */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 context B32;
} xXF86DRIDestroyContextReq;
#define sz_xXF86DRIDestroyContextReq 12
-typedef struct _XF86DRICreateDrawable {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateDrawable */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct _XF86DRICreateDrawable
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICreateDrawable */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xXF86DRICreateDrawableReq;
#define sz_xXF86DRICreateDrawableReq 12
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hHWDrawable B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 hHWDrawable B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xXF86DRICreateDrawableReply;
#define sz_xXF86DRICreateDrawableReply 32
-typedef struct _XF86DRIDestroyDrawable {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroyDrawable */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct _XF86DRIDestroyDrawable
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIDestroyDrawable */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xXF86DRIDestroyDrawableReq;
#define sz_xXF86DRIDestroyDrawableReq 12
-typedef struct _XF86DRIGetDrawableInfo {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetDrawableInfo */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct _XF86DRIGetDrawableInfo
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIGetDrawableInfo */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xXF86DRIGetDrawableInfoReq;
#define sz_xXF86DRIGetDrawableInfoReq 12
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 drawableTableIndex B32;
- CARD32 drawableTableStamp B32;
- INT16 drawableX B16;
- INT16 drawableY B16;
- INT16 drawableWidth B16;
- INT16 drawableHeight B16;
- CARD32 numClipRects B32;
- INT16 backX B16;
- INT16 backY B16;
- CARD32 numBackClipRects B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 drawableTableIndex B32;
+ CARD32 drawableTableStamp B32;
+ INT16 drawableX B16;
+ INT16 drawableY B16;
+ INT16 drawableWidth B16;
+ INT16 drawableHeight B16;
+ CARD32 numClipRects B32;
+ INT16 backX B16;
+ INT16 backY B16;
+ CARD32 numBackClipRects B32;
} xXF86DRIGetDrawableInfoReply;
#define sz_xXF86DRIGetDrawableInfoReply 36
-typedef struct _XF86DRIGetDeviceInfo {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetDeviceInfo */
- CARD16 length B16;
- CARD32 screen B32;
+typedef struct _XF86DRIGetDeviceInfo
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIGetDeviceInfo */
+ CARD16 length B16;
+ CARD32 screen B32;
} xXF86DRIGetDeviceInfoReq;
#define sz_xXF86DRIGetDeviceInfoReq 8
-typedef struct {
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hFrameBufferLow B32;
- CARD32 hFrameBufferHigh B32;
- CARD32 framebufferOrigin B32;
- CARD32 framebufferSize B32;
- CARD32 framebufferStride B32;
- CARD32 devPrivateSize B32;
+typedef struct
+{
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 hFrameBufferLow B32;
+ CARD32 hFrameBufferHigh B32;
+ CARD32 framebufferOrigin B32;
+ CARD32 framebufferSize B32;
+ CARD32 framebufferStride B32;
+ CARD32 devPrivateSize B32;
} xXF86DRIGetDeviceInfoReply;
#define sz_xXF86DRIGetDeviceInfoReply 32
-typedef struct _XF86DRIOpenFullScreen {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIOpenFullScreen */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct _XF86DRIOpenFullScreen
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIOpenFullScreen */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xXF86DRIOpenFullScreenReq;
#define sz_xXF86DRIOpenFullScreenReq 12
-typedef struct {
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 isFullScreen B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
+typedef struct
+{
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 isFullScreen B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xXF86DRIOpenFullScreenReply;
#define sz_xXF86DRIOpenFullScreenReply 32
-typedef struct _XF86DRICloseFullScreen {
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseFullScreen */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
+typedef struct _XF86DRICloseFullScreen
+{
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseFullScreen */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
} xXF86DRICloseFullScreenReq;
#define sz_xXF86DRICloseFullScreenReq 12
-typedef struct {
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
+typedef struct
+{
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
} xXF86DRICloseFullScreenReply;
#define sz_xXF86DRICloseFullScreenReply 32
diff --git a/src/glx/x11/xfont.c b/src/glx/x11/xfont.c
index 6ec8c2d6bf..8e46063a32 100644
--- a/src/glx/x11/xfont.c
+++ b/src/glx/x11/xfont.c
@@ -1,3 +1,4 @@
+/* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
/*
* Mesa 3-D graphics library
* Version: 3.1
@@ -48,59 +49,56 @@
int debug_xfonts = 0;
static void
-dump_char_struct (XCharStruct *ch, char *prefix)
+dump_char_struct(XCharStruct * ch, char *prefix)
{
- printf ("%slbearing = %d, rbearing = %d, width = %d\n",
+ printf("%slbearing = %d, rbearing = %d, width = %d\n",
prefix, ch->lbearing, ch->rbearing, ch->width);
- printf ("%sascent = %d, descent = %d, attributes = %u\n",
+ printf("%sascent = %d, descent = %d, attributes = %u\n",
prefix, ch->ascent, ch->descent, (unsigned int) ch->attributes);
}
static void
-dump_font_struct (XFontStruct *font)
+dump_font_struct(XFontStruct * font)
{
- printf ("ascent = %d, descent = %d\n", font->ascent, font->descent);
- printf ("char_or_byte2 = (%u,%u)\n",
+ printf("ascent = %d, descent = %d\n", font->ascent, font->descent);
+ printf("char_or_byte2 = (%u,%u)\n",
font->min_char_or_byte2, font->max_char_or_byte2);
- printf ("byte1 = (%u,%u)\n", font->min_byte1, font->max_byte1);
- printf ("all_chars_exist = %s\n", font->all_chars_exist ? "True" :
-"False");
- printf ("default_char = %c (\\%03o)\n",
- (char) (isprint (font->default_char) ? font->default_char : ' '),
+ printf("byte1 = (%u,%u)\n", font->min_byte1, font->max_byte1);
+ printf("all_chars_exist = %s\n", font->all_chars_exist ? "True" : "False");
+ printf("default_char = %c (\\%03o)\n",
+ (char) (isprint(font->default_char) ? font->default_char : ' '),
font->default_char);
- dump_char_struct (&font->min_bounds, "min> ");
- dump_char_struct (&font->max_bounds, "max> ");
+ dump_char_struct(&font->min_bounds, "min> ");
+ dump_char_struct(&font->max_bounds, "max> ");
#if 0
- for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++)
- {
+ for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++) {
char prefix[8];
- sprintf (prefix, "%d> ", c);
- dump_char_struct (&font->per_char[c], prefix);
- }
+ sprintf(prefix, "%d> ", c);
+ dump_char_struct(&font->per_char[c], prefix);
+ }
#endif
}
static void
-dump_bitmap (unsigned int width, unsigned int height, GLubyte *bitmap)
+dump_bitmap(unsigned int width, unsigned int height, GLubyte * bitmap)
{
- unsigned int x, y;
-
- printf (" ");
- for (x = 0; x < 8*width; x++)
- printf ("%o", 7 - (x % 8));
- putchar ('\n');
- for (y = 0; y < height; y++)
- {
- printf ("%3o:", y);
- for (x = 0; x < 8*width; x++)
- putchar ((bitmap[width*(height - y - 1) + x/8] & (1 << (7 - (x %
-8))))
+ unsigned int x, y;
+
+ printf(" ");
+ for (x = 0; x < 8 * width; x++)
+ printf("%o", 7 - (x % 8));
+ putchar('\n');
+ for (y = 0; y < height; y++) {
+ printf("%3o:", y);
+ for (x = 0; x < 8 * width; x++)
+ putchar((bitmap[width * (height - y - 1) + x / 8] & (1 << (7 - (x %
+ 8))))
? '*' : '.');
- printf (" ");
+ printf(" ");
for (x = 0; x < width; x++)
- printf ("0x%02x, ", bitmap[width*(height - y - 1) + x]);
- putchar ('\n');
- }
+ printf("0x%02x, ", bitmap[width * (height - y - 1) + x]);
+ putchar('\n');
+ }
}
#endif /* DEBUG */
@@ -132,169 +130,172 @@ dump_bitmap (unsigned int width, unsigned int height, GLubyte *bitmap)
* Generate OpenGL-compatible bitmap.
*/
static void
-fill_bitmap (Display *dpy, Window win, GC gc,
- unsigned int width, unsigned int height,
- int x0, int y0, unsigned int c, GLubyte *bitmap)
+fill_bitmap(Display * dpy, Window win, GC gc,
+ unsigned int width, unsigned int height,
+ int x0, int y0, unsigned int c, GLubyte * bitmap)
{
- XImage *image;
- unsigned int x, y;
- Pixmap pixmap;
- XChar2b char2b;
-
- pixmap = XCreatePixmap (dpy, win, 8*width, height, 1);
- XSetForeground(dpy, gc, 0);
- XFillRectangle (dpy, pixmap, gc, 0, 0, 8*width, height);
- XSetForeground(dpy, gc, 1);
-
- char2b.byte1 = (c >> 8) & 0xff;
- char2b.byte2 = (c & 0xff);
-
- XDrawString16 (dpy, pixmap, gc, x0, y0, &char2b, 1);
-
- image = XGetImage (dpy, pixmap, 0, 0, 8*width, height, 1, XYPixmap);
- if (image) {
- /* Fill the bitmap (X11 and OpenGL are upside down wrt each other). */
- for (y = 0; y < height; y++)
- for (x = 0; x < 8*width; x++)
- if (XGetPixel (image, x, y))
- bitmap[width*(height - y - 1) + x/8] |= (1 << (7 - (x % 8)));
- XDestroyImage (image);
- }
-
- XFreePixmap (dpy, pixmap);
+ XImage *image;
+ unsigned int x, y;
+ Pixmap pixmap;
+ XChar2b char2b;
+
+ pixmap = XCreatePixmap(dpy, win, 8 * width, height, 1);
+ XSetForeground(dpy, gc, 0);
+ XFillRectangle(dpy, pixmap, gc, 0, 0, 8 * width, height);
+ XSetForeground(dpy, gc, 1);
+
+ char2b.byte1 = (c >> 8) & 0xff;
+ char2b.byte2 = (c & 0xff);
+
+ XDrawString16(dpy, pixmap, gc, x0, y0, &char2b, 1);
+
+ image = XGetImage(dpy, pixmap, 0, 0, 8 * width, height, 1, XYPixmap);
+ if (image) {
+ /* Fill the bitmap (X11 and OpenGL are upside down wrt each other). */
+ for (y = 0; y < height; y++)
+ for (x = 0; x < 8 * width; x++)
+ if (XGetPixel(image, x, y))
+ bitmap[width * (height - y - 1) + x / 8] |=
+ (1 << (7 - (x % 8)));
+ XDestroyImage(image);
+ }
+
+ XFreePixmap(dpy, pixmap);
}
/*
* determine if a given glyph is valid and return the
* corresponding XCharStruct.
*/
-static XCharStruct *isvalid(XFontStruct *fs, int which)
+static XCharStruct *
+isvalid(XFontStruct * fs, int which)
{
- unsigned int rows,pages;
- int byte1 = 0, byte2 = 0;
- int i,valid = 1;
-
- rows = fs->max_byte1 - fs->min_byte1 + 1;
- pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
-
- if (rows == 1) {
- /* "linear" fonts */
- if ((fs->min_char_or_byte2 > which) ||
- (fs->max_char_or_byte2 < which)) valid = 0;
- } else {
- /* "matrix" fonts */
- byte2 = which & 0xff;
- byte1 = which >> 8;
- if ((fs->min_char_or_byte2 > byte2) ||
- (fs->max_char_or_byte2 < byte2) ||
- (fs->min_byte1 > byte1) ||
- (fs->max_byte1 < byte1)) valid = 0;
- }
-
- if (valid) {
- if (fs->per_char) {
- if (rows == 1) {
- /* "linear" fonts */
- return(fs->per_char + (which-fs->min_char_or_byte2) );
- } else {
- /* "matrix" fonts */
- i = ((byte1 - fs->min_byte1) * pages) +
- (byte2 - fs->min_char_or_byte2);
- return(fs->per_char + i);
+ unsigned int rows, pages;
+ int byte1 = 0, byte2 = 0;
+ int i, valid = 1;
+
+ rows = fs->max_byte1 - fs->min_byte1 + 1;
+ pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
+
+ if (rows == 1) {
+ /* "linear" fonts */
+ if ((fs->min_char_or_byte2 > which) || (fs->max_char_or_byte2 < which))
+ valid = 0;
+ }
+ else {
+ /* "matrix" fonts */
+ byte2 = which & 0xff;
+ byte1 = which >> 8;
+ if ((fs->min_char_or_byte2 > byte2) ||
+ (fs->max_char_or_byte2 < byte2) ||
+ (fs->min_byte1 > byte1) || (fs->max_byte1 < byte1))
+ valid = 0;
+ }
+
+ if (valid) {
+ if (fs->per_char) {
+ if (rows == 1) {
+ /* "linear" fonts */
+ return (fs->per_char + (which - fs->min_char_or_byte2));
+ }
+ else {
+ /* "matrix" fonts */
+ i = ((byte1 - fs->min_byte1) * pages) +
+ (byte2 - fs->min_char_or_byte2);
+ return (fs->per_char + i);
+ }
}
- } else {
- return(&fs->min_bounds);
- }
- }
- return(NULL);
+ else {
+ return (&fs->min_bounds);
+ }
+ }
+ return (NULL);
}
-_X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
+_X_HIDDEN void
+DRI_glXUseXFont(Font font, int first, int count, int listbase)
{
- GLXContext CC;
- Display *dpy;
- Window win;
- Pixmap pixmap;
- GC gc;
- XGCValues values;
- unsigned long valuemask;
- XFontStruct *fs;
-
- GLint swapbytes, lsbfirst, rowlength;
- GLint skiprows, skippixels, alignment;
-
- unsigned int max_width, max_height, max_bm_width, max_bm_height;
- GLubyte *bm;
-
- int i;
-
- CC = __glXGetCurrentContext();
- dpy = CC->currentDpy;
- win = CC->currentDrawable;
-
- fs = XQueryFont (dpy, font);
- if (!fs)
- {
+ GLXContext CC;
+ Display *dpy;
+ Window win;
+ Pixmap pixmap;
+ GC gc;
+ XGCValues values;
+ unsigned long valuemask;
+ XFontStruct *fs;
+
+ GLint swapbytes, lsbfirst, rowlength;
+ GLint skiprows, skippixels, alignment;
+
+ unsigned int max_width, max_height, max_bm_width, max_bm_height;
+ GLubyte *bm;
+
+ int i;
+
+ CC = __glXGetCurrentContext();
+ dpy = CC->currentDpy;
+ win = CC->currentDrawable;
+
+ fs = XQueryFont(dpy, font);
+ if (!fs) {
__glXSetError(CC, GL_INVALID_VALUE);
return;
- }
-
- /* Allocate a bitmap that can fit all characters. */
- max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
- max_height = fs->max_bounds.ascent + fs->max_bounds.descent;
- max_bm_width = (max_width + 7) / 8;
- max_bm_height = max_height;
-
- bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof
-(GLubyte));
- if (!bm) {
- XFreeFontInfo( NULL, fs, 1 );
+ }
+
+ /* Allocate a bitmap that can fit all characters. */
+ max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
+ max_height = fs->max_bounds.ascent + fs->max_bounds.descent;
+ max_bm_width = (max_width + 7) / 8;
+ max_bm_height = max_height;
+
+ bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
+ if (!bm) {
+ XFreeFontInfo(NULL, fs, 1);
__glXSetError(CC, GL_OUT_OF_MEMORY);
return;
- }
+ }
#if 0
- /* get the page info */
- pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
- firstchar = (fs->min_byte1 << 8) + fs->min_char_or_byte2;
- lastchar = (fs->max_byte1 << 8) + fs->max_char_or_byte2;
- rows = fs->max_byte1 - fs->min_byte1 + 1;
- unsigned int first_char, last_char, pages, rows;
+ /* get the page info */
+ pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
+ firstchar = (fs->min_byte1 << 8) + fs->min_char_or_byte2;
+ lastchar = (fs->max_byte1 << 8) + fs->max_char_or_byte2;
+ rows = fs->max_byte1 - fs->min_byte1 + 1;
+ unsigned int first_char, last_char, pages, rows;
#endif
- /* Save the current packing mode for bitmaps. */
- glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
- glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
- glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
- glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
- glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
- glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
-
- /* Enforce a standard packing mode which is compatible with
- fill_bitmap() from above. This is actually the default mode,
- except for the (non)alignment. */
- glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
- glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-
- pixmap = XCreatePixmap (dpy, win, 10, 10, 1);
- values.foreground = BlackPixel (dpy, DefaultScreen (dpy));
- values.background = WhitePixel (dpy, DefaultScreen (dpy));
- values.font = fs->fid;
- valuemask = GCForeground | GCBackground | GCFont;
- gc = XCreateGC (dpy, pixmap, valuemask, &values);
- XFreePixmap (dpy, pixmap);
+ /* Save the current packing mode for bitmaps. */
+ glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
+ glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
+ glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
+ glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
+ glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
+ glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+
+ /* Enforce a standard packing mode which is compatible with
+ fill_bitmap() from above. This is actually the default mode,
+ except for the (non)alignment. */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
+ values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
+ values.background = WhitePixel(dpy, DefaultScreen(dpy));
+ values.font = fs->fid;
+ valuemask = GCForeground | GCBackground | GCFont;
+ gc = XCreateGC(dpy, pixmap, valuemask, &values);
+ XFreePixmap(dpy, pixmap);
#ifdef DEBUG
- if (debug_xfonts)
- dump_font_struct (fs);
+ if (debug_xfonts)
+ dump_font_struct(fs);
#endif
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
unsigned int width, height, bm_width, bm_height;
GLfloat x0, y0, dx, dy;
XCharStruct *ch;
@@ -306,17 +307,18 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
/* check on index validity and get the bounds */
ch = isvalid(fs, c);
if (!ch) {
- ch = &fs->max_bounds;
- valid = 0;
- } else {
- valid = 1;
+ ch = &fs->max_bounds;
+ valid = 0;
+ }
+ else {
+ valid = 1;
}
#ifdef DEBUG
if (debug_xfonts) {
- char s[7];
- sprintf (s, isprint (c) ? "%c> " : "\\%03o> ", c);
- dump_char_struct (ch, s);
+ char s[7];
+ sprintf(s, isprint(c) ? "%c> " : "\\%03o> ", c);
+ dump_char_struct(ch, s);
}
#endif
@@ -324,13 +326,13 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
straight from the glXUseXFont(3) manpage. */
width = ch->rbearing - ch->lbearing;
height = ch->ascent + ch->descent;
- x0 = - ch->lbearing;
+ x0 = -ch->lbearing;
y0 = ch->descent - 1;
dx = ch->width;
dy = 0;
/* X11's starting point. */
- x = - ch->lbearing;
+ x = -ch->lbearing;
y = ch->ascent;
/* Round the width to a multiple of eight. We will use this also
@@ -339,38 +341,38 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
bm_width = (width + 7) / 8;
bm_height = height;
- glNewList (list, GL_COMPILE);
- if (valid && (bm_width > 0) && (bm_height > 0)) {
+ glNewList(list, GL_COMPILE);
+ if (valid && (bm_width > 0) && (bm_height > 0)) {
- memset (bm, '\0', bm_width * bm_height);
- fill_bitmap (dpy, win, gc, bm_width, bm_height, x, y, c, bm);
+ memset(bm, '\0', bm_width * bm_height);
+ fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
- glBitmap (width, height, x0, y0, dx, dy, bm);
+ glBitmap(width, height, x0, y0, dx, dy, bm);
#ifdef DEBUG
- if (debug_xfonts) {
- printf ("width/height = %u/%u\n", width, height);
- printf ("bm_width/bm_height = %u/%u\n", bm_width,
-bm_height);
- dump_bitmap (bm_width, bm_height, bm);
- }
+ if (debug_xfonts) {
+ printf("width/height = %u/%u\n", width, height);
+ printf("bm_width/bm_height = %u/%u\n", bm_width, bm_height);
+ dump_bitmap(bm_width, bm_height, bm);
+ }
#endif
- } else {
- glBitmap (0, 0, 0.0, 0.0, dx, dy, NULL);
- }
- glEndList ();
- }
-
- Xfree(bm);
- XFreeFontInfo( NULL, fs, 1 );
- XFreeGC (dpy, gc);
-
- /* Restore saved packing modes. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
- glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
- glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+ }
+ else {
+ glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
+ }
+ glEndList();
+ }
+
+ Xfree(bm);
+ XFreeFontInfo(NULL, fs, 1);
+ XFreeGC(dpy, gc);
+
+ /* Restore saved packing modes. */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
}
#endif