2011-07-02 09:57:30 +01:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
2009-07-17 20:36:06 +01:00
|
|
|
#ifndef EGLCURRENT_INCLUDED
|
|
|
|
#define EGLCURRENT_INCLUDED
|
|
|
|
|
2015-02-28 16:35:22 +00:00
|
|
|
#include "c99_compat.h"
|
2010-01-29 01:00:30 +00:00
|
|
|
|
2009-07-17 20:36:06 +01:00
|
|
|
#include "egltypedefs.h"
|
|
|
|
|
|
|
|
|
2015-05-13 23:13:37 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-08-17 08:53:54 +01:00
|
|
|
#define _EGL_API_ALL_BITS \
|
|
|
|
(EGL_OPENGL_ES_BIT | \
|
|
|
|
EGL_OPENVG_BIT | \
|
|
|
|
EGL_OPENGL_ES2_BIT | \
|
egl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR
Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge:
* piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0
* gles3conform, revision 19700, when runnning GL3Tests with -fbo
This plumbing is added in order to comply with the EGL_KHR_create_context
spec. According to the EGL_KHR_create_context spec, it is illegal to call
eglCreateContext(EGL_CONTEXT_MAJOR_VERSION_KHR=3) with a config whose
EGL_RENDERABLE_TYPE does not contain the EGL_OPENGL_ES3_BIT_KHR. The
pertinent
portion of the spec is quoted below; the key word is "respectively".
* If <config> is not a valid EGLConfig, or does not support the
requested client API, then an EGL_BAD_CONFIG error is generated
(this includes requesting creation of an OpenGL ES 1.x, 2.0, or
3.0 context when the EGL_RENDERABLE_TYPE attribute of <config>
does not contain EGL_OPENGL_ES_BIT, EGL_OPENGL_ES2_BIT, or
EGL_OPENGL_ES3_BIT_KHR respectively).
To create this patch, I searched for all the ES2 bit plumbing by calling
`git grep "ES2_BIT\|DRI_API_GLES2" src/egl`, and then at each location
added a case for ES3.
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-11-20 21:43:11 +00:00
|
|
|
EGL_OPENGL_ES3_BIT_KHR | \
|
2009-08-17 08:53:54 +01:00
|
|
|
EGL_OPENGL_BIT)
|
|
|
|
|
|
|
|
|
2009-07-17 20:36:06 +01:00
|
|
|
/**
|
|
|
|
* Per-thread info
|
|
|
|
*/
|
|
|
|
struct _egl_thread_info
|
|
|
|
{
|
|
|
|
EGLint LastError;
|
2016-07-08 22:21:17 +01:00
|
|
|
_EGLContext *CurrentContext;
|
|
|
|
EGLenum CurrentAPI;
|
2016-09-12 21:15:10 +01:00
|
|
|
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;
|
2009-07-17 20:36:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-06-03 10:25:19 +01:00
|
|
|
/**
|
|
|
|
* Return true if a client API enum is recognized.
|
|
|
|
*/
|
|
|
|
static inline EGLBoolean
|
|
|
|
_eglIsApiValid(EGLenum api)
|
|
|
|
{
|
2016-08-25 12:02:07 +01:00
|
|
|
#ifdef ANDROID
|
|
|
|
/* OpenGL is not a valid/supported API on Android */
|
2016-07-08 22:21:17 +01:00
|
|
|
return api == EGL_OPENGL_ES_API;
|
2016-08-25 12:02:07 +01:00
|
|
|
#else
|
2016-07-08 22:21:17 +01:00
|
|
|
return (api == EGL_OPENGL_ES_API || api == EGL_OPENGL_API);
|
2016-08-25 12:02:07 +01:00
|
|
|
#endif
|
2016-06-03 10:25:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-28 17:20:01 +00:00
|
|
|
extern _EGLThreadInfo *
|
2009-07-17 20:36:06 +01:00
|
|
|
_eglGetCurrentThread(void);
|
|
|
|
|
|
|
|
|
|
|
|
extern void
|
|
|
|
_eglDestroyCurrentThread(void);
|
|
|
|
|
|
|
|
|
|
|
|
extern EGLBoolean
|
|
|
|
_eglIsCurrentThreadDummy(void);
|
|
|
|
|
|
|
|
|
2015-02-28 17:20:01 +00:00
|
|
|
extern _EGLContext *
|
2009-07-17 20:36:06 +01:00
|
|
|
_eglGetCurrentContext(void);
|
|
|
|
|
|
|
|
|
2015-02-28 17:20:01 +00:00
|
|
|
extern EGLBoolean
|
2009-07-17 20:36:06 +01:00
|
|
|
_eglError(EGLint errCode, const char *msg);
|
|
|
|
|
2016-09-12 22:50:40 +01:00
|
|
|
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__)
|
2009-07-17 20:36:06 +01:00
|
|
|
|
2015-05-13 23:13:37 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-07-17 20:36:06 +01:00
|
|
|
#endif /* EGLCURRENT_INCLUDED */
|