1c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV/*
2c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3cf71e7093c301a1d3dc3e19d88d44a043ccadc7dAlexander von Gluck IV * Copyright 2000-2015 Haiku, Inc. All Rights Reserved.
4c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV * Distributed under the terms of the MIT License.
5c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV *
6c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV * Authors:
7c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV *		Brian Paul <brian.e.paul@gmail.com>
8c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV *		Philippe Houdoin <philippe.houdoin@free.fr>
9c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV */
10c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#ifndef GLDISPATCHER_H
11c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#define GLDISPATCHER_H
12c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
13c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
14c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#include <BeBuild.h>
15c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#include <GL/gl.h>
16c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#include <SupportDefs.h>
17c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
18c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#include "glheader.h"
19c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
20c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#include "glapi/glapi.h"
21c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
22c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
23c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVclass BGLDispatcher
24c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
25c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		// Private unimplemented copy constructors
26c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		BGLDispatcher(const BGLDispatcher &);
27c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		BGLDispatcher & operator=(const BGLDispatcher &);
28c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
29c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	public:
30c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		BGLDispatcher();
31c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		~BGLDispatcher();
32c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
33c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		void 					SetCurrentContext(void* context);
34c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		void*					CurrentContext();
35c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
36c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		struct _glapi_table* 	Table();
37c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		status_t				SetTable(struct _glapi_table* dispatch);
38c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		uint32					TableSize();
39c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
40c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		const _glapi_proc 		operator[](const char* functionName);
41c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		const char*				operator[](uint32 offset);
42c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
43c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		const _glapi_proc		AddressOf(const char* functionName);
44c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV		uint32					OffsetOf(const char* functionName);
45c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV};
46c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
47c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
48c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV// Inlines methods
49c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline void
50c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::SetCurrentContext(void* context)
51c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
52c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	_glapi_set_context(context);
53c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
54c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
55c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
56c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline void*
57c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::CurrentContext()
58c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
59c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return _glapi_get_context();
60c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
61c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
62c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
63c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline struct _glapi_table*
64c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::Table()
65c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
66c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return _glapi_get_dispatch();
67c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
68c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
69c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
70c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline uint32
71c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::TableSize()
72c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
73c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return _glapi_get_dispatch_table_size();
74c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
75c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
76c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
77c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline const _glapi_proc
78c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::operator[](const char* functionName)
79c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
80c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return _glapi_get_proc_address(functionName);
81c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
82c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
83c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
84c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline const char*
85c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::operator[](uint32 offset)
86c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
87c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return _glapi_get_proc_name((GLuint) offset);
88c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
89c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
90c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
91c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline const _glapi_proc
92c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::AddressOf(const char* functionName)
93c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
94c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return _glapi_get_proc_address(functionName);
95c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
96c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
97c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
98c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVinline uint32
99c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IVBGLDispatcher::OffsetOf(const char* functionName)
100c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV{
101c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV	return (uint32) _glapi_get_proc_offset(functionName);
102c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV}
103c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
104c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV
105c9f1217e1f2c309cfd8770940773f1f35582a795Alexander von Gluck IV#endif	// GLDISPATCHER_H
106