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"
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
#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)
|
2009-07-17 20:36:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Per-thread info
|
|
|
|
*/
|
|
|
|
struct _egl_thread_info
|
|
|
|
{
|
|
|
|
EGLint LastError;
|
2009-08-17 08:53:54 +01:00
|
|
|
_EGLContext *CurrentContexts[_EGL_API_NUM_APIS];
|
2009-07-17 20:36:06 +01:00
|
|
|
/* use index for fast access to current context */
|
|
|
|
EGLint CurrentAPIIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-08-17 08:53:54 +01:00
|
|
|
* Return true if a client API enum is recognized.
|
2009-07-17 20:36:06 +01:00
|
|
|
*/
|
2015-02-28 16:35:22 +00:00
|
|
|
static inline EGLBoolean
|
2009-07-17 20:36:06 +01:00
|
|
|
_eglIsApiValid(EGLenum api)
|
|
|
|
{
|
2009-08-17 08:53:54 +01:00
|
|
|
return (api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API);
|
2009-07-17 20:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a client API enum to an index, for use by thread info.
|
|
|
|
* The client API enum is assumed to be valid.
|
|
|
|
*/
|
2015-02-28 16:35:22 +00:00
|
|
|
static inline EGLint
|
2009-07-17 20:36:06 +01:00
|
|
|
_eglConvertApiToIndex(EGLenum api)
|
|
|
|
{
|
2009-08-17 08:53:54 +01:00
|
|
|
return api - _EGL_API_FIRST_API;
|
2009-07-17 20:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert an index, used by thread info, to a client API enum.
|
|
|
|
* The index is assumed to be valid.
|
|
|
|
*/
|
2015-02-28 16:35:22 +00:00
|
|
|
static inline EGLenum
|
2009-07-17 20:36:06 +01:00
|
|
|
_eglConvertApiFromIndex(EGLint idx)
|
|
|
|
{
|
2009-08-17 08:53:54 +01:00
|
|
|
return _EGL_API_FIRST_API + idx;
|
2009-07-17 20:36:06 +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 *
|
2010-01-26 08:52:14 +00:00
|
|
|
_eglGetAPIContext(EGLenum api);
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* EGLCURRENT_INCLUDED */
|