libglvnd/src/GLX/libglxmapping.h

140 lines
5.6 KiB
C
Raw Normal View History

2013-08-23 01:06:53 +02:00
/*
* Copyright (c) 2013, NVIDIA CORPORATION.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* unaltered in all copies or substantial portions of the Materials.
* Any additions, deletions, or changes to the original source files
* must be clearly indicated in accompanying documentation.
*
* If only executable code is distributed, then the accompanying
* documentation must state that "this software is based in part on the
* work of the Khronos Group."
*
* THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
2013-08-23 01:06:53 +02:00
*/
#if !defined(__LIB_GLX_MAPPING_H)
#define __LIB_GLX_MAPPING_H
#include "libglxabipriv.h"
#include "GLdispatch.h"
#include "lkdhash.h"
2013-08-23 01:06:53 +02:00
#define GLX_CLIENT_STRING_LAST_ATTRIB GLX_EXTENSIONS
typedef struct __GLXdispatchTableDynamicRec __GLXdispatchTableDynamic;
/*!
* Structure containing relevant per-vendor information.
*/
struct __GLXvendorInfoRec {
int vendorID; //< unique GLdispatch ID
char *name; //< name of the vendor
void *dlhandle; //< shared library handle
const __GLXdispatchTableStatic *staticDispatch; //< static GLX dispatch table
__GLXdispatchTableDynamic *dynDispatch; //< dynamic GLX dispatch table
__GLdispatchTable *glDispatch; //< GL dispatch table
};
typedef struct __GLXscreenXIDMappingHashRec __GLXscreenXIDMappingHash;
/*!
* Structure containing per-display information.
*/
typedef struct __GLXdisplayInfoRec {
char *clientStrings[GLX_CLIENT_STRING_LAST_ATTRIB];
DEFINE_LKDHASH(__GLXscreenXIDMappingHash, xidScreenHash);
int x11glvndSupported;
int x11glvndMajor;
int x11glvndMinor;
} __GLXdisplayInfo;
/*!
* Accessor functions used to retrieve the "current" dispatch table for each of
* the three types of dispatch tables (see libglxabi.h for an explanation of
* these types).
*/
const __GLXdispatchTableStatic * __glXGetStaticDispatch(Display *dpy,
const int screen);
__GLXvendorInfo *__glXGetDynDispatch(Display *dpy,
const int screen);
__GLdispatchTable *__glXGetGLDispatch(Display *dpy, const int screen);
2013-08-23 01:06:53 +02:00
__GLXvendorInfo *__glXGetDrawableDynDispatch(Display *dpy,
GLXDrawable drawable);
const __GLXdispatchTableStatic * __glXGetDrawableStaticDispatch(Display *dpy,
GLXDrawable drawable);
/*!
* Various functions to manage mappings used to determine the screen
* of a particular GLX call.
*/
void __glXAddScreenContextMapping(Display *dpy, GLXContext context, int screen, __GLXvendorInfo *vendor);
void __glXRemoveScreenContextMapping(Display *dpy, GLXContext context);
2013-08-23 01:06:53 +02:00
int __glXScreenFromContext(GLXContext context);
int __glXVendorFromContext(Display *dpy, GLXContext context, int *retScreen, __GLXvendorInfo **retVendor);
2013-08-23 01:06:53 +02:00
void __glXAddScreenFBConfigMapping(Display *dpy, GLXFBConfig config, int screen, __GLXvendorInfo *vendor);
void __glXRemoveScreenFBConfigMapping(Display *dpy, GLXFBConfig config);
2013-08-23 01:06:53 +02:00
int __glXScreenFromFBConfig(GLXFBConfig config);
int __glXVendorFromFBConfig(Display *dpy, GLXFBConfig config, int *retScreen, __GLXvendorInfo **retVendor);
2013-08-23 01:06:53 +02:00
void __glXAddScreenVisualMapping(Display *dpy, const XVisualInfo *visual, __GLXvendorInfo *vendor);
void __glXRemoveScreenVisualMapping(Display *dpy, const XVisualInfo *visual);
int __glXVendorFromVisual(Display *dpy, const XVisualInfo *visual, __GLXvendorInfo **retVendor);
void __glXAddScreenDrawableMapping(Display *dpy, GLXDrawable drawable, int screen, __GLXvendorInfo *vendor);
void __glXRemoveScreenDrawableMapping(Display *dpy, GLXDrawable drawable);
int __glXScreenFromDrawable(Display *dpy, GLXDrawable drawable);
int __glXVendorFromDrawable(Display *dpy, GLXDrawable drawable, int *retScreen, __GLXvendorInfo **retVendor);
__GLXextFuncPtr __glXGetGLXDispatchAddress(const GLubyte *procName);
/*!
* Looks up the vendor by name or screen number. This has the side effect of
* loading the vendor library if it has not been previously loaded.
*/
__GLXvendorInfo *__glXLookupVendorByName(const char *vendorName);
__GLXvendorInfo *__glXLookupVendorByScreen(Display *dpy, const int screen);
/*!
* Looks up the __GLXdisplayInfo structure for a display, creating it if
* necessary.
*/
__GLXdisplayInfo *__glXLookupDisplay(Display *dpy);
/*!
* Frees the __GLXdisplayInfo structure for a display, if one exists.
*/
void __glXFreeDisplay(Display *dpy);
/*!
* Notifies libglvnd that a context has been marked for destruction.
*/
void __glXNotifyContextDestroyed(GLXContext ctx);
/*
* Close the vendor library and perform any relevant teardown. This should
* be called when the API library is unloaded.
*/
void __glXMappingTeardown(Bool doReset);
2013-08-23 01:06:53 +02:00
#endif /* __LIB_GLX_MAPPING_H */