📄 glxclient.h
字号:
/* * 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. *//** * \file glxclient.h * Direct rendering support added by Precision Insight, Inc. * * \author Kevin E. Martin <kevin@precisioninsight.com> */#ifndef _GLX_client_h_#define _GLX_client_h_#define NEED_REPLIES#define NEED_EVENTS#include <X11/Xproto.h>#include <X11/Xlibint.h>#define GLX_GLXEXT_PROTOTYPES#include <GL/glx.h>#include <GL/glxext.h>#include <string.h>#include <stdlib.h>#include <stdio.h>#ifdef WIN32#include <stdint.h>#endif#include "GL/glxint.h"#include "GL/glxproto.h"#include "GL/internal/glcore.h"#include "glapitable.h"#include "glxhash.h"#if defined( USE_XTHREADS )# include <X11/Xthreads.h>#elif defined( PTHREADS )# include <pthread.h>#endif#include "glxextensions.h"#define GLX_MAJOR_VERSION 1 /* current version numbers */#define GLX_MINOR_VERSION 4#define __GLX_MAX_TEXTURE_UNITS 32typedef struct __GLXscreenConfigsRec __GLXscreenConfigs;typedef struct __GLXcontextRec __GLXcontext;typedef struct __GLXdrawableRec __GLXdrawable;typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;typedef struct _glapi_table __GLapi;/************************************************************************/#ifdef GLX_DIRECT_RENDERING#define containerOf(ptr, type, member) \ (type *)( (char *)ptr - offsetof(type,member) )#include <GL/internal/dri_interface.h>/** * Display dependent methods. This structure is initialized during the * \c driCreateDisplay call. */typedef struct __GLXDRIdisplayRec __GLXDRIdisplay;typedef struct __GLXDRIscreenRec __GLXDRIscreen;typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;typedef struct __GLXDRIcontextRec __GLXDRIcontext;#include "glxextensions.h"struct __GLXDRIdisplayRec { /** * Method to destroy the private DRI display data. */ void (*destroyDisplay)(__GLXDRIdisplay *display); __GLXDRIscreen *(*createScreen)(__GLXscreenConfigs *psc, int screen, __GLXdisplayPrivate *priv);};struct __GLXDRIscreenRec { void (*destroyScreen)(__GLXscreenConfigs *psc); __GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc, const __GLcontextModes *mode, GLXContext gc, GLXContext shareList, int renderType); __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc, XID drawable, GLXDrawable glxDrawable, const __GLcontextModes *modes);};struct __GLXDRIcontextRec { void (*destroyContext)(__GLXDRIcontext *context, __GLXscreenConfigs *psc, Display *dpy); Bool (*bindContext)(__GLXDRIcontext *context, __GLXDRIdrawable *pdraw, __GLXDRIdrawable *pread); void (*unbindContext)(__GLXDRIcontext *context);};struct __GLXDRIdrawableRec { void (*destroyDrawable)(__GLXDRIdrawable *drawable); XID xDrawable; XID drawable; __GLXscreenConfigs *psc; __DRIdrawable *driDrawable; GLenum textureTarget;};/*** Function to create and DRI display data and initialize the display** dependent methods.*/extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy);extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );/*** Functions to obtain driver configuration information from a direct** rendering client application*/extern const char *glXGetScreenDriver (Display *dpy, int scrNum);extern const char *glXGetDriverConfig (const char *driverName);#endif/************************************************************************/#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16typedef struct __GLXpixelStoreModeRec { GLboolean swapEndian; GLboolean lsbFirst; GLuint rowLength; GLuint imageHeight; GLuint imageDepth; GLuint skipRows; GLuint skipPixels; GLuint skipImages; GLuint alignment;} __GLXpixelStoreMode;typedef struct __GLXattributeRec { GLuint mask; /** * Pixel storage state. Most of the pixel store mode state is kept * here and used by the client code to manage the packing and * unpacking of data sent to/received from the server. */ __GLXpixelStoreMode storePack, storeUnpack; /** * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically * disabled? */ GLboolean NoDrawArraysProtocol; /** * Vertex Array storage state. The vertex array component * state is stored here and is used to manage the packing of * DrawArrays data sent to the server. */ struct array_state_vector * array_state;} __GLXattribute;typedef struct __GLXattributeMachineRec { __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; __GLXattribute **stackPointer;} __GLXattributeMachine;/** * GLX state that needs to be kept on the client. One of these records * exist for each context that has been made current by this client. */struct __GLXcontextRec { /** * \name Drawing command buffer. * * Drawing commands are packed into this buffer before being sent as a * single GLX protocol request. The buffer is sent when it overflows or * is flushed by \c __glXFlushRenderBuffer. \c pc is the next location * in the buffer to be filled. \c limit is described above in the buffer * slop discussion. * * Commands that require large amounts of data to be transfered will * also use this buffer to hold a header that describes the large * command. * * These must be the first 6 fields since they are static initialized * in the dummy context in glxext.c */ /*@{*/ GLubyte *buf; GLubyte *pc; GLubyte *limit; GLubyte *bufEnd; GLint bufSize; /*@}*/ /** * The XID of this rendering context. When the context is created a * new XID is allocated. This is set to None when the context is * destroyed but is still current to some thread. In this case the * context will be freed on next MakeCurrent. */ XID xid; /** * The XID of the \c shareList context. */ XID share_xid; /** * Screen number. */ GLint screen; __GLXscreenConfigs *psc; /** * \c GL_TRUE if the context was created with ImportContext, which * means the server-side context was created by another X client. */ GLboolean imported; /** * The context tag returned by MakeCurrent when this context is made * current. This tag is used to identify the context that a thread has * current so that proper server context management can be done. It is * used for all context specific commands (i.e., \c Render, \c RenderLarge, * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old * context)). */ GLXContextTag currentContextTag; /** * \name Rendering mode * * The rendering mode is kept on the client as well as the server. * When \c glRenderMode is called, the buffer associated with the * previous rendering mode (feedback or select) is filled. */ /*@{*/ GLenum renderMode; GLfloat *feedbackBuf; GLuint *selectBuf; /*@}*/ /** * This is \c GL_TRUE if the pixel unpack modes are such that an image * can be unpacked from the clients memory by just copying. It may * still be true that the server will have to do some work. This * just promises that a straight copy will fetch the correct bytes. */ GLboolean fastImageUnpack; /** * Fill newImage with the unpacked form of \c oldImage getting it * ready for transport to the server. */ void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, GLenum, const GLvoid*, GLubyte*, GLubyte*); /** * Client side attribs. */ __GLXattributeMachine attributes; /** * Client side error code. This is set when client side gl API * routines need to set an error because of a bad enumerant or * running out of memory, etc. */ GLenum error; /** * Whether this context does direct rendering. */ Bool isDirect; /** * \c dpy of current display for this context. Will be \c NULL if not * current to any display, or if this is the "dummy context". */ Display *currentDpy; /** * The current drawable for this context. Will be None if this * context is not current to any drawable. currentReadable is below. */ GLXDrawable currentDrawable; /** * \name GL Constant Strings * * Constant strings that describe the server implementation * These pertain to GL attributes, not to be confused with * GLX versioning attributes. */ /*@{*/ GLubyte *vendor; GLubyte *renderer; GLubyte *version; GLubyte *extensions; /*@}*/ /** * Record the dpy this context was created on for later freeing */ Display *createDpy; /** * Maximum small render command size. This is the smaller of 64k and * the size of the above buffer. */ GLint maxSmallRenderCommandSize; /** * Major opcode for the extension. Copied here so a lookup isn't * needed. */ GLint majorOpcode; /** * Pointer to the mode used to create this context. */ const __GLcontextModes * mode;#ifdef GLX_DIRECT_RENDERING __GLXDRIcontext *driContext; __DRIcontext *__driContext;#endif /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -