14642e01fSmrg#ifdef HAVE_DIX_CONFIG_H
24642e01fSmrg#include <dix-config.h>
34642e01fSmrg#endif
44642e01fSmrg
54642e01fSmrg#ifndef _GLX_context_h_
64642e01fSmrg#define _GLX_context_h_
74642e01fSmrg
84642e01fSmrg/*
94642e01fSmrg * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
104642e01fSmrg * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
114642e01fSmrg *
124642e01fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
134642e01fSmrg * copy of this software and associated documentation files (the "Software"),
144642e01fSmrg * to deal in the Software without restriction, including without limitation
154642e01fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
164642e01fSmrg * and/or sell copies of the Software, and to permit persons to whom the
174642e01fSmrg * Software is furnished to do so, subject to the following conditions:
184642e01fSmrg *
194642e01fSmrg * The above copyright notice including the dates of first publication and
204642e01fSmrg * either this permission notice or a reference to
214642e01fSmrg * http://oss.sgi.com/projects/FreeB/
224642e01fSmrg * shall be included in all copies or substantial portions of the Software.
234642e01fSmrg *
244642e01fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
254642e01fSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
264642e01fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
274642e01fSmrg * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
284642e01fSmrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
294642e01fSmrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
304642e01fSmrg * SOFTWARE.
314642e01fSmrg *
324642e01fSmrg * Except as contained in this notice, the name of Silicon Graphics, Inc.
334642e01fSmrg * shall not be used in advertising or otherwise to promote the sale, use or
344642e01fSmrg * other dealings in this Software without prior written authorization from
354642e01fSmrg * Silicon Graphics, Inc.
364642e01fSmrg */
374642e01fSmrg
384642e01fSmrgstruct __GLXcontext {
3935c4bbdfSmrg    void (*destroy) (__GLXcontext * context);
4035c4bbdfSmrg    int (*makeCurrent) (__GLXcontext * context);
4135c4bbdfSmrg    int (*loseCurrent) (__GLXcontext * context);
4235c4bbdfSmrg    int (*copy) (__GLXcontext * dst, __GLXcontext * src, unsigned long mask);
4335c4bbdfSmrg    Bool (*wait) (__GLXcontext * context, __GLXclientState * cl, int *error);
446747b715Smrg
451b5d61b8Smrg    /* EXT_texture_from_pixmap */
461b5d61b8Smrg    int (*bindTexImage) (__GLXcontext * baseContext,
471b5d61b8Smrg                         int buffer, __GLXdrawable * pixmap);
481b5d61b8Smrg    int (*releaseTexImage) (__GLXcontext * baseContext,
491b5d61b8Smrg                            int buffer, __GLXdrawable * pixmap);
504642e01fSmrg
514642e01fSmrg    /*
5235c4bbdfSmrg     ** list of context structs
5335c4bbdfSmrg     */
544642e01fSmrg    __GLXcontext *next;
554642e01fSmrg
564642e01fSmrg    /*
5735c4bbdfSmrg     ** config struct for this context
5835c4bbdfSmrg     */
594642e01fSmrg    __GLXconfig *config;
604642e01fSmrg
614642e01fSmrg    /*
6235c4bbdfSmrg     ** Pointer to screen info data for this context.  This is set
6335c4bbdfSmrg     ** when the context is created.
6435c4bbdfSmrg     */
654642e01fSmrg    __GLXscreen *pGlxScreen;
664642e01fSmrg
674642e01fSmrg    /*
6835c4bbdfSmrg     ** If this context is current for a client, this will be that client
6935c4bbdfSmrg     */
7035c4bbdfSmrg    ClientPtr currentClient;
7135c4bbdfSmrg
7235c4bbdfSmrg    /*
7335c4bbdfSmrg     ** The XID of this context.
7435c4bbdfSmrg     */
754642e01fSmrg    XID id;
764642e01fSmrg
774642e01fSmrg    /*
7835c4bbdfSmrg     ** The XID of the shareList context.
7935c4bbdfSmrg     */
804642e01fSmrg    XID share_id;
814642e01fSmrg
824642e01fSmrg    /*
8335c4bbdfSmrg     ** Whether this context's ID still exists.
8435c4bbdfSmrg     */
854642e01fSmrg    GLboolean idExists;
8635c4bbdfSmrg
874642e01fSmrg    /*
8835c4bbdfSmrg     ** Whether this context is a direct rendering context.
8935c4bbdfSmrg     */
904642e01fSmrg    GLboolean isDirect;
914642e01fSmrg
924642e01fSmrg    /*
9335c4bbdfSmrg     ** Current rendering mode for this context.
9435c4bbdfSmrg     */
954642e01fSmrg    GLenum renderMode;
9635c4bbdfSmrg
9735c4bbdfSmrg    /**
9835c4bbdfSmrg     * Reset notification strategy used when a GPU reset occurs.
9935c4bbdfSmrg     */
10035c4bbdfSmrg    GLenum resetNotificationStrategy;
10135c4bbdfSmrg
10235c4bbdfSmrg    /**
10335c4bbdfSmrg     * Context release behavior
10435c4bbdfSmrg     */
10535c4bbdfSmrg    GLenum releaseBehavior;
10635c4bbdfSmrg
107ed6184dfSmrg    /**
108ed6184dfSmrg     * Context render type
109ed6184dfSmrg     */
110ed6184dfSmrg    int renderType;
111ed6184dfSmrg
1124642e01fSmrg    /*
11335c4bbdfSmrg     ** Buffers for feedback and selection.
11435c4bbdfSmrg     */
1154642e01fSmrg    GLfloat *feedbackBuf;
11635c4bbdfSmrg    GLint feedbackBufSize;      /* number of elements allocated */
1174642e01fSmrg    GLuint *selectBuf;
11835c4bbdfSmrg    GLint selectBufSize;        /* number of elements allocated */
1194642e01fSmrg
1201b5d61b8Smrg    /*
1211b5d61b8Smrg     ** Keep track of large rendering commands, which span multiple requests.
1221b5d61b8Smrg     */
1231b5d61b8Smrg    GLint largeCmdBytesSoFar;   /* bytes received so far        */
1241b5d61b8Smrg    GLint largeCmdBytesTotal;   /* total bytes expected         */
1251b5d61b8Smrg    GLint largeCmdRequestsSoFar;        /* requests received so far     */
1261b5d61b8Smrg    GLint largeCmdRequestsTotal;        /* total requests expected      */
1271b5d61b8Smrg    GLbyte *largeCmdBuf;
1281b5d61b8Smrg    GLint largeCmdBufSize;
1291b5d61b8Smrg
1304642e01fSmrg    /*
13135c4bbdfSmrg     ** The drawable private this context is bound to
13235c4bbdfSmrg     */
1334642e01fSmrg    __GLXdrawable *drawPriv;
1344642e01fSmrg    __GLXdrawable *readPriv;
1354642e01fSmrg};
1364642e01fSmrg
13735c4bbdfSmrgvoid __glXContextDestroy(__GLXcontext * context);
13835c4bbdfSmrg
13935c4bbdfSmrgextern int validGlxScreen(ClientPtr client, int screen,
14035c4bbdfSmrg                          __GLXscreen ** pGlxScreen, int *err);
14135c4bbdfSmrg
14235c4bbdfSmrgextern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen,
14335c4bbdfSmrg                            XID id, __GLXconfig ** config, int *err);
14435c4bbdfSmrg
14535c4bbdfSmrgextern int validGlxContext(ClientPtr client, XID id, int access_mode,
14635c4bbdfSmrg                           __GLXcontext ** context, int *err);
14735c4bbdfSmrg
14835c4bbdfSmrgextern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen,
14935c4bbdfSmrg                                              __GLXconfig * modes,
15035c4bbdfSmrg                                              __GLXcontext * shareContext);
1514642e01fSmrg
15235c4bbdfSmrg#endif                          /* !__GLX_context_h__ */
153