#include "main/glheader.h"
#include "main/compiler.h"
#include <stdlib.h>
#include <string.h>
#include "glapi.h"
#include "glapioffsets.h"
#include "glapitable.h"
#include "glapitemp.h"
Defines | |
#define | KEYWORD1 static |
#define | KEYWORD1_ALT static |
#define | KEYWORD2 GLAPIENTRY |
#define | NAME(func) NoOp##func |
#define | F NULL |
#define | DISPATCH(func, args, msg) |
#define | RETURN_DISPATCH(func, args, msg) |
#define | DISPATCH_TABLE_NAME __glapi_noop_table |
#define | UNUSED_TABLE_NAME __unused_noop_functions |
#define | TABLE_ENTRY(name) (_glapi_proc) NoOp##name |
#define | NEED_FUNCTION_POINTER |
#define | DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) |
Functions | |
PUBLIC void | _glapi_noop_enable_warnings (GLboolean enable) |
GL API public functions. | |
PUBLIC void | _glapi_set_warning_func (_glapi_warning_func func) |
static GLboolean | warn (void) |
static GLint | NoOpUnused (void) |
void | _glapi_check_multithread (void) |
We should call this periodically from a function such as glXMakeCurrent in order to test if multiple threads are being used. | |
PUBLIC void | _glapi_set_context (void *context) |
Set the current context pointer for this thread. | |
PUBLIC void * | _glapi_get_context (void) |
Get the current context pointer for this thread. | |
PUBLIC void | _glapi_set_dispatch (struct _glapi_table *dispatch) |
Set the global or per-thread dispatch table pointer. | |
PUBLIC struct _glapi_table * | _glapi_get_dispatch (void) |
Return pointer to current dispatch table for calling thread. | |
PUBLIC GLuint | _glapi_get_dispatch_table_size (void) |
Return size of dispatch table struct as number of functions (or slots). | |
void | _glapi_check_table (const struct _glapi_table *table) |
Make sure there are no NULL pointers in the given dispatch table. | |
Variables | |
static GLboolean | WarnFlag = GL_FALSE |
static _glapi_warning_func | warning_func |
Current dispatch and current context control variables | |
Depending on whether or not multithreading is support, and the type of support available, several variables are used to store the current context pointer and the current dispatch table pointer.
In the non-threaded case, the variables
In the "normal" threaded case, the variables
There is a race condition in setting
In the TLS case, the variables | |
PUBLIC struct _glapi_table * | _glapi_Dispatch |
PUBLIC void * | _glapi_Context = NULL |
Define the GET_CURRENT_CONTEXT() macro. |
#define DISPATCH | ( | func, | |||
args, | |||||
msg | ) |
Value:
if (warn()) { \ warning_func(NULL, "GL User Error: called without context: %s", #func); \ }
#define DISPATCH_TABLE_NAME __glapi_noop_table |
#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) |
#define F NULL |
#define KEYWORD1 static |
#define KEYWORD1_ALT static |
#define KEYWORD2 GLAPIENTRY |
#define NAME | ( | func | ) | NoOp##func |
#define NEED_FUNCTION_POINTER |
#define RETURN_DISPATCH | ( | func, | |||
args, | |||||
msg | ) |
Value:
if (warn()) { \ warning_func(NULL, "GL User Error: called without context: %s", #func); \ } \ return 0
#define TABLE_ENTRY | ( | name | ) | (_glapi_proc) NoOp##name |
#define UNUSED_TABLE_NAME __unused_noop_functions |
void _glapi_check_multithread | ( | void | ) |
We should call this periodically from a function such as glXMakeCurrent in order to test if multiple threads are being used.
void _glapi_check_table | ( | const struct _glapi_table * | table | ) |
Make sure there are no NULL pointers in the given dispatch table.
Intended for debugging purposes.
PUBLIC void* _glapi_get_context | ( | void | ) |
Get the current context pointer for this thread.
The context pointer is an opaque type which should be cast from void to the real context pointer type.
PUBLIC struct _glapi_table* _glapi_get_dispatch | ( | void | ) | [read] |
Return pointer to current dispatch table for calling thread.
PUBLIC GLuint _glapi_get_dispatch_table_size | ( | void | ) |
Return size of dispatch table struct as number of functions (or slots).
PUBLIC void _glapi_noop_enable_warnings | ( | GLboolean | enable | ) |
GL API public functions.
PUBLIC void _glapi_set_context | ( | void * | context | ) |
Set the current context pointer for this thread.
The context pointer is an opaque type which should be cast to void from the real context pointer type.
PUBLIC void _glapi_set_dispatch | ( | struct _glapi_table * | dispatch | ) |
Set the global or per-thread dispatch table pointer.
If the dispatch parameter is NULL we'll plug in the no-op dispatch table (__glapi_noop_table).
PUBLIC void _glapi_set_warning_func | ( | _glapi_warning_func | func | ) |
static GLint NoOpUnused | ( | void | ) | [static] |
static GLboolean warn | ( | void | ) | [static] |
PUBLIC void* _glapi_Context = NULL |
Define the GET_CURRENT_CONTEXT() macro.
C | local variable which will hold the current context. |
PUBLIC struct _glapi_table* _glapi_Dispatch |
Initial value:
(struct _glapi_table *) __glapi_noop_table
GLboolean WarnFlag = GL_FALSE [static] |
_glapi_warning_func warning_func [static] |