summaryrefslogtreecommitdiffstats
path: root/src/hgl/GLDispatcher.cpp
diff options
context:
space:
mode:
authorAlexander von Gluck IV <[email protected]>2013-12-31 15:39:49 -0600
committerAlexander von Gluck IV <[email protected]>2014-01-06 15:50:21 -0600
commit61ef697afc0ad509dcabdecfc424f27b5966969c (patch)
treeb099044ff97e9a0f4522b8c59adaaec82d6ace28 /src/hgl/GLDispatcher.cpp
parentb236314a1107214210c429295fac8a5bdf457772 (diff)
haiku libGL: Move from gallium target to src/hgl
* The Haiku renderers need to link to libGL to function properly in all usage contexts. As mesa drivers build before gallium targets, we couldn't properly link the mesa swrast driver to the gallium libGL target for Haiku. * This is likely better as it mimics how glx is laid out ensuring the Haiku libGL is better understood. * All renderers properly link in libGL now. Acked-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/hgl/GLDispatcher.cpp')
-rw-r--r--src/hgl/GLDispatcher.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/hgl/GLDispatcher.cpp b/src/hgl/GLDispatcher.cpp
new file mode 100644
index 00000000000..46b91d57c49
--- /dev/null
+++ b/src/hgl/GLDispatcher.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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]>
+ * Alexander von Gluck IV <[email protected]>
+ */
+
+
+extern "C" {
+#include "glapi/glapi.h"
+#include "glapi/glapi_priv.h"
+
+/*
+ * 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;
+}