1999-11-11 01:22:25 +00:00
|
|
|
/*
|
|
|
|
* Mesa 3-D graphics library
|
|
|
|
*
|
2008-06-17 20:23:32 +01:00
|
|
|
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
|
1999-11-11 01:22:25 +00:00
|
|
|
*
|
|
|
|
* 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 and this permission notice 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
|
2013-04-21 21:46:48 +01:00
|
|
|
* 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 SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
1999-11-11 01:22:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2004-09-10 01:45:12 +01:00
|
|
|
/**
|
|
|
|
* \mainpage Mesa GL API Module
|
|
|
|
*
|
|
|
|
* \section GLAPIIntroduction Introduction
|
|
|
|
*
|
|
|
|
* The Mesa GL API module is responsible for dispatching all the
|
|
|
|
* gl*() functions. All GL functions are dispatched by jumping through
|
|
|
|
* the current dispatch table (basically a struct full of function
|
|
|
|
* pointers.)
|
|
|
|
*
|
|
|
|
* A per-thread current dispatch table and per-thread current context
|
|
|
|
* pointer are managed by this module too.
|
|
|
|
*
|
|
|
|
* This module is intended to be non-Mesa-specific so it can be used
|
|
|
|
* with the X/DRI libGL also.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1999-11-11 01:22:25 +00:00
|
|
|
#ifndef _GLAPI_H
|
|
|
|
#define _GLAPI_H
|
|
|
|
|
2015-03-04 00:15:05 +00:00
|
|
|
#include "util/macros.h"
|
2021-05-21 21:23:07 +01:00
|
|
|
#include "util/u_thread.h"
|
2011-11-09 10:20:51 +00:00
|
|
|
|
|
|
|
|
2011-10-04 10:53:45 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2006-03-15 20:31:50 +00:00
|
|
|
|
2011-11-09 10:20:51 +00:00
|
|
|
|
2010-08-23 09:13:12 +01:00
|
|
|
#ifdef _GLAPI_NO_EXPORTS
|
|
|
|
# define _GLAPI_EXPORT
|
|
|
|
#else /* _GLAPI_NO_EXPORTS */
|
|
|
|
# ifdef _WIN32
|
|
|
|
# ifdef _GLAPI_DLL_EXPORTS
|
|
|
|
# define _GLAPI_EXPORT __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define _GLAPI_EXPORT __declspec(dllimport)
|
|
|
|
# endif
|
2015-12-01 23:07:08 +00:00
|
|
|
# elif defined(__GNUC__)
|
2010-08-23 09:13:12 +01:00
|
|
|
# define _GLAPI_EXPORT __attribute__((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define _GLAPI_EXPORT
|
|
|
|
# endif
|
|
|
|
#endif /* _GLAPI_NO_EXPORTS */
|
2010-08-21 04:50:22 +01:00
|
|
|
|
|
|
|
|
2010-04-23 09:06:26 +01:00
|
|
|
typedef void (*_glapi_proc)(void);
|
2015-03-13 16:20:29 +00:00
|
|
|
|
|
|
|
typedef void (*_glapi_nop_handler_proc)(const char *name);
|
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
struct _glapi_table;
|
|
|
|
|
|
|
|
|
2019-08-03 17:44:44 +01:00
|
|
|
#if defined (USE_ELF_TLS)
|
2010-08-21 04:50:22 +01:00
|
|
|
|
2021-02-24 05:05:18 +00:00
|
|
|
#ifdef _MSC_VER
|
2021-02-19 22:55:57 +00:00
|
|
|
extern __declspec(thread) struct _glapi_table * _glapi_tls_Dispatch;
|
|
|
|
extern __declspec(thread) void * _glapi_tls_Context;
|
|
|
|
#else
|
2021-05-21 21:23:07 +01:00
|
|
|
_GLAPI_EXPORT extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch;
|
2010-08-21 04:50:22 +01:00
|
|
|
|
2021-05-21 21:23:07 +01:00
|
|
|
_GLAPI_EXPORT extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context;
|
2021-02-19 22:55:57 +00:00
|
|
|
#endif
|
2010-08-21 04:50:22 +01:00
|
|
|
|
|
|
|
_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch;
|
|
|
|
_GLAPI_EXPORT extern const void *_glapi_Context;
|
|
|
|
|
2021-11-02 18:38:02 +00:00
|
|
|
#if defined (USE_TLS_BEHIND_FUNCTIONS)
|
|
|
|
# define GET_DISPATCH() _glapi_get_dispatch()
|
|
|
|
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_get_context()
|
|
|
|
#else
|
2010-09-09 23:59:49 +01:00
|
|
|
# define GET_DISPATCH() _glapi_tls_Dispatch
|
2010-10-12 17:26:10 +01:00
|
|
|
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context
|
2021-11-02 18:38:02 +00:00
|
|
|
#endif
|
2010-08-21 04:50:22 +01:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
|
|
|
|
_GLAPI_EXPORT extern void *_glapi_Context;
|
|
|
|
|
2015-03-05 02:17:57 +00:00
|
|
|
#define GET_DISPATCH() \
|
2010-08-21 04:50:22 +01:00
|
|
|
(likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
|
|
|
|
|
2015-03-05 02:17:57 +00:00
|
|
|
#define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
|
2010-08-21 04:50:22 +01:00
|
|
|
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
|
|
|
|
|
2019-08-03 17:44:44 +01:00
|
|
|
#endif /* defined (USE_ELF_TLS) */
|
2010-08-21 04:50:22 +01:00
|
|
|
|
|
|
|
|
2018-04-18 16:33:03 +01:00
|
|
|
_GLAPI_EXPORT void
|
2010-08-21 04:50:22 +01:00
|
|
|
_glapi_destroy_multithread(void);
|
1999-11-11 01:22:25 +00:00
|
|
|
|
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_check_multithread(void);
|
|
|
|
|
|
|
|
|
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_set_context(void *context);
|
|
|
|
|
|
|
|
|
|
|
|
_GLAPI_EXPORT void *
|
|
|
|
_glapi_get_context(void);
|
|
|
|
|
|
|
|
|
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_set_dispatch(struct _glapi_table *dispatch);
|
|
|
|
|
|
|
|
|
|
|
|
_GLAPI_EXPORT struct _glapi_table *
|
|
|
|
_glapi_get_dispatch(void);
|
|
|
|
|
|
|
|
|
|
|
|
_GLAPI_EXPORT unsigned int
|
1999-11-27 21:30:40 +00:00
|
|
|
_glapi_get_dispatch_table_size(void);
|
|
|
|
|
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
_GLAPI_EXPORT int
|
2005-07-28 01:29:51 +01:00
|
|
|
_glapi_add_dispatch( const char * const * function_names,
|
|
|
|
const char * parameter_signature );
|
1999-11-11 01:22:25 +00:00
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
_GLAPI_EXPORT int
|
1999-11-27 21:30:40 +00:00
|
|
|
_glapi_get_proc_offset(const char *funcName);
|
1999-11-11 01:22:25 +00:00
|
|
|
|
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
_GLAPI_EXPORT _glapi_proc
|
1999-11-11 01:22:25 +00:00
|
|
|
_glapi_get_proc_address(const char *funcName);
|
|
|
|
|
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
_GLAPI_EXPORT const char *
|
2010-02-11 22:04:06 +00:00
|
|
|
_glapi_get_proc_name(unsigned int offset);
|
1999-12-15 15:03:16 +00:00
|
|
|
|
|
|
|
|
2016-07-11 21:38:16 +01:00
|
|
|
#if defined(GLX_USE_APPLEGL) || defined(GLX_USE_WINDOWSGL)
|
2011-06-10 00:59:49 +01:00
|
|
|
_GLAPI_EXPORT struct _glapi_table *
|
|
|
|
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
|
2018-01-16 16:26:57 +00:00
|
|
|
|
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_table_patch(struct _glapi_table *, const char *name, void *wrapper);
|
2015-12-09 12:41:22 +00:00
|
|
|
#endif
|
2011-06-10 00:59:49 +01:00
|
|
|
|
|
|
|
|
2015-03-13 16:20:29 +00:00
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_set_nop_handler(_glapi_nop_handler_proc func);
|
|
|
|
|
|
|
|
/** Return pointer to new dispatch table filled with no-op functions */
|
|
|
|
_GLAPI_EXPORT struct _glapi_table *
|
|
|
|
_glapi_new_nop_table(unsigned num_entries);
|
|
|
|
|
|
|
|
|
2014-03-14 16:13:16 +00:00
|
|
|
/** Deprecated function */
|
|
|
|
_GLAPI_EXPORT unsigned long
|
|
|
|
_glthread_GetID(void);
|
|
|
|
|
|
|
|
|
2010-08-21 04:50:22 +01:00
|
|
|
/*
|
|
|
|
* These stubs are kept so that the old DRI drivers still load.
|
|
|
|
*/
|
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_noop_enable_warnings(unsigned char enable);
|
|
|
|
|
|
|
|
|
|
|
|
_GLAPI_EXPORT void
|
|
|
|
_glapi_set_warning_func(_glapi_proc func);
|
|
|
|
|
2011-11-09 10:20:51 +00:00
|
|
|
|
2011-10-04 10:53:45 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2010-08-21 04:50:22 +01:00
|
|
|
|
|
|
|
#endif /* _GLAPI_H */
|