GLDispatcher.cpp revision 848b8605
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 *		Alexander von Gluck IV <kallisti5@unixzen.com>
10 */
11
12
13extern "C" {
14#include "glapi/glapi.h"
15#include "glapi/glapi_priv.h"
16
17/*
18 * NOTE: this file portion implements C-based dispatch of the OpenGL entrypoints
19 * (glAccum, glBegin, etc).
20 * This code IS NOT USED if we're compiling on an x86 system and using
21 * the glapi_x86.S assembly code.
22 */
23#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
24
25#define KEYWORD1 PUBLIC
26#define KEYWORD2
27#define NAME(func) gl##func
28
29#define DISPATCH(func, args, msg)					\
30	const struct _glapi_table* dispatch;					\
31	dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
32	(dispatch->func) args
33
34#define RETURN_DISPATCH(func, args, msg) 				\
35	const struct _glapi_table* dispatch;					\
36	dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
37	return (dispatch->func) args
38
39#endif
40}
41
42
43/* NOTE: this file portion implement a thin OpenGL entrypoints dispatching
44	C++ wrapper class
45 */
46
47#include "GLDispatcher.h"
48
49BGLDispatcher::BGLDispatcher()
50{
51}
52
53
54BGLDispatcher::~BGLDispatcher()
55{
56}
57
58
59status_t
60BGLDispatcher::CheckTable(const struct _glapi_table* table)
61{
62	_glapi_check_table(table ? table : _glapi_get_dispatch());
63	return B_OK;
64}
65
66
67status_t
68BGLDispatcher::SetTable(struct _glapi_table* table)
69{
70	_glapi_set_dispatch(table);
71	return B_OK;
72}
73