summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:40:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:40:54 +0000
commit73ca1c327417acc06ae584efee094eb8166b7f13 (patch)
treede6eed13dc61bf6a8761364b8499b123a0d12ede /lib
parent20974620ea0acddb99a7aea1ee4d8cea8bb76a84 (diff)
import Mesa 11.0.6
Diffstat (limited to 'lib')
-rw-r--r--lib/mesa/src/egl/main/eglcurrent.h73
1 files changed, 40 insertions, 33 deletions
diff --git a/lib/mesa/src/egl/main/eglcurrent.h b/lib/mesa/src/egl/main/eglcurrent.h
index d813a46d9..1e386acda 100644
--- a/lib/mesa/src/egl/main/eglcurrent.h
+++ b/lib/mesa/src/egl/main/eglcurrent.h
@@ -29,7 +29,7 @@
#ifndef EGLCURRENT_INCLUDED
#define EGLCURRENT_INCLUDED
-#include <stdbool.h>
+#include "c99_compat.h"
#include "egltypedefs.h"
@@ -46,23 +46,20 @@ extern "C" {
EGL_OPENGL_BIT)
+#define _EGL_API_FIRST_API EGL_OPENGL_ES_API
+#define _EGL_API_LAST_API EGL_OPENGL_API
+#define _EGL_API_NUM_APIS (_EGL_API_LAST_API - _EGL_API_FIRST_API + 1)
+
+
/**
* Per-thread info
*/
struct _egl_thread_info
{
- bool inited;
EGLint LastError;
- _EGLContext *CurrentContext;
- EGLenum CurrentAPI;
- EGLLabelKHR Label;
-
- /**
- * The name of the EGL function that's being called at the moment. This is
- * used to report the function name to the EGL_KHR_debug callback.
- */
- const char *CurrentFuncName;
- EGLLabelKHR CurrentObjectLabel;
+ _EGLContext *CurrentContexts[_EGL_API_NUM_APIS];
+ /* use index for fast access to current context */
+ EGLint CurrentAPIIndex;
};
@@ -72,12 +69,29 @@ struct _egl_thread_info
static inline EGLBoolean
_eglIsApiValid(EGLenum api)
{
-#ifdef ANDROID
- /* OpenGL is not a valid/supported API on Android */
- return api == EGL_OPENGL_ES_API;
-#else
- return (api == EGL_OPENGL_ES_API || api == EGL_OPENGL_API);
-#endif
+ return (api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API);
+}
+
+
+/**
+ * Convert a client API enum to an index, for use by thread info.
+ * The client API enum is assumed to be valid.
+ */
+static inline EGLint
+_eglConvertApiToIndex(EGLenum api)
+{
+ return api - _EGL_API_FIRST_API;
+}
+
+
+/**
+ * Convert an index, used by thread info, to a client API enum.
+ * The index is assumed to be valid.
+ */
+static inline EGLenum
+_eglConvertApiFromIndex(EGLint idx)
+{
+ return _EGL_API_FIRST_API + idx;
}
@@ -89,28 +103,21 @@ extern void
_eglDestroyCurrentThread(void);
-extern _EGLContext *
-_eglGetCurrentContext(void);
+extern EGLBoolean
+_eglIsCurrentThreadDummy(void);
-extern EGLBoolean
-_eglError(EGLint errCode, const char *msg);
+extern _EGLContext *
+_eglGetAPIContext(EGLenum api);
-extern void
-_eglDebugReport(EGLenum error, const char *funcName,
- EGLint type, const char *message, ...);
-#define _eglReportCritical(error, funcName, ...) \
- _eglDebugReport(error, funcName, EGL_DEBUG_MSG_CRITICAL_KHR, __VA_ARGS__)
+extern _EGLContext *
+_eglGetCurrentContext(void);
-#define _eglReportError(error, funcName, ...) \
- _eglDebugReport(error, funcName, EGL_DEBUG_MSG_ERROR_KHR, __VA_ARGS__)
-#define _eglReportWarn(funcName, ...) \
- _eglDebugReport(EGL_SUCCESS, funcName, EGL_DEBUG_MSG_WARN_KHR, __VA_ARGS__)
+extern EGLBoolean
+_eglError(EGLint errCode, const char *msg);
-#define _eglReportInfo(funcName, ...) \
- _eglDebugReport(EGL_SUCCESS, funcName, EGL_DEBUG_MSG_INFO_KHR, __VA_ARGS__)
#ifdef __cplusplus
}