blob: b8241b8cf232d6d1206ea98dbc1e272110bb7165 [file] [log] [blame]
Adam Jacksoncb3610e2004-10-25 21:09:16 +00001/*
2** License Applicability. Except to the extent portions of this file are
3** made subject to an alternative license as permitted in the SGI Free
4** Software License B, Version 1.1 (the "License"), the contents of this
5** file are subject only to the provisions of the License. You may not use
6** this file except in compliance with the License. You may obtain a copy
7** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
9**
10** http://oss.sgi.com/projects/FreeB
11**
12** Note that, as provided in the License, the Software is distributed on an
13** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
17**
18** Original Code. The Original Code is: OpenGL Sample Implementation,
19** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21** Copyright in any portions created by third parties is as indicated
22** elsewhere herein. All Rights Reserved.
23**
24** Additional Notice Provisions: The application programming interfaces
25** established by SGI in conjunction with the Original Code are The
26** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29** Window System(R) (Version 1.3), released October 19, 1998. This software
30** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31** published by SGI, but has not been independently verified as being
32** compliant with the OpenGL(R) version 1.2.1 Specification.
33*/
34/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.21 2004/02/09 23:46:31 alanh Exp $ */
35
36/**
37 * \file glxclient.h
38 * Direct rendering support added by Precision Insight, Inc.
39 *
40 * \author Kevin E. Martin <kevin@precisioninsight.com>
41 */
42
43#ifndef _GLX_client_h_
44#define _GLX_client_h_
45#define NEED_REPLIES
46#define NEED_EVENTS
47#include <X11/Xproto.h>
48#include <X11/Xlibint.h>
49#define GLX_GLXEXT_PROTOTYPES
50#include <GL/glx.h>
51#include <GL/glxext.h>
52#include <string.h>
53#include <stdlib.h>
54#include <stdio.h>
Adam Jacksonad919c32004-11-15 15:31:32 +000055#ifdef WIN32
56#include <stdint.h>
57#endif
Adam Jacksoncb3610e2004-10-25 21:09:16 +000058#include "GL/glxint.h"
59#include "GL/glxproto.h"
60#include "GL/internal/glcore.h"
61#include "glapitable.h"
Ian Romanickfdb07632005-02-22 22:36:31 +000062#include "glxextensions.h"
Ian Romanick02986cb2005-04-18 16:59:53 +000063#if defined( XTHREADS )
64# include "Xthreads.h"
65#elif defined( PTHREADS )
66# include <pthread.h>
Adam Jacksoncb3610e2004-10-25 21:09:16 +000067#endif
68#ifdef GLX_BUILT_IN_XMESA
69#include "realglx.h" /* just silences prototype warnings */
70#endif
71
72#define GLX_MAJOR_VERSION 1 /* current version numbers */
73#define GLX_MINOR_VERSION 4
74
75#define __GLX_MAX_TEXTURE_UNITS 32
76
77typedef struct __GLXcontextRec __GLXcontext;
78typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
79typedef struct _glapi_table __GLapi;
80
81/************************************************************************/
82
83#ifdef GLX_DIRECT_RENDERING
84
85#include <GL/internal/dri_interface.h>
86
87typedef void *(*CreateScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
88 int numConfigs, __GLXvisualConfig *config);
89
90typedef void *(*CreateNewScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
91 const __GLcontextModes * modes, const __DRIversion * ddx_version,
92 const __DRIversion * dri_version, const __DRIversion * drm_version,
93 const __DRIframebuffer * frame_buffer, void * pSAREA,
94 int fd, int internal_api_version, __GLcontextModes ** driver_modes);
95
96
97/**
98 * Display dependent methods. This structure is initialized during the
99 * \c driCreateDisplay call.
100 */
101struct __DRIdisplayRec {
102 /**
103 * Method to destroy the private DRI display data.
104 */
105 void (*destroyDisplay)(Display *dpy, void *displayPrivate);
106
107 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000108 * Opaque pointer to private per display direct rendering data.
109 * \c NULL if direct rendering is not supported on this display.
110 */
111 struct __DRIdisplayPrivateRec *private;
112
113 /**
114 * Array of pointers to methods to create and initialize the private DRI
115 * screen data.
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000116 */
117 CreateNewScreenFunc * createNewScreen;
118};
119
120
121/*
122** We keep a linked list of these structures, one per DRI device driver.
123*/
124struct __DRIdriverRec {
125 const char *name;
126 void *handle;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000127 CreateNewScreenFunc createNewScreenFunc;
128 struct __DRIdriverRec *next;
129};
130
131/*
132** Function to create and DRI display data and initialize the display
133** dependent methods.
134*/
135extern void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp);
136
137extern __DRIdriver *driGetDriver(Display *dpy, int scrNum);
138
139extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
140
141/*
142** Functions to obtain driver configuration information from a direct
143** rendering client application
144*/
145extern const char *glXGetScreenDriver (Display *dpy, int scrNum);
146
147extern const char *glXGetDriverConfig (const char *driverName);
148
149#endif
150
151/************************************************************************/
152
153#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
154
155typedef struct __GLXpixelStoreModeRec {
156 GLboolean swapEndian;
157 GLboolean lsbFirst;
158 GLuint rowLength;
159 GLuint imageHeight;
160 GLuint imageDepth;
161 GLuint skipRows;
162 GLuint skipPixels;
163 GLuint skipImages;
164 GLuint alignment;
165} __GLXpixelStoreMode;
166
167/* The next 3 structures are deprecated. Client state is no longer tracked
168 * using them. They only remain to maintain the layout / structure offset of
169 * __GLXcontextRec. In XFree86 5.0 they will be removed altogether.
170 */
171
172typedef struct __GLXvertexArrayPointerStateRecDEPRECATED {
173 GLboolean enable;
174 void (*proc)(const void *);
175 const GLubyte *ptr;
176 GLsizei skip;
177 GLint size;
178 GLenum type;
179 GLsizei stride;
180} __GLXvertexArrayPointerStateDEPRECATED;
181
182typedef struct __GLXvertArrayStateRecDEPRECATED {
183 __GLXvertexArrayPointerStateDEPRECATED vertex;
184 __GLXvertexArrayPointerStateDEPRECATED normal;
185 __GLXvertexArrayPointerStateDEPRECATED color;
186 __GLXvertexArrayPointerStateDEPRECATED index;
187 __GLXvertexArrayPointerStateDEPRECATED texCoord[__GLX_MAX_TEXTURE_UNITS];
188 __GLXvertexArrayPointerStateDEPRECATED edgeFlag;
189 GLint maxElementsVertices;
190 GLint maxElementsIndices;
191 GLint activeTexture;
192} __GLXvertArrayStateDEPRECATED;
193
194typedef struct __GLXattributeRecDEPRECATED {
195 GLuint mask;
196
197 /*
198 ** Pixel storage state. Most of the pixel store mode state is kept
199 ** here and used by the client code to manage the packing and
200 ** unpacking of data sent to/received from the server.
201 */
202 __GLXpixelStoreMode storePack, storeUnpack;
203
204 /*
205 ** Vertex Array storage state. The vertex array component
206 ** state is stored here and is used to manage the packing of
207 ** DrawArrays data sent to the server.
208 */
209 __GLXvertArrayStateDEPRECATED vertArray;
210} __GLXattributeDEPRECATED;
211
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000212
213typedef struct __GLXattributeRec {
Ian Romanickfdb07632005-02-22 22:36:31 +0000214 GLuint mask;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000215
Ian Romanickfdb07632005-02-22 22:36:31 +0000216 /**
217 * Pixel storage state. Most of the pixel store mode state is kept
218 * here and used by the client code to manage the packing and
219 * unpacking of data sent to/received from the server.
220 */
221 __GLXpixelStoreMode storePack, storeUnpack;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000222
Ian Romanickfdb07632005-02-22 22:36:31 +0000223 /**
224 * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
225 * disabled?
226 */
227 GLboolean NoDrawArraysProtocol;
228
229 /**
230 * Vertex Array storage state. The vertex array component
231 * state is stored here and is used to manage the packing of
232 * DrawArrays data sent to the server.
233 */
234 struct array_state_vector * array_state;
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000235} __GLXattribute;
236
237typedef struct __GLXattributeMachineRec {
238 __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
239 __GLXattribute **stackPointer;
240} __GLXattributeMachine;
241
242/**
243 * GLX state that needs to be kept on the client. One of these records
244 * exist for each context that has been made current by this client.
245 */
246struct __GLXcontextRec {
247 /**
248 * \name Drawing command buffer.
249 *
250 * Drawing commands are packed into this buffer before being sent as a
251 * single GLX protocol request. The buffer is sent when it overflows or
252 * is flushed by \c __glXFlushRenderBuffer. \c pc is the next location
253 * in the buffer to be filled. \c limit is described above in the buffer
254 * slop discussion.
255 *
256 * Commands that require large amounts of data to be transfered will
257 * also use this buffer to hold a header that describes the large
258 * command.
259 *
260 * These must be the first 6 fields since they are static initialized
261 * in the dummy context in glxext.c
262 */
263 /*@{*/
264 GLubyte *buf;
265 GLubyte *pc;
266 GLubyte *limit;
267 GLubyte *bufEnd;
268 GLint bufSize;
269 /*@}*/
270
271 /**
272 * The XID of this rendering context. When the context is created a
273 * new XID is allocated. This is set to None when the context is
274 * destroyed but is still current to some thread. In this case the
275 * context will be freed on next MakeCurrent.
276 */
277 XID xid;
278
279 /**
280 * The XID of the \c shareList context.
281 */
282 XID share_xid;
283
284 /**
285 * Visual id.
286 *
287 * \deprecated
288 * This filed has been largely been replaced by the \c mode field, but
289 * the work is not quite done.
290 */
291 VisualID vid;
292
293 /**
294 * Screen number.
295 */
296 GLint screen;
297
298 /**
299 * \c GL_TRUE if the context was created with ImportContext, which
300 * means the server-side context was created by another X client.
301 */
302 GLboolean imported;
303
304 /**
305 * The context tag returned by MakeCurrent when this context is made
306 * current. This tag is used to identify the context that a thread has
307 * current so that proper server context management can be done. It is
308 * used for all context specific commands (i.e., \c Render, \c RenderLarge,
309 * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
310 * context)).
311 */
312 GLXContextTag currentContextTag;
313
314 /**
315 * \name Rendering mode
316 *
317 * The rendering mode is kept on the client as well as the server.
318 * When \c glRenderMode is called, the buffer associated with the
319 * previous rendering mode (feedback or select) is filled.
320 */
321 /*@{*/
322 GLenum renderMode;
323 GLfloat *feedbackBuf;
324 GLuint *selectBuf;
325 /*@}*/
326
327 /**
328 * This is \c GL_TRUE if the pixel unpack modes are such that an image
329 * can be unpacked from the clients memory by just copying. It may
330 * still be true that the server will have to do some work. This
331 * just promises that a straight copy will fetch the correct bytes.
332 */
333 GLboolean fastImageUnpack;
334
335 /**
336 * Fill newImage with the unpacked form of \c oldImage getting it
337 * ready for transport to the server.
338 */
339 void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
340 GLenum, const GLvoid*, GLubyte*, GLubyte*);
341
342 /**
343 * \name Client side attribs.
344 */
345 /*@{*/
346 __GLXattributeDEPRECATED stateDEPRECATED;
347 __GLXattributeMachine attributes;
348 /*@}*/
349
350 /**
351 * Client side error code. This is set when client side gl API
352 * routines need to set an error because of a bad enumerant or
353 * running out of memory, etc.
354 */
355 GLenum error;
356
357 /**
358 * Whether this context does direct rendering.
359 */
360 Bool isDirect;
361
362 /**
363 * \c dpy of current display for this context. Will be \c NULL if not
364 * current to any display, or if this is the "dummy context".
365 */
366 Display *currentDpy;
367
368 /**
369 * The current drawable for this context. Will be None if this
370 * context is not current to any drawable. currentReadable is below.
371 */
372 GLXDrawable currentDrawable;
373
374 /**
375 * \name GL Constant Strings
376 *
377 * Constant strings that describe the server implementation
378 * These pertain to GL attributes, not to be confused with
379 * GLX versioning attributes.
380 */
381 /*@{*/
382 GLubyte *vendor;
383 GLubyte *renderer;
384 GLubyte *version;
385 GLubyte *extensions;
386 /*@}*/
387
388 /**
389 * Record the dpy this context was created on for later freeing
390 */
391 Display *createDpy;
392
393 /**
394 * Maximum small render command size. This is the smaller of 64k and
395 * the size of the above buffer.
396 */
397 GLint maxSmallRenderCommandSize;
398
399 /**
400 * Major opcode for the extension. Copied here so a lookup isn't
401 * needed.
402 */
403 GLint majorOpcode;
404
405#ifdef GLX_DIRECT_RENDERING
406 /**
407 * Per context direct rendering interface functions and data.
408 */
409 __DRIcontext driContext;
410#endif
411
412 /**
413 * \c GLXFBConfigID used to create this context. May be \c None. This
414 * field has been replaced by the \c mode field.
415 *
416 * \since Internal API version 20030317.
417 *
418 * \deprecated
419 * This filed has been largely been replaced by the \c mode field, but
420 * the work is not quite done.
421 */
422 GLXFBConfigID fbconfigID;
423
424 /**
425 * The current read-drawable for this context. Will be None if this
426 * context is not current to any drawable.
427 *
428 * \since Internal API version 20030606.
429 */
430 GLXDrawable currentReadable;
431
432 /**
433 * Pointer to client-state data that is private to libGL. This is only
434 * used for indirect rendering contexts.
435 *
436 * No internal API version change was made for this change. Client-side
437 * drivers should NEVER use this data or even care that it exists.
438 */
439 void * client_state_private;
Ian Romanickfdb07632005-02-22 22:36:31 +0000440
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000441 /**
442 * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
443 */
444 int renderType;
445
446 /**
447 * \name Raw server GL version
448 *
449 * True core GL version supported by the server. This is the raw value
450 * returned by the server, and it may not reflect what is actually
451 * supported (or reported) by the client-side library.
452 */
453 /*@{*/
454 int server_major; /**< Major version number. */
455 int server_minor; /**< Minor version number. */
456 /*@}*/
Ian Romanickfdb07632005-02-22 22:36:31 +0000457
458 char gl_extension_bits[ __GL_EXT_BYTES ];
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000459};
460
461#define __glXSetError(gc,code) \
462 if (!(gc)->error) { \
463 (gc)->error = code; \
464 }
465
466extern void __glFreeAttributeState(__GLXcontext *);
467
468/************************************************************************/
469
470/**
471 * The size of the largest drawing command known to the implementation
472 * that will use the GLXRender GLX command. In this case it is
473 * \c glPolygonStipple.
474 */
475#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
476
477/**
478 * To keep the implementation fast, the code uses a "limit" pointer
479 * to determine when the drawing command buffer is too full to hold
480 * another fixed size command. This constant defines the amount of
481 * space that must always be available in the drawing command buffer
482 * at all times for the implementation to work. It is important that
483 * the number be just large enough, but not so large as to reduce the
484 * efficacy of the buffer. The "+32" is just to keep the code working
485 * in case somebody counts wrong.
486 */
487#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
488
489/**
490 * This implementation uses a smaller threshold for switching
491 * to the RenderLarge protocol than the protcol requires so that
492 * large copies don't occur.
493 */
494#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
495
496/**
497 * One of these records exists per screen of the display. It contains
498 * a pointer to the config data for that screen (if the screen supports GL).
499 */
500typedef struct __GLXscreenConfigsRec {
501 /**
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000502 * GLX extension string reported by the X-server.
503 */
504 const char *serverGLXexts;
505
506 /**
507 * GLX extension string to be reported to applications. This is the
508 * set of extensions that the application can actually use.
509 */
510 char *effectiveGLXexts;
511
512#ifdef GLX_DIRECT_RENDERING
513 /**
514 * Per screen direct rendering interface functions and data.
515 */
516 __DRIscreen driScreen;
517#endif
518
519 /**
Ian Romanickc39bf5e2005-07-24 06:29:14 +0000520 * Linked list of configurations for this screen.
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000521 */
522 __GLcontextModes *configs;
Ian Romanickc39bf5e2005-07-24 06:29:14 +0000523
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000524 /**
525 * Per-screen dynamic GLX extension tracking. The \c direct_support
526 * field only contains enough bits for 64 extensions. Should libGL
527 * ever need to track more than 64 GLX extensions, we can safely grow
528 * this field. The \c __GLXscreenConfigs structure is not used outside
529 * libGL.
530 */
531 /*@{*/
532 unsigned char direct_support[8];
533 GLboolean ext_list_first_time;
534 /*@}*/
535
536} __GLXscreenConfigs;
537
538/**
539 * Per display private data. One of these records exists for each display
540 * that is using the OpenGL (GLX) extension.
541 */
542struct __GLXdisplayPrivateRec {
543 /**
544 * Back pointer to the display
545 */
546 Display *dpy;
547
548 /**
549 * The \c majorOpcode is common to all connections to the same server.
550 * It is also copied into the context structure.
551 */
552 int majorOpcode;
553
554 /**
555 * \name Server Version
556 *
557 * Major and minor version returned by the server during initialization.
558 */
559 /*@{*/
560 int majorVersion, minorVersion;
561 /*@}*/
562
563 /**
564 * \name Storage for the servers GLX vendor and versions strings.
565 *
566 * These are the same for all screens on this display. These fields will
567 * be filled in on demand.
568 */
569 /*@{*/
570 const char *serverGLXvendor;
571 const char *serverGLXversion;
572 /*@}*/
573
574 /**
575 * Configurations of visuals for all screens on this display.
576 * Also, per screen data which now includes the server \c GLX_EXTENSION
577 * string.
578 */
579 __GLXscreenConfigs *screenConfigs;
580
581#ifdef GLX_DIRECT_RENDERING
582 /**
583 * Per display direct rendering interface functions and data.
584 */
585 __DRIdisplay driDisplay;
586#endif
587};
588
589void __glXFreeContext(__GLXcontext*);
590
591extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*);
592
593extern void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber,
594 GLint totalRequests,
595 const GLvoid * data, GLint dataLen);
596
597extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
598 const GLvoid *, GLint);
599
600/* Initialize the GLX extension for dpy */
601extern __GLXdisplayPrivate *__glXInitialize(Display*);
602
603/************************************************************************/
604
605extern int __glXDebug;
606
607/* This is per-thread storage in an MT environment */
Ian Romanick02986cb2005-04-18 16:59:53 +0000608#if defined( XTHREADS ) || defined( PTHREADS )
609
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000610extern void __glXSetCurrentContext(__GLXcontext *c);
Ian Romanick02986cb2005-04-18 16:59:53 +0000611
612# if defined( GLX_USE_TLS )
613
614extern __thread void * __glX_tls_Context
615 __attribute__((tls_model("initial-exec")));
616
617# define __glXGetCurrentContext() __glX_tls_Context
618
619# else
620
621extern __GLXcontext *__glXGetCurrentContext(void);
622
623# endif /* defined( GLX_USE_TLS ) */
624
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000625#else
Ian Romanick02986cb2005-04-18 16:59:53 +0000626
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000627extern __GLXcontext *__glXcurrentContext;
628#define __glXGetCurrentContext() __glXcurrentContext
629#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
Ian Romanick02986cb2005-04-18 16:59:53 +0000630
631#endif /* defined( XTHREADS ) || defined( PTHREADS ) */
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000632
633
634/*
635** Global lock for all threads in this address space using the GLX
636** extension
637*/
Ian Romanick02986cb2005-04-18 16:59:53 +0000638#if defined( XTHREADS )
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000639extern xmutex_rec __glXmutex;
640#define __glXLock() xmutex_lock(&__glXmutex)
641#define __glXUnlock() xmutex_unlock(&__glXmutex)
Ian Romanick02986cb2005-04-18 16:59:53 +0000642#elif defined( PTHREADS )
643extern pthread_mutex_t __glXmutex;
644#define __glXLock() pthread_mutex_lock(&__glXmutex)
645#define __glXUnlock() pthread_mutex_unlock(&__glXmutex)
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000646#else
647#define __glXLock()
648#define __glXUnlock()
649#endif
650
651/*
652** Setup for a command. Initialize the extension for dpy if necessary.
653*/
654extern CARD8 __glXSetupForCommand(Display *dpy);
655
656/************************************************************************/
657
658/*
659** Data conversion and packing support.
660*/
661
Ian Romanick5f1f2292005-01-07 02:39:09 +0000662extern const GLuint __glXDefaultPixelStore[9];
663
664/* Send an image to the server using RenderLarge. */
665extern void __glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
666 GLint width, GLint height, GLint depth, GLenum format, GLenum type,
667 const GLvoid *src, GLubyte *pc, GLubyte *modes);
668
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000669/* Return the size, in bytes, of some pixel data */
Ian Romanick5f1f2292005-01-07 02:39:09 +0000670extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000671
672/* Return the number of elements per group of a specified format*/
673extern GLint __glElementsPerGroup(GLenum format, GLenum type);
674
675/* Return the number of bytes per element, based on the element type (other
676** than GL_BITMAP).
677*/
678extern GLint __glBytesPerElement(GLenum type);
679
Adam Jacksoncb3610e2004-10-25 21:09:16 +0000680/*
681** Fill the transport buffer with the data from the users buffer,
682** applying some of the pixel store modes (unpack modes) to the data
683** first. As a side effect of this call, the "modes" field is
684** updated to contain the modes needed by the server to decode the
685** sent data.
686*/
687extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
688 GLenum, const GLvoid*, GLubyte*, GLubyte*);
689
690/* Copy map data with a stride into a packed buffer */
691extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
692extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
693extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
694 const GLfloat *, GLfloat *);
695extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
696 const GLdouble *, GLdouble *);
697
698/*
699** Empty an image out of the reply buffer into the clients memory applying
700** the pack modes to pack back into the clients requested format.
701*/
702extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
703 GLenum, const GLubyte *, GLvoid *);
704
705
706/*
707** Allocate and Initialize Vertex Array client state
708*/
709extern void __glXInitVertexArrayState(__GLXcontext*);
710
711/*
712** Inform the Server of the major and minor numbers and of the client
713** libraries extension string.
714*/
715extern void __glXClientInfo ( Display *dpy, int opcode );
716
717/************************************************************************/
718
719/*
720** Declarations that should be in Xlib
721*/
722#ifdef __GL_USE_OUR_PROTOTYPES
723extern void _XFlush(Display*);
724extern Status _XReply(Display*, xReply*, int, Bool);
725extern void _XRead(Display*, void*, long);
726extern void _XSend(Display*, const void*, long);
727#endif
728
729
730/*
731** GLX_BUILT_IN_XMESA controls whether libGL has a built-in verions of
732** Mesa that can render to non-GLX displays.
733*/
734#ifdef GLX_BUILT_IN_XMESA
735#define GLX_PREFIX(function) _real_##function
736#else
737#define GLX_PREFIX(function) function
738#endif
739
740
741extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
742 int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );
743
744extern char * __glXGetStringFromServer( Display * dpy, int opcode,
745 CARD32 glxCode, CARD32 for_whom, CARD32 name );
746
747extern char *__glXstrdup(const char *str);
748
749
750extern const char __glXGLClientVersion[];
751extern const char __glXGLClientExtensions[];
752
753/* Determine the internal API version */
754extern int __glXGetInternalVersion(void);
755
756/* Get the unadjusted system time */
757extern int __glXGetUST( int64_t * ust );
758
759#endif /* !__GLX_client_h__ */