egl: drop unused _EGLDriver from QueryBufferAge()
[mesa.git] / src / egl / main / eglcurrent.h
index 1e386acdafb9c0550801536da02e2af85f56bcb6..d9a4a90174e2e62d45420ecfa5953fe66e516e38 100644 (file)
@@ -46,20 +46,22 @@ 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
 {
    EGLint LastError;
-   _EGLContext *CurrentContexts[_EGL_API_NUM_APIS];
-   /* use index for fast access to current context */
-   EGLint CurrentAPIIndex;
+   _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;
 };
 
 
@@ -69,29 +71,12 @@ struct _egl_thread_info
 static inline EGLBoolean
 _eglIsApiValid(EGLenum api)
 {
-   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;
+#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
 }
 
 
@@ -107,10 +92,6 @@ extern EGLBoolean
 _eglIsCurrentThreadDummy(void);
 
 
-extern _EGLContext *
-_eglGetAPIContext(EGLenum api);
-
-
 extern _EGLContext *
 _eglGetCurrentContext(void);
 
@@ -118,6 +99,21 @@ _eglGetCurrentContext(void);
 extern EGLBoolean
 _eglError(EGLint errCode, const char *msg);
 
+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__)
+
+#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__)
+
+#define _eglReportInfo(funcName, ...) \
+    _eglDebugReport(EGL_SUCCESS, funcName, EGL_DEBUG_MSG_INFO_KHR, __VA_ARGS__)
 
 #ifdef __cplusplus
 }