1/*
2 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
4 * Distributed under the terms of the MIT License.
5 *
6 * Authors:
7 *		Brian Paul <brian.e.paul@gmail.com>
8 *		Philippe Houdoin <philippe.houdoin@free.fr>
9 */
10
11
12extern "C" {
13#include "glapi.h"
14#if __GNUC__ > 2
15// New Mesa
16#include "glapi_priv.h"
17#include "glapitable.h"
18#endif
19
20
21/*
22 * NOTE: this file portion implements C-based dispatch of the OpenGL entrypoints
23 * (glAccum, glBegin, etc).
24 * This code IS NOT USED if we're compiling on an x86 system and using
25 * the glapi_x86.S assembly code.
26 */
27#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
28
29#define KEYWORD1 PUBLIC
30#define KEYWORD2
31#define NAME(func) gl##func
32
33#define DISPATCH(func, args, msg)					\
34	const struct _glapi_table* dispatch;					\
35	dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
36	(dispatch->func) args
37
38#define RETURN_DISPATCH(func, args, msg) 				\
39	const struct _glapi_table* dispatch;					\
40	dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
41	return (dispatch->func) args
42
43#endif
44}
45
46
47/* NOTE: this file portion implement a thin OpenGL entrypoints dispatching
48	C++ wrapper class
49 */
50
51#include "GLDispatcher.h"
52
53BGLDispatcher::BGLDispatcher()
54{
55}
56
57
58BGLDispatcher::~BGLDispatcher()
59{
60}
61
62
63status_t
64BGLDispatcher::CheckTable(const struct _glapi_table* table)
65{
66	_glapi_check_table(table ? table : _glapi_get_dispatch());
67	return B_OK;
68}
69
70
71status_t
72BGLDispatcher::SetTable(struct _glapi_table* table)
73{
74	_glapi_set_dispatch(table);
75	return B_OK;
76}
77