blob: 7565760f0ced72f913879e5ae674390c9c95dfc6 [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>
55#include "GL/glxint.h"
56#include "GL/glxproto.h"
57#include "GL/internal/glcore.h"
58#include "glapitable.h"
59#ifdef NEED_GL_FUNCS_WRAPPED
60#include "indirect.h"
61#endif
62#ifdef XTHREADS
63#include "Xthreads.h"
64#endif
65#ifdef GLX_BUILT_IN_XMESA
66#include "realglx.h" /* just silences prototype warnings */
67#endif
68
69#define GLX_MAJOR_VERSION 1 /* current version numbers */
70#define GLX_MINOR_VERSION 4
71
72#define __GLX_MAX_TEXTURE_UNITS 32
73
74typedef struct __GLXcontextRec __GLXcontext;
75typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
76typedef struct _glapi_table __GLapi;
77
78/************************************************************************/
79
80#ifdef GLX_DIRECT_RENDERING
81
82#include <GL/internal/dri_interface.h>
83
84typedef void *(*CreateScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
85 int numConfigs, __GLXvisualConfig *config);
86
87typedef void *(*CreateNewScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
88 const __GLcontextModes * modes, const __DRIversion * ddx_version,
89 const __DRIversion * dri_version, const __DRIversion * drm_version,
90 const __DRIframebuffer * frame_buffer, void * pSAREA,
91 int fd, int internal_api_version, __GLcontextModes ** driver_modes);
92
93
94/**
95 * Display dependent methods. This structure is initialized during the
96 * \c driCreateDisplay call.
97 */
98struct __DRIdisplayRec {
99 /**
100 * Method to destroy the private DRI display data.
101 */
102 void (*destroyDisplay)(Display *dpy, void *displayPrivate);
103
104 /**
105 * Methods to create the private DRI screen data and initialize the
106 * screen dependent methods.
107 * This is an array [indexed by screen number] of function pointers.
108 *
109 * \deprecated This array of function pointers has been replaced by
110 * \c __DRIdisplayRec::createNewScreen.
111 * \sa __DRIdisplayRec::createNewScreen
112 */
113 CreateScreenFunc * createScreen;
114
115 /**
116 * Opaque pointer to private per display direct rendering data.
117 * \c NULL if direct rendering is not supported on this display.
118 */
119 struct __DRIdisplayPrivateRec *private;
120
121 /**
122 * Array of pointers to methods to create and initialize the private DRI
123 * screen data.
124 *
125 * \sa __DRIdisplayRec::createScreen
126 */
127 CreateNewScreenFunc * createNewScreen;
128};
129
130
131/*
132** We keep a linked list of these structures, one per DRI device driver.
133*/
134struct __DRIdriverRec {
135 const char *name;
136 void *handle;
137 CreateScreenFunc createScreenFunc;
138 CreateNewScreenFunc createNewScreenFunc;
139 struct __DRIdriverRec *next;
140};
141
142/*
143** Function to create and DRI display data and initialize the display
144** dependent methods.
145*/
146extern void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp);
147
148extern __DRIdriver *driGetDriver(Display *dpy, int scrNum);
149
150extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
151
152/*
153** Functions to obtain driver configuration information from a direct
154** rendering client application
155*/
156extern const char *glXGetScreenDriver (Display *dpy, int scrNum);
157
158extern const char *glXGetDriverConfig (const char *driverName);
159
160#endif
161
162/************************************************************************/
163
164#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
165
166typedef struct __GLXpixelStoreModeRec {
167 GLboolean swapEndian;
168 GLboolean lsbFirst;
169 GLuint rowLength;
170 GLuint imageHeight;
171 GLuint imageDepth;
172 GLuint skipRows;
173 GLuint skipPixels;
174 GLuint skipImages;
175 GLuint alignment;
176} __GLXpixelStoreMode;
177
178/* The next 3 structures are deprecated. Client state is no longer tracked
179 * using them. They only remain to maintain the layout / structure offset of
180 * __GLXcontextRec. In XFree86 5.0 they will be removed altogether.
181 */
182
183typedef struct __GLXvertexArrayPointerStateRecDEPRECATED {
184 GLboolean enable;
185 void (*proc)(const void *);
186 const GLubyte *ptr;
187 GLsizei skip;
188 GLint size;
189 GLenum type;
190 GLsizei stride;
191} __GLXvertexArrayPointerStateDEPRECATED;
192
193typedef struct __GLXvertArrayStateRecDEPRECATED {
194 __GLXvertexArrayPointerStateDEPRECATED vertex;
195 __GLXvertexArrayPointerStateDEPRECATED normal;
196 __GLXvertexArrayPointerStateDEPRECATED color;
197 __GLXvertexArrayPointerStateDEPRECATED index;
198 __GLXvertexArrayPointerStateDEPRECATED texCoord[__GLX_MAX_TEXTURE_UNITS];
199 __GLXvertexArrayPointerStateDEPRECATED edgeFlag;
200 GLint maxElementsVertices;
201 GLint maxElementsIndices;
202 GLint activeTexture;
203} __GLXvertArrayStateDEPRECATED;
204
205typedef struct __GLXattributeRecDEPRECATED {
206 GLuint mask;
207
208 /*
209 ** Pixel storage state. Most of the pixel store mode state is kept
210 ** here and used by the client code to manage the packing and
211 ** unpacking of data sent to/received from the server.
212 */
213 __GLXpixelStoreMode storePack, storeUnpack;
214
215 /*
216 ** Vertex Array storage state. The vertex array component
217 ** state is stored here and is used to manage the packing of
218 ** DrawArrays data sent to the server.
219 */
220 __GLXvertArrayStateDEPRECATED vertArray;
221} __GLXattributeDEPRECATED;
222
223typedef struct __GLXvertexArrayPointerStateRec {
224 void (*proc)(const void *);
225 void (*mtex_proc)(GLenum, const void *);
226 const GLubyte *ptr;
227 GLsizei skip;
228 GLint size;
229 GLenum type;
230 GLsizei stride;
231} __GLXvertexArrayPointerState;
232
233/**
234 * Define which entries of \c __GLXvertArrayState::arrays match which
235 * vertex arrays in the client-state vector. These are only the one-of
236 * arrays. See the \c __GLXvertArrayState::arrays documentation for more
237 * details.
238 *
239 * \sa __GLXvertArrayState
240 */
241enum {
242 edgeFlag_ARRAY, /**< \c GL_EDGE_FLAG_ARRAY */
243 index_ARRAY, /**< \c GL_INDEX_ARRAY */
244 fogCoord_ARRAY, /**< \c GL_FOG_COORD_ARRAY */
245 secondaryColor_ARRAY, /**< \c GL_SECONDARY_COLOR_ARRAY */
246 color_ARRAY, /**< \c GL_COLOR_ARRAY */
247 normal_ARRAY, /**< \c GL_NORMAL_ARRAY */
248
249 /**
250 * \c GL_VERTEX_ARRAY \b must be last! All of the code for emitting arrays
251 * and array elements is written based on the assumption that the vertex
252 * array is last.
253 */
254 vertex_ARRAY,
255
256 __GLX_MAX_ARRAYS /**< Place holder entry. */
257};
258
259#define ENABLE_ARRAY(state,a) \
260 do { (state)->vertArray.enables |= (1U << (a ## _ARRAY)); } while( 0 )
261#define DISABLE_ARRAY(state,a) \
262 do { (state)->vertArray.enables &= ~(1U << (a ## _ARRAY)); } while( 0 )
263#define IS_ARRAY_ENABLED_BY_INDEX(state, i) \
264 (((state)->vertArray.enables & (1U << (i))) != 0)
265#define IS_ARRAY_ENABLED(state, a) \
266 IS_ARRAY_ENABLED_BY_INDEX(state, a ## _ARRAY)
267
268#define ENABLE_TEXARRAY(state,a) \
269 do { (state)->vertArray.texture_enables |= (1U << a); } while( 0 )
270#define DISABLE_TEXARRAY(state,a) \
271 do { (state)->vertArray.texture_enables &= ~(1U << a); } while( 0 )
272#define IS_TEXARRAY_ENABLED(state, a) \
273 (((state)->vertArray.texture_enables & (1U << a)) != 0)
274
275/**
276 * Client-side vertex array state.
277 */
278typedef struct __GLXvertArrayStateRec {
279 /**
280 * Which client-side arrays are enabled? These are the flag bits for
281 * all of the non-texture coordinate arrays.
282 */
283 GLuint enables;
284
285 /**
286 * Which of the texture coordinate arrays are enabled?
287 */
288 GLuint texture_enables;
289
290 /**
291 * State for "one-of" arrays. These are the arrays, such as
292 * GL_COLOR_ARRAY or GL_FOG_COORD_ARRAY for which there is only one
293 * array. There are also "many-of" arrays, such as
294 * GL_TEXTURE_COORD_ARRAY.
295 */
296 __GLXvertexArrayPointerState arrays[__GLX_MAX_ARRAYS];
297
298 __GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS];
299
300 GLint maxElementsVertices;
301 GLint maxElementsIndices;
302 GLint activeTexture;
303} __GLXvertArrayState;
304
305typedef struct __GLXattributeRec {
306 GLuint mask;
307
308 /*
309 ** Pixel storage state. Most of the pixel store mode state is kept
310 ** here and used by the client code to manage the packing and
311 ** unpacking of data sent to/received from the server.
312 */
313 __GLXpixelStoreMode storePack, storeUnpack;
314
315 /*
316 ** Vertex Array storage state. The vertex array component
317 ** state is stored here and is used to manage the packing of
318 ** DrawArrays data sent to the server.
319 */
320 __GLXvertArrayState vertArray;
321
322 /**
323 * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
324 * disabled?
325 */
326 GLboolean NoDrawArraysProtocol;
327} __GLXattribute;
328
329typedef struct __GLXattributeMachineRec {
330 __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
331 __GLXattribute **stackPointer;
332} __GLXattributeMachine;
333
334/**
335 * GLX state that needs to be kept on the client. One of these records
336 * exist for each context that has been made current by this client.
337 */
338struct __GLXcontextRec {
339 /**
340 * \name Drawing command buffer.
341 *
342 * Drawing commands are packed into this buffer before being sent as a
343 * single GLX protocol request. The buffer is sent when it overflows or
344 * is flushed by \c __glXFlushRenderBuffer. \c pc is the next location
345 * in the buffer to be filled. \c limit is described above in the buffer
346 * slop discussion.
347 *
348 * Commands that require large amounts of data to be transfered will
349 * also use this buffer to hold a header that describes the large
350 * command.
351 *
352 * These must be the first 6 fields since they are static initialized
353 * in the dummy context in glxext.c
354 */
355 /*@{*/
356 GLubyte *buf;
357 GLubyte *pc;
358 GLubyte *limit;
359 GLubyte *bufEnd;
360 GLint bufSize;
361 /*@}*/
362
363 /**
364 * The XID of this rendering context. When the context is created a
365 * new XID is allocated. This is set to None when the context is
366 * destroyed but is still current to some thread. In this case the
367 * context will be freed on next MakeCurrent.
368 */
369 XID xid;
370
371 /**
372 * The XID of the \c shareList context.
373 */
374 XID share_xid;
375
376 /**
377 * Visual id.
378 *
379 * \deprecated
380 * This filed has been largely been replaced by the \c mode field, but
381 * the work is not quite done.
382 */
383 VisualID vid;
384
385 /**
386 * Screen number.
387 */
388 GLint screen;
389
390 /**
391 * \c GL_TRUE if the context was created with ImportContext, which
392 * means the server-side context was created by another X client.
393 */
394 GLboolean imported;
395
396 /**
397 * The context tag returned by MakeCurrent when this context is made
398 * current. This tag is used to identify the context that a thread has
399 * current so that proper server context management can be done. It is
400 * used for all context specific commands (i.e., \c Render, \c RenderLarge,
401 * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
402 * context)).
403 */
404 GLXContextTag currentContextTag;
405
406 /**
407 * \name Rendering mode
408 *
409 * The rendering mode is kept on the client as well as the server.
410 * When \c glRenderMode is called, the buffer associated with the
411 * previous rendering mode (feedback or select) is filled.
412 */
413 /*@{*/
414 GLenum renderMode;
415 GLfloat *feedbackBuf;
416 GLuint *selectBuf;
417 /*@}*/
418
419 /**
420 * This is \c GL_TRUE if the pixel unpack modes are such that an image
421 * can be unpacked from the clients memory by just copying. It may
422 * still be true that the server will have to do some work. This
423 * just promises that a straight copy will fetch the correct bytes.
424 */
425 GLboolean fastImageUnpack;
426
427 /**
428 * Fill newImage with the unpacked form of \c oldImage getting it
429 * ready for transport to the server.
430 */
431 void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
432 GLenum, const GLvoid*, GLubyte*, GLubyte*);
433
434 /**
435 * \name Client side attribs.
436 */
437 /*@{*/
438 __GLXattributeDEPRECATED stateDEPRECATED;
439 __GLXattributeMachine attributes;
440 /*@}*/
441
442 /**
443 * Client side error code. This is set when client side gl API
444 * routines need to set an error because of a bad enumerant or
445 * running out of memory, etc.
446 */
447 GLenum error;
448
449 /**
450 * Whether this context does direct rendering.
451 */
452 Bool isDirect;
453
454 /**
455 * \c dpy of current display for this context. Will be \c NULL if not
456 * current to any display, or if this is the "dummy context".
457 */
458 Display *currentDpy;
459
460 /**
461 * The current drawable for this context. Will be None if this
462 * context is not current to any drawable. currentReadable is below.
463 */
464 GLXDrawable currentDrawable;
465
466 /**
467 * \name GL Constant Strings
468 *
469 * Constant strings that describe the server implementation
470 * These pertain to GL attributes, not to be confused with
471 * GLX versioning attributes.
472 */
473 /*@{*/
474 GLubyte *vendor;
475 GLubyte *renderer;
476 GLubyte *version;
477 GLubyte *extensions;
478 /*@}*/
479
480 /**
481 * Record the dpy this context was created on for later freeing
482 */
483 Display *createDpy;
484
485 /**
486 * Maximum small render command size. This is the smaller of 64k and
487 * the size of the above buffer.
488 */
489 GLint maxSmallRenderCommandSize;
490
491 /**
492 * Major opcode for the extension. Copied here so a lookup isn't
493 * needed.
494 */
495 GLint majorOpcode;
496
497#ifdef GLX_DIRECT_RENDERING
498 /**
499 * Per context direct rendering interface functions and data.
500 */
501 __DRIcontext driContext;
502#endif
503
504 /**
505 * \c GLXFBConfigID used to create this context. May be \c None. This
506 * field has been replaced by the \c mode field.
507 *
508 * \since Internal API version 20030317.
509 *
510 * \deprecated
511 * This filed has been largely been replaced by the \c mode field, but
512 * the work is not quite done.
513 */
514 GLXFBConfigID fbconfigID;
515
516 /**
517 * The current read-drawable for this context. Will be None if this
518 * context is not current to any drawable.
519 *
520 * \since Internal API version 20030606.
521 */
522 GLXDrawable currentReadable;
523
524 /**
525 * Pointer to client-state data that is private to libGL. This is only
526 * used for indirect rendering contexts.
527 *
528 * No internal API version change was made for this change. Client-side
529 * drivers should NEVER use this data or even care that it exists.
530 */
531 void * client_state_private;
532
533 /**
534 * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
535 */
536 int renderType;
537
538 /**
539 * \name Raw server GL version
540 *
541 * True core GL version supported by the server. This is the raw value
542 * returned by the server, and it may not reflect what is actually
543 * supported (or reported) by the client-side library.
544 */
545 /*@{*/
546 int server_major; /**< Major version number. */
547 int server_minor; /**< Minor version number. */
548 /*@}*/
549};
550
551#define __glXSetError(gc,code) \
552 if (!(gc)->error) { \
553 (gc)->error = code; \
554 }
555
556extern void __glFreeAttributeState(__GLXcontext *);
557
558/************************************************************************/
559
560/**
561 * The size of the largest drawing command known to the implementation
562 * that will use the GLXRender GLX command. In this case it is
563 * \c glPolygonStipple.
564 */
565#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
566
567/**
568 * To keep the implementation fast, the code uses a "limit" pointer
569 * to determine when the drawing command buffer is too full to hold
570 * another fixed size command. This constant defines the amount of
571 * space that must always be available in the drawing command buffer
572 * at all times for the implementation to work. It is important that
573 * the number be just large enough, but not so large as to reduce the
574 * efficacy of the buffer. The "+32" is just to keep the code working
575 * in case somebody counts wrong.
576 */
577#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
578
579/**
580 * This implementation uses a smaller threshold for switching
581 * to the RenderLarge protocol than the protcol requires so that
582 * large copies don't occur.
583 */
584#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
585
586/**
587 * One of these records exists per screen of the display. It contains
588 * a pointer to the config data for that screen (if the screen supports GL).
589 */
590typedef struct __GLXscreenConfigsRec {
591 /**
592 * GLX visuals formated as \c __GLXvisualConfig structures.
593 */
594 /*@{*/
595 __GLXvisualConfig * old_configs;
596 int numOldConfigs;
597 /*@}*/
598
599 /**
600 * GLX extension string reported by the X-server.
601 */
602 const char *serverGLXexts;
603
604 /**
605 * GLX extension string to be reported to applications. This is the
606 * set of extensions that the application can actually use.
607 */
608 char *effectiveGLXexts;
609
610#ifdef GLX_DIRECT_RENDERING
611 /**
612 * Per screen direct rendering interface functions and data.
613 */
614 __DRIscreen driScreen;
615#endif
616
617 /**
618 * Linked list of configurations for this screen. This is intended to
619 * be a superset of \c old_configs.
620 */
621 __GLcontextModes *configs;
622 /**
623 * Per-screen dynamic GLX extension tracking. The \c direct_support
624 * field only contains enough bits for 64 extensions. Should libGL
625 * ever need to track more than 64 GLX extensions, we can safely grow
626 * this field. The \c __GLXscreenConfigs structure is not used outside
627 * libGL.
628 */
629 /*@{*/
630 unsigned char direct_support[8];
631 GLboolean ext_list_first_time;
632 /*@}*/
633
634} __GLXscreenConfigs;
635
636/**
637 * Per display private data. One of these records exists for each display
638 * that is using the OpenGL (GLX) extension.
639 */
640struct __GLXdisplayPrivateRec {
641 /**
642 * Back pointer to the display
643 */
644 Display *dpy;
645
646 /**
647 * The \c majorOpcode is common to all connections to the same server.
648 * It is also copied into the context structure.
649 */
650 int majorOpcode;
651
652 /**
653 * \name Server Version
654 *
655 * Major and minor version returned by the server during initialization.
656 */
657 /*@{*/
658 int majorVersion, minorVersion;
659 /*@}*/
660
661 /**
662 * \name Storage for the servers GLX vendor and versions strings.
663 *
664 * These are the same for all screens on this display. These fields will
665 * be filled in on demand.
666 */
667 /*@{*/
668 const char *serverGLXvendor;
669 const char *serverGLXversion;
670 /*@}*/
671
672 /**
673 * Configurations of visuals for all screens on this display.
674 * Also, per screen data which now includes the server \c GLX_EXTENSION
675 * string.
676 */
677 __GLXscreenConfigs *screenConfigs;
678
679#ifdef GLX_DIRECT_RENDERING
680 /**
681 * Per display direct rendering interface functions and data.
682 */
683 __DRIdisplay driDisplay;
684#endif
685};
686
687void __glXFreeContext(__GLXcontext*);
688
689extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*);
690
691extern void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber,
692 GLint totalRequests,
693 const GLvoid * data, GLint dataLen);
694
695extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
696 const GLvoid *, GLint);
697
698/* Initialize the GLX extension for dpy */
699extern __GLXdisplayPrivate *__glXInitialize(Display*);
700
701/************************************************************************/
702
703extern int __glXDebug;
704
705/* This is per-thread storage in an MT environment */
706#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
707extern __GLXcontext *__glXGetCurrentContext(void);
708extern void __glXSetCurrentContext(__GLXcontext *c);
709#else
710extern __GLXcontext *__glXcurrentContext;
711#define __glXGetCurrentContext() __glXcurrentContext
712#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
713#endif
714
715
716/*
717** Global lock for all threads in this address space using the GLX
718** extension
719*/
720#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
721extern xmutex_rec __glXmutex;
722#define __glXLock() xmutex_lock(&__glXmutex)
723#define __glXUnlock() xmutex_unlock(&__glXmutex)
724#else
725#define __glXLock()
726#define __glXUnlock()
727#endif
728
729/*
730** Setup for a command. Initialize the extension for dpy if necessary.
731*/
732extern CARD8 __glXSetupForCommand(Display *dpy);
733
734/************************************************************************/
735
736/*
737** Data conversion and packing support.
738*/
739
740/* Return the size, in bytes, of some pixel data */
741extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum);
742
743/* Return the number of elements per group of a specified format*/
744extern GLint __glElementsPerGroup(GLenum format, GLenum type);
745
746/* Return the number of bytes per element, based on the element type (other
747** than GL_BITMAP).
748*/
749extern GLint __glBytesPerElement(GLenum type);
750
751/* Return the k value for a given map target */
752extern GLint __glEvalComputeK(GLenum);
753
754/*
755** Fill the transport buffer with the data from the users buffer,
756** applying some of the pixel store modes (unpack modes) to the data
757** first. As a side effect of this call, the "modes" field is
758** updated to contain the modes needed by the server to decode the
759** sent data.
760*/
761extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
762 GLenum, const GLvoid*, GLubyte*, GLubyte*);
763
764/* Copy map data with a stride into a packed buffer */
765extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
766extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
767extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
768 const GLfloat *, GLfloat *);
769extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
770 const GLdouble *, GLdouble *);
771
772/*
773** Empty an image out of the reply buffer into the clients memory applying
774** the pack modes to pack back into the clients requested format.
775*/
776extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
777 GLenum, const GLubyte *, GLvoid *);
778
779
780/*
781** Allocate and Initialize Vertex Array client state
782*/
783extern void __glXInitVertexArrayState(__GLXcontext*);
784
785/*
786** Inform the Server of the major and minor numbers and of the client
787** libraries extension string.
788*/
789extern void __glXClientInfo ( Display *dpy, int opcode );
790
791/************************************************************************/
792
793/*
794** Declarations that should be in Xlib
795*/
796#ifdef __GL_USE_OUR_PROTOTYPES
797extern void _XFlush(Display*);
798extern Status _XReply(Display*, xReply*, int, Bool);
799extern void _XRead(Display*, void*, long);
800extern void _XSend(Display*, const void*, long);
801#endif
802
803
804/*
805** GLX_BUILT_IN_XMESA controls whether libGL has a built-in verions of
806** Mesa that can render to non-GLX displays.
807*/
808#ifdef GLX_BUILT_IN_XMESA
809#define GLX_PREFIX(function) _real_##function
810#else
811#define GLX_PREFIX(function) function
812#endif
813
814
815extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
816 int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );
817
818extern char * __glXGetStringFromServer( Display * dpy, int opcode,
819 CARD32 glxCode, CARD32 for_whom, CARD32 name );
820
821extern char *__glXstrdup(const char *str);
822
823
824extern const char __glXGLClientVersion[];
825extern const char __glXGLClientExtensions[];
826
827/* Determine the internal API version */
828extern int __glXGetInternalVersion(void);
829
830/* Get the unadjusted system time */
831extern int __glXGetUST( int64_t * ust );
832
833#endif /* !__GLX_client_h__ */