summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/libgl-haiku/GLDispatcher.h
diff options
context:
space:
mode:
authorAlexander von Gluck IV <[email protected]>2013-10-01 21:03:48 +0000
committerAlexander von Gluck IV <[email protected]>2013-10-04 18:20:09 -0500
commitc9f1217e1f2c309cfd8770940773f1f35582a795 (patch)
treec66197fd83c9a6edbeb2f570e3a9337ac2e4de16 /src/gallium/targets/libgl-haiku/GLDispatcher.h
parent1349766612709a4bc15eac0780178fb01e5d18bc (diff)
haiku: Build Haiku's libGL from within Mesa
* This in essence means that Mesa would be taking control of Haiku's OpenGL kit. * This works by dispatching renderers from the OpenGL add-ons directory
Diffstat (limited to 'src/gallium/targets/libgl-haiku/GLDispatcher.h')
-rw-r--r--src/gallium/targets/libgl-haiku/GLDispatcher.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/gallium/targets/libgl-haiku/GLDispatcher.h b/src/gallium/targets/libgl-haiku/GLDispatcher.h
new file mode 100644
index 00000000000..44bca8ce586
--- /dev/null
+++ b/src/gallium/targets/libgl-haiku/GLDispatcher.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ * Brian Paul <[email protected]>
+ * Philippe Houdoin <[email protected]>
+ */
+#ifndef GLDISPATCHER_H
+#define GLDISPATCHER_H
+
+
+#include <BeBuild.h>
+#include <GL/gl.h>
+#include <SupportDefs.h>
+
+#include "glheader.h"
+
+extern "C" {
+#include "glapi/glapi.h"
+}
+
+
+class BGLDispatcher
+{
+ // Private unimplemented copy constructors
+ BGLDispatcher(const BGLDispatcher &);
+ BGLDispatcher & operator=(const BGLDispatcher &);
+
+ public:
+ BGLDispatcher();
+ ~BGLDispatcher();
+
+ void SetCurrentContext(void* context);
+ void* CurrentContext();
+
+ struct _glapi_table* Table();
+ status_t CheckTable(
+ const struct _glapi_table* dispatch = NULL);
+ status_t SetTable(struct _glapi_table* dispatch);
+ uint32 TableSize();
+
+ const _glapi_proc operator[](const char* functionName);
+ const char* operator[](uint32 offset);
+
+ const _glapi_proc AddressOf(const char* functionName);
+ uint32 OffsetOf(const char* functionName);
+};
+
+
+// Inlines methods
+inline void
+BGLDispatcher::SetCurrentContext(void* context)
+{
+ _glapi_set_context(context);
+}
+
+
+inline void*
+BGLDispatcher::CurrentContext()
+{
+ return _glapi_get_context();
+}
+
+
+inline struct _glapi_table*
+BGLDispatcher::Table()
+{
+ return _glapi_get_dispatch();
+}
+
+
+inline uint32
+BGLDispatcher::TableSize()
+{
+ return _glapi_get_dispatch_table_size();
+}
+
+
+inline const _glapi_proc
+BGLDispatcher::operator[](const char* functionName)
+{
+ return _glapi_get_proc_address(functionName);
+}
+
+
+inline const char*
+BGLDispatcher::operator[](uint32 offset)
+{
+ return _glapi_get_proc_name((GLuint) offset);
+}
+
+
+inline const _glapi_proc
+BGLDispatcher::AddressOf(const char* functionName)
+{
+ return _glapi_get_proc_address(functionName);
+}
+
+
+inline uint32
+BGLDispatcher::OffsetOf(const char* functionName)
+{
+ return (uint32) _glapi_get_proc_offset(functionName);
+}
+
+
+#endif // GLDISPATCHER_H