1 #ifdef HAVE_DIX_CONFIG_H
2 #include <dix-config.h>
3 #endif
4 
5 #ifndef _GLX_context_h_
6 #define _GLX_context_h_
7 
8 /*
9  * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
10  * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice including the dates of first publication and
20  * either this permission notice or a reference to
21  * http://oss.sgi.com/projects/FreeB/
22  * shall be included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27  * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
29  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30  * SOFTWARE.
31  *
32  * Except as contained in this notice, the name of Silicon Graphics, Inc.
33  * shall not be used in advertising or otherwise to promote the sale, use or
34  * other dealings in this Software without prior written authorization from
35  * Silicon Graphics, Inc.
36  */
37 
38 struct __GLXcontext {
39     void (*destroy) (__GLXcontext * context);
40     int (*makeCurrent) (__GLXcontext * context);
41     int (*loseCurrent) (__GLXcontext * context);
42     int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask);
43     Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error);
44 
45     /* EXT_texture_from_pixmap */
46     int (*bindTexImage) (__GLXcontext * baseContext,
47                          int buffer, __GLXdrawable * pixmap);
48     int (*releaseTexImage) (__GLXcontext * baseContext,
49                             int buffer, __GLXdrawable * pixmap);
50 
51     /*
52      ** list of context structs
53      */
54     __GLXcontext *next;
55 
56     /*
57      ** config struct for this context
58      */
59     __GLXconfig *config;
60 
61     /*
62      ** Pointer to screen info data for this context.  This is set
63      ** when the context is created.
64      */
65     __GLXscreen *pGlxScreen;
66 
67     /*
68      ** If this context is current for a client, this will be that client
69      */
70     ClientPtr currentClient;
71 
72     /*
73      ** The XID of this context.
74      */
75     XID id;
76 
77     /*
78      ** The XID of the shareList context.
79      */
80     XID share_id;
81 
82     /*
83      ** Whether this context's ID still exists.
84      */
85     GLboolean idExists;
86 
87     /*
88      ** Whether this context is a direct rendering context.
89      */
90     GLboolean isDirect;
91 
92     /*
93      ** Current rendering mode for this context.
94      */
95     GLenum renderMode;
96 
97     /**
98      * Reset notification strategy used when a GPU reset occurs.
99      */
100     GLenum resetNotificationStrategy;
101 
102     /**
103      * Context release behavior
104      */
105     GLenum releaseBehavior;
106 
107     /**
108      * Context render type
109      */
110     int renderType;
111 
112     /*
113      ** Buffers for feedback and selection.
114      */
115     GLfloat *feedbackBuf;
116     GLint feedbackBufSize;      /* number of elements allocated */
117     GLuint *selectBuf;
118     GLint selectBufSize;        /* number of elements allocated */
119 
120     /*
121      ** Keep track of large rendering commands, which span multiple requests.
122      */
123     GLint largeCmdBytesSoFar;   /* bytes received so far        */
124     GLint largeCmdBytesTotal;   /* total bytes expected         */
125     GLint largeCmdRequestsSoFar;        /* requests received so far     */
126     GLint largeCmdRequestsTotal;        /* total requests expected      */
127     GLbyte *largeCmdBuf;
128     GLint largeCmdBufSize;
129 
130     /*
131      ** The drawable private this context is bound to
132      */
133     __GLXdrawable *drawPriv;
134     __GLXdrawable *readPriv;
135 };
136 
137 void __glXContextDestroy(__GLXcontext * context);
138 
139 extern int validGlxScreen(ClientPtr client, int screen,
140                           __GLXscreen ** pGlxScreen, int *err);
141 
142 extern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen,
143                             XID id, __GLXconfig ** config, int *err);
144 
145 extern int validGlxContext(ClientPtr client, XID id, int access_mode,
146                            __GLXcontext ** context, int *err);
147 
148 extern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen,
149                                               __GLXconfig * modes,
150                                               __GLXcontext * shareContext);
151 
152 #endif                          /* !__GLX_context_h__ */
153