1706f2543Smrg#ifdef HAVE_DIX_CONFIG_H
2706f2543Smrg#include <dix-config.h>
3706f2543Smrg#endif
4706f2543Smrg
5706f2543Smrg#ifndef _GLX_context_h_
6706f2543Smrg#define _GLX_context_h_
7706f2543Smrg
8706f2543Smrg/*
9706f2543Smrg * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
10706f2543Smrg * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
11706f2543Smrg *
12706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
13706f2543Smrg * copy of this software and associated documentation files (the "Software"),
14706f2543Smrg * to deal in the Software without restriction, including without limitation
15706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
17706f2543Smrg * Software is furnished to do so, subject to the following conditions:
18706f2543Smrg *
19706f2543Smrg * The above copyright notice including the dates of first publication and
20706f2543Smrg * either this permission notice or a reference to
21706f2543Smrg * http://oss.sgi.com/projects/FreeB/
22706f2543Smrg * shall be included in all copies or substantial portions of the Software.
23706f2543Smrg *
24706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25706f2543Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27706f2543Smrg * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28706f2543Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
29706f2543Smrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30706f2543Smrg * SOFTWARE.
31706f2543Smrg *
32706f2543Smrg * Except as contained in this notice, the name of Silicon Graphics, Inc.
33706f2543Smrg * shall not be used in advertising or otherwise to promote the sale, use or
34706f2543Smrg * other dealings in this Software without prior written authorization from
35706f2543Smrg * Silicon Graphics, Inc.
36706f2543Smrg */
37706f2543Smrg
38706f2543Smrgtypedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
39706f2543Smrgstruct __GLXtextureFromPixmap {
40706f2543Smrg    int (*bindTexImage)		(__GLXcontext  *baseContext,
41706f2543Smrg				 int            buffer,
42706f2543Smrg				 __GLXdrawable *pixmap);
43706f2543Smrg    int (*releaseTexImage)	(__GLXcontext  *baseContext,
44706f2543Smrg				 int            buffer,
45706f2543Smrg				 __GLXdrawable *pixmap);
46706f2543Smrg};
47706f2543Smrg
48706f2543Smrg
49706f2543Smrgstruct __GLXcontext {
50706f2543Smrg    void           (*destroy)       (__GLXcontext *context);
51706f2543Smrg    int            (*makeCurrent)   (__GLXcontext *context);
52706f2543Smrg    int            (*loseCurrent)   (__GLXcontext *context);
53706f2543Smrg    int            (*copy)          (__GLXcontext *dst,
54706f2543Smrg				     __GLXcontext *src,
55706f2543Smrg				     unsigned long mask);
56706f2543Smrg    int            (*forceCurrent)  (__GLXcontext *context);
57706f2543Smrg
58706f2543Smrg    Bool           (*wait)          (__GLXcontext *context,
59706f2543Smrg				     __GLXclientState *cl,
60706f2543Smrg				     int *error);
61706f2543Smrg
62706f2543Smrg    __GLXtextureFromPixmap *textureFromPixmap;
63706f2543Smrg
64706f2543Smrg    /*
65706f2543Smrg    ** list of context structs
66706f2543Smrg    */
67706f2543Smrg    __GLXcontext *last;
68706f2543Smrg    __GLXcontext *next;
69706f2543Smrg
70706f2543Smrg    /*
71706f2543Smrg    ** config struct for this context
72706f2543Smrg    */
73706f2543Smrg    __GLXconfig *config;
74706f2543Smrg
75706f2543Smrg    /*
76706f2543Smrg    ** Pointer to screen info data for this context.  This is set
77706f2543Smrg    ** when the context is created.
78706f2543Smrg    */
79706f2543Smrg    __GLXscreen *pGlxScreen;
80706f2543Smrg
81706f2543Smrg    /*
82706f2543Smrg    ** The XID of this context.
83706f2543Smrg    */
84706f2543Smrg    XID id;
85706f2543Smrg
86706f2543Smrg    /*
87706f2543Smrg    ** The XID of the shareList context.
88706f2543Smrg    */
89706f2543Smrg    XID share_id;
90706f2543Smrg
91706f2543Smrg    /*
92706f2543Smrg    ** Whether this context's ID still exists.
93706f2543Smrg    */
94706f2543Smrg    GLboolean idExists;
95706f2543Smrg
96706f2543Smrg    /*
97706f2543Smrg    ** Whether this context is current for some client.
98706f2543Smrg    */
99706f2543Smrg    GLboolean isCurrent;
100706f2543Smrg
101706f2543Smrg    /*
102706f2543Smrg    ** Whether this context is a direct rendering context.
103706f2543Smrg    */
104706f2543Smrg    GLboolean isDirect;
105706f2543Smrg
106706f2543Smrg    /*
107706f2543Smrg    ** This flag keeps track of whether there are unflushed GL commands.
108706f2543Smrg    */
109706f2543Smrg    GLboolean hasUnflushedCommands;
110706f2543Smrg
111706f2543Smrg    /*
112706f2543Smrg    ** Current rendering mode for this context.
113706f2543Smrg    */
114706f2543Smrg    GLenum renderMode;
115706f2543Smrg
116706f2543Smrg    /*
117706f2543Smrg    ** Buffers for feedback and selection.
118706f2543Smrg    */
119706f2543Smrg    GLfloat *feedbackBuf;
120706f2543Smrg    GLint feedbackBufSize;	/* number of elements allocated */
121706f2543Smrg    GLuint *selectBuf;
122706f2543Smrg    GLint selectBufSize;	/* number of elements allocated */
123706f2543Smrg
124706f2543Smrg    /*
125706f2543Smrg    ** The drawable private this context is bound to
126706f2543Smrg    */
127706f2543Smrg    __GLXdrawable *drawPriv;
128706f2543Smrg    __GLXdrawable *readPriv;
129706f2543Smrg};
130706f2543Smrg
131706f2543Smrgvoid __glXContextDestroy(__GLXcontext *context);
132706f2543Smrg
133706f2543Smrg#endif /* !__GLX_context_h__ */
134