2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#ifndef _GLX_server_h_
|
|
|
|
#define _GLX_server_h_
|
|
|
|
|
|
|
|
/*
|
Update to SGI FreeB 2.0.
Under the terms of version 1.1, "once Covered Code has been published
under a particular version of the License, Recipient may, for the
duration of the License, continue to use it under the terms of that
version, or choose to use such Covered Code under the terms of any
subsequent version published by SGI."
FreeB 2.0 license refers to "dates of first publication". They are here
taken to be 1991-2000, as noted in the original license text:
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
Official FreeB 2.0 text:
http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf
As always, this code has not been tested for conformance with the OpenGL
specification. OpenGL conformance testing is available from
http://khronos.org/ and is required for use of the OpenGL logo in
product advertising and promotion.
2008-09-19 18:02:28 +02:00
|
|
|
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
|
|
|
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice including the dates of first publication and
|
|
|
|
* either this permission notice or a reference to
|
|
|
|
* http://oss.sgi.com/projects/FreeB/
|
|
|
|
* shall be included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of Silicon Graphics, Inc.
|
|
|
|
* shall not be used in advertising or otherwise to promote the sale, use or
|
|
|
|
* other dealings in this Software without prior written authorization from
|
|
|
|
* Silicon Graphics, Inc.
|
|
|
|
*/
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include <X11/Xmd.h>
|
|
|
|
#include <misc.h>
|
|
|
|
#include <dixstruct.h>
|
|
|
|
#include <pixmapstr.h>
|
|
|
|
#include <gcstruct.h>
|
|
|
|
#include <extnsionst.h>
|
|
|
|
#include <resource.h>
|
|
|
|
#include <scrnintstr.h>
|
|
|
|
|
|
|
|
#include <GL/gl.h>
|
2013-07-10 16:00:46 +02:00
|
|
|
#include <GL/glext.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
#include <GL/glxproto.h>
|
|
|
|
|
2018-02-20 17:03:45 +01:00
|
|
|
#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB
|
|
|
|
#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
|
|
|
|
#endif
|
|
|
|
|
2009-07-16 15:01:17 +02:00
|
|
|
/*
|
|
|
|
** GLX resources.
|
|
|
|
*/
|
|
|
|
typedef XID GLXContextID;
|
|
|
|
typedef XID GLXDrawable;
|
|
|
|
|
|
|
|
typedef struct __GLXclientStateRec __GLXclientState;
|
2006-03-12 01:11:34 +01:00
|
|
|
typedef struct __GLXdrawable __GLXdrawable;
|
|
|
|
typedef struct __GLXcontext __GLXcontext;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#include "glxscreens.h"
|
|
|
|
#include "glxdrawable.h"
|
|
|
|
#include "glxcontext.h"
|
2018-01-10 19:05:43 +01:00
|
|
|
#include "glx_extinit.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2007-05-31 05:25:03 +02:00
|
|
|
extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
|
|
|
|
extern __GLXclientState *glxGetClient(ClientPtr pClient);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void __glXScreenInitVisuals(__GLXscreen * screen);
|
2006-03-12 01:11:34 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
** The last context used (from the server's persective) is cached.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
|
|
|
|
int *);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-06-29 06:05:01 +02:00
|
|
|
int __glXError(int error);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/************************************************************************/
|
|
|
|
|
2007-10-19 03:01:51 +02:00
|
|
|
enum {
|
|
|
|
GLX_MINIMAL_VISUALS,
|
|
|
|
GLX_TYPICAL_VISUALS,
|
|
|
|
GLX_ALL_VISUALS
|
|
|
|
};
|
|
|
|
|
2006-09-07 21:35:16 +02:00
|
|
|
void glxSuspendClients(void);
|
|
|
|
void glxResumeClients(void);
|
|
|
|
|
2013-12-03 21:01:44 +01:00
|
|
|
typedef void (*glx_func_ptr)(void);
|
|
|
|
typedef glx_func_ptr (*glx_gpa_proc)(const char *);
|
|
|
|
void __glXsetGetProcAddress(glx_gpa_proc get_proc_address);
|
2013-07-10 16:00:46 +02:00
|
|
|
void *__glGetProcAddress(const char *);
|
|
|
|
|
2013-11-22 07:48:31 +01:00
|
|
|
void
|
|
|
|
__glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
|
|
|
|
CARD64 msc, CARD32 sbc);
|
|
|
|
|
|
|
|
#if PRESENT
|
|
|
|
void
|
|
|
|
__glXregisterPresentCompleteNotify(void);
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
** State kept per client.
|
|
|
|
*/
|
|
|
|
struct __GLXclientStateRec {
|
|
|
|
/*
|
2012-03-21 20:55:09 +01:00
|
|
|
** Buffer for returned data.
|
|
|
|
*/
|
2003-11-14 17:48:57 +01:00
|
|
|
GLbyte *returnBuf;
|
|
|
|
GLint returnBufSize;
|
|
|
|
|
|
|
|
/* Back pointer to X client record */
|
|
|
|
ClientPtr client;
|
|
|
|
|
|
|
|
char *GLClientextensions;
|
|
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Dispatch tables.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
|
|
|
|
typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
|
|
|
|
typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Tables for computing the size of each rendering command.
|
|
|
|
*/
|
2014-11-10 18:13:48 +01:00
|
|
|
typedef int (*gl_proto_size_func) (const GLbyte *, Bool, int);
|
2006-08-23 22:30:13 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
typedef struct {
|
|
|
|
int bytes;
|
2006-08-23 22:30:13 +02:00
|
|
|
gl_proto_size_func varsize;
|
2003-11-14 17:48:57 +01:00
|
|
|
} __GLXrenderSizeData;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
** X resources.
|
|
|
|
*/
|
|
|
|
extern RESTYPE __glXContextRes;
|
|
|
|
extern RESTYPE __glXClientRes;
|
|
|
|
extern RESTYPE __glXDrawableRes;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines for computing the size of variably-sized rendering commands.
|
|
|
|
*/
|
|
|
|
|
2014-11-10 18:13:40 +01:00
|
|
|
static _X_INLINE int
|
|
|
|
safe_add(int a, int b)
|
|
|
|
{
|
|
|
|
if (a < 0 || b < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (INT_MAX - a < b)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return a + b;
|
|
|
|
}
|
|
|
|
|
|
|
|
static _X_INLINE int
|
|
|
|
safe_mul(int a, int b)
|
|
|
|
{
|
|
|
|
if (a < 0 || b < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (a == 0 || b == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (a > INT_MAX / b)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return a * b;
|
|
|
|
}
|
|
|
|
|
|
|
|
static _X_INLINE int
|
|
|
|
safe_pad(int a)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if ((ret = safe_add(a, 3)) < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return ret & (GLuint)~3;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
extern int __glXTypeSize(GLenum enm);
|
2005-10-02 00:25:13 +02:00
|
|
|
extern int __glXImageSize(GLenum format, GLenum type,
|
2012-03-21 20:55:09 +01:00
|
|
|
GLenum target, GLsizei w, GLsizei h, GLsizei d,
|
|
|
|
GLint imageHeight, GLint rowLength, GLint skipImages,
|
|
|
|
GLint skipRows, GLint alignment);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2009-09-30 01:43:43 +02:00
|
|
|
extern unsigned glxMajorVersion;
|
|
|
|
extern unsigned glxMinorVersion;
|
|
|
|
|
2010-01-11 20:56:24 +01:00
|
|
|
extern int __glXEventBase;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
#endif /* !__GLX_server_h__ */
|