summaryrefslogtreecommitdiff
path: root/src/hgl/GLDispatcher.cpp
blob: a1e9053617c916d346adbc5808c95218e6172615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
 * Copyright 2000-2015 Haiku, Inc. All Rights Reserved.
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *		Brian Paul <brian.e.paul@gmail.com>
 *		Philippe Houdoin <philippe.houdoin@free.fr>
 *		Alexander von Gluck IV <kallisti5@unixzen.com>
 */


#include "glapi/glapi.h"
#include "glapi/glapi_priv.h"


extern "C" {
/*
 * NOTE: this file portion implements C-based dispatch of the OpenGL entrypoints
 * (glAccum, glBegin, etc).
 * This code IS NOT USED if we're compiling on an x86 system and using
 * the glapi_x86.S assembly code.
 */
#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))

#define KEYWORD1 PUBLIC
#define KEYWORD2
#define NAME(func) gl##func

#define DISPATCH(func, args, msg)					\
	const struct _glapi_table* dispatch;					\
	dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
	(dispatch->func) args

#define RETURN_DISPATCH(func, args, msg) 				\
	const struct _glapi_table* dispatch;					\
	dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
	return (dispatch->func) args

#endif
}


/* NOTE: this file portion implement a thin OpenGL entrypoints dispatching
	C++ wrapper class
 */

#include "GLDispatcher.h"

BGLDispatcher::BGLDispatcher()
{
}


BGLDispatcher::~BGLDispatcher()
{
}


status_t
BGLDispatcher::CheckTable(const struct _glapi_table* table)
{
	_glapi_check_table(table ? table : _glapi_get_dispatch());
	return B_OK;
}


status_t
BGLDispatcher::SetTable(struct _glapi_table* table)
{
	_glapi_set_dispatch(table);
	return B_OK;
}