/**************************************************************************1*2* Copyright 2009-2010 Chia-I Wu <[email protected]>3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR18* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,19* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL20* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER21* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING22* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER23* DEALINGS IN THE SOFTWARE.24*25**************************************************************************/262728#ifndef EGLCURRENT_INCLUDED29#define EGLCURRENT_INCLUDED3031#include "c99_compat.h"3233#include "egltypedefs.h"343536#ifdef __cplusplus37extern "C" {38#endif3940#define _EGL_API_ALL_BITS \41(EGL_OPENGL_ES_BIT | \42EGL_OPENVG_BIT | \43EGL_OPENGL_ES2_BIT | \44EGL_OPENGL_ES3_BIT_KHR | \45EGL_OPENGL_BIT)464748/**49* Per-thread info50*/51struct _egl_thread_info52{53EGLint LastError;54_EGLContext *CurrentContext;55EGLenum CurrentAPI;56EGLLabelKHR Label;5758/**59* The name of the EGL function that's being called at the moment. This is60* used to report the function name to the EGL_KHR_debug callback.61*/62const char *CurrentFuncName;63EGLLabelKHR CurrentObjectLabel;64};656667/**68* Return true if a client API enum is recognized.69*/70static inline EGLBoolean71_eglIsApiValid(EGLenum api)72{73#ifdef ANDROID74/* OpenGL is not a valid/supported API on Android */75return api == EGL_OPENGL_ES_API;76#else77return (api == EGL_OPENGL_ES_API || api == EGL_OPENGL_API);78#endif79}808182extern _EGLThreadInfo *83_eglGetCurrentThread(void);848586extern void87_eglDestroyCurrentThread(void);888990extern EGLBoolean91_eglIsCurrentThreadDummy(void);929394extern _EGLContext *95_eglGetCurrentContext(void);969798extern EGLBoolean99_eglError(EGLint errCode, const char *msg);100101extern void102_eglDebugReport(EGLenum error, const char *funcName,103EGLint type, const char *message, ...);104105#define _eglReportCritical(error, funcName, ...) \106_eglDebugReport(error, funcName, EGL_DEBUG_MSG_CRITICAL_KHR, __VA_ARGS__)107108#define _eglReportError(error, funcName, ...) \109_eglDebugReport(error, funcName, EGL_DEBUG_MSG_ERROR_KHR, __VA_ARGS__)110111#define _eglReportWarn(funcName, ...) \112_eglDebugReport(EGL_SUCCESS, funcName, EGL_DEBUG_MSG_WARN_KHR, __VA_ARGS__)113114#define _eglReportInfo(funcName, ...) \115_eglDebugReport(EGL_SUCCESS, funcName, EGL_DEBUG_MSG_INFO_KHR, __VA_ARGS__)116117#ifdef __cplusplus118}119#endif120121#endif /* EGLCURRENT_INCLUDED */122123124