some initial EGL 1.2 work
This commit is contained in:
parent
daf3093f28
commit
b2006a40eb
|
@ -31,6 +31,7 @@
|
|||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "eglcontext.h"
|
||||
#include "egldisplay.h"
|
||||
|
@ -346,6 +347,7 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
|
|||
{ "eglWaitGL", (_EGLProc) eglWaitGL },
|
||||
{ "eglWaitNative", (_EGLProc) eglWaitNative },
|
||||
/* Extensions */
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
|
||||
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
|
||||
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
|
||||
|
@ -358,6 +360,14 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
|
|||
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
|
||||
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
|
||||
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
#ifdef EGL_VERSION_1_2
|
||||
{ "eglBindAPI", (_EGLProc) eglBindAPI },
|
||||
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
|
||||
{ "eglQueryAPI", (_EGLProc) eglQueryAPI },
|
||||
{ "eglReleaseThread", (_EGLProc) eglReleaseThread },
|
||||
{ "eglWaitClient", (_EGLProc) eglWaitClient },
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
{ NULL, NULL }
|
||||
};
|
||||
EGLint i;
|
||||
|
@ -492,6 +502,85 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
** EGL 1.2
|
||||
**/
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
EGLBoolean
|
||||
eglBindAPI(EGLenum api)
|
||||
{
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
|
||||
switch (api) {
|
||||
case EGL_OPENGL_ES_API:
|
||||
if (_eglGlobal.OpenGLESAPISupported) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
||||
return EGL_FALSE;
|
||||
case EGL_OPENVG_API:
|
||||
if (_eglGlobal.OpenVGAPISupported) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
||||
return EGL_FALSE;
|
||||
default:
|
||||
return EGL_FALSE;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
EGLSurface
|
||||
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
||||
EGLClientBuffer buffer, EGLConfig config,
|
||||
const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer,
|
||||
config, attrib_list);
|
||||
}
|
||||
|
||||
|
||||
EGLenum
|
||||
eglQueryAPI(void)
|
||||
{
|
||||
/* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
return t->CurrentAPI;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
eglReleaseThread(void)
|
||||
{
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
if (dpy) {
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
/* unbind context */
|
||||
(void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
_eglDeleteThreadData(t);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
eglWaitClient(void)
|
||||
{
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
if (dpy != EGL_NO_DISPLAY) {
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
return drv->API.WaitClient(drv, dpy);
|
||||
}
|
||||
else
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
|
|||
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
||||
|
||||
|
||||
/* EGL_MESA_screen extension */
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
|
||||
typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
|
||||
|
@ -53,6 +53,14 @@ typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScre
|
|||
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
|
||||
typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
|
||||
typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, EGLDisplay dpy);
|
||||
typedef EGLSurface (*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -101,6 +109,11 @@ struct _egl_api
|
|||
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
|
||||
QueryScreenModeMESA_t QueryScreenModeMESA;
|
||||
QueryModeStringMESA_t QueryModeStringMESA;
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
WaitClient_t WaitClient;
|
||||
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* EGLAPI_INCLUDED */
|
||||
|
|
|
@ -92,6 +92,10 @@ _eglInitConfig(_EGLConfig *config, EGLint id)
|
|||
_eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE);
|
||||
_eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE);
|
||||
_eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE);
|
||||
#ifdef EGL_VERSION_1_2
|
||||
_eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
|
||||
_eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,13 +157,37 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
|
|||
}
|
||||
|
||||
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
|
||||
if (attrib_list[i] >= EGL_BUFFER_SIZE &&
|
||||
attrib_list[i] <= EGL_MAX_SWAP_INTERVAL) {
|
||||
EGLint k = attrib_list[i] - FIRST_ATTRIB;
|
||||
const EGLint attr = attrib_list[i];
|
||||
if (attr >= EGL_BUFFER_SIZE &&
|
||||
attr <= EGL_MAX_SWAP_INTERVAL) {
|
||||
EGLint k = attr - FIRST_ATTRIB;
|
||||
assert(k >= 0);
|
||||
assert(k < MAX_ATTRIBS);
|
||||
config->Attrib[k] = attrib_list[++i];
|
||||
}
|
||||
#ifdef EGL_VERSION_1_2
|
||||
else if (attr == EGL_COLOR_BUFFER_TYPE) {
|
||||
EGLint bufType = attrib_list[++i];
|
||||
if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
_eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType);
|
||||
}
|
||||
else if (attr == EGL_RENDERABLE_TYPE) {
|
||||
EGLint renType = attrib_list[++i];
|
||||
if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT)) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
_eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType);
|
||||
}
|
||||
else if (attr == EGL_ALPHA_MASK_SIZE ||
|
||||
attr == EGL_LUMINANCE_SIZE) {
|
||||
EGLint value = attrib_list[++i];
|
||||
_eglSetConfigAttrib(config, attr, value);
|
||||
}
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
return EGL_FALSE;
|
||||
|
@ -184,6 +212,8 @@ struct sort_info {
|
|||
|
||||
/* This encodes the info from Table 3.5 of the EGL spec, ordered by
|
||||
* Sort Priority.
|
||||
*
|
||||
* XXX To do: EGL 1.2 attribs
|
||||
*/
|
||||
static struct sort_info SortInfo[] = {
|
||||
{ EGL_CONFIG_CAVEAT, EXACT, SPECIAL },
|
||||
|
|
|
@ -160,6 +160,11 @@ _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx,
|
|||
case EGL_CONFIG_ID:
|
||||
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
|
||||
return EGL_TRUE;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CONTEXT_CLIENT_TYPE:
|
||||
*value = c->ClientAPI;
|
||||
return EGL_FALSE;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
|
||||
return EGL_FALSE;
|
||||
|
|
|
@ -22,6 +22,9 @@ struct _egl_context
|
|||
|
||||
EGLBoolean IsBound;
|
||||
EGLBoolean DeletePending;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
|
|||
drv->API.WaitGL = _eglWaitGL;
|
||||
drv->API.WaitNative = _eglWaitNative;
|
||||
|
||||
/* EGL_MESA_screen */
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
drv->API.ChooseModeMESA = _eglChooseModeMESA;
|
||||
drv->API.GetModesMESA = _eglGetModesMESA;
|
||||
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
|
||||
|
@ -193,6 +193,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
|
|||
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
|
||||
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
|
||||
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,6 +232,11 @@ _eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
|
|||
case EGL_EXTENSIONS:
|
||||
_eglUpdateExtensionsString(drv);
|
||||
return drv->Extensions.String;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CLIENT_APIS:
|
||||
/* XXX need to initialize somewhere */
|
||||
return drv->ClientAPIs;
|
||||
#endif
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
|
||||
return NULL;
|
||||
|
@ -250,6 +260,13 @@ _eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
|
|||
/* just a placeholder */
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
(void) engine;
|
||||
switch (engine) {
|
||||
case EGL_CORE_NATIVE_ENGINE:
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ struct _egl_driver
|
|||
|
||||
int ABIversion;
|
||||
int APImajor, APIminor; /* returned through eglInitialize */
|
||||
const char *ClientAPIs;
|
||||
|
||||
_EGLAPI API;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "eglglobals.h"
|
||||
|
||||
|
||||
|
@ -18,9 +19,12 @@ _eglInitGlobals(void)
|
|||
_eglGlobal.Surfaces = _eglNewHashTable();
|
||||
_eglGlobal.FreeScreenHandle = 1;
|
||||
_eglGlobal.Initialized = EGL_TRUE;
|
||||
|
||||
_eglGlobal.OpenGLESAPISupported = EGL_TRUE;
|
||||
_eglGlobal.OpenVGAPISupported = EGL_FALSE;
|
||||
|
||||
/* XXX temporary */
|
||||
_eglGlobal.ThreadInfo.CurrentContext = EGL_NO_CONTEXT;
|
||||
_eglGlobal.ThreadInfo.LastError = EGL_SUCCESS;
|
||||
_eglGlobal.ThreadInfo = _eglNewThreadInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +42,33 @@ _eglDestroyGlobals(void)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allocate and init a new _EGLThreadInfo object.
|
||||
*/
|
||||
_EGLThreadInfo *
|
||||
_eglNewThreadInfo(void)
|
||||
{
|
||||
_EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo));
|
||||
if (t) {
|
||||
t->CurrentContext = EGL_NO_CONTEXT;
|
||||
t->LastError = EGL_SUCCESS;
|
||||
t->CurrentAPI = EGL_NONE;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete/free a _EGLThreadInfo object.
|
||||
*/
|
||||
void
|
||||
_eglDeleteThreadData(_EGLThreadInfo *t)
|
||||
{
|
||||
free(t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return pointer to calling thread's _EGLThreadInfo object.
|
||||
* Create a new one if needed.
|
||||
|
@ -46,8 +77,10 @@ _eglDestroyGlobals(void)
|
|||
_EGLThreadInfo *
|
||||
_eglGetCurrentThread(void)
|
||||
{
|
||||
_eglInitGlobals();
|
||||
|
||||
/* XXX temporary */
|
||||
return &_eglGlobal.ThreadInfo;
|
||||
return _eglGlobal.ThreadInfo;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ struct _egl_thread_info
|
|||
{
|
||||
EGLint LastError;
|
||||
_EGLContext *CurrentContext;
|
||||
EGLenum CurrentAPI;
|
||||
};
|
||||
|
||||
|
||||
|
@ -28,8 +29,12 @@ struct _egl_global
|
|||
|
||||
EGLScreenMESA FreeScreenHandle;
|
||||
|
||||
/* XXX temporary */
|
||||
_EGLThreadInfo ThreadInfo;
|
||||
/* XXX these may be temporary */
|
||||
EGLBoolean OpenGLESAPISupported;
|
||||
EGLBoolean OpenVGAPISupported;
|
||||
|
||||
/* XXX temporary - should be thread-specific data (TSD) */
|
||||
_EGLThreadInfo *ThreadInfo;
|
||||
};
|
||||
|
||||
|
||||
|
@ -44,6 +49,14 @@ extern void
|
|||
_eglDestroyGlobals(void);
|
||||
|
||||
|
||||
extern _EGLThreadInfo *
|
||||
_eglNewThreadInfo(void);
|
||||
|
||||
|
||||
extern void
|
||||
_eglDeleteThreadData(_EGLThreadInfo *t);
|
||||
|
||||
|
||||
extern _EGLThreadInfo *
|
||||
_eglGetCurrentThread(void);
|
||||
|
||||
|
|
|
@ -27,6 +27,11 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
|||
_EGLConfig *conf;
|
||||
EGLint width = 0, height = 0, largest = 0;
|
||||
EGLint texFormat = 0, texTarget = 0, mipmapTex = 0;
|
||||
EGLint renderBuffer = EGL_BACK_BUFFER;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint colorspace = EGL_COLORSPACE_sRGB;
|
||||
EGLint alphaFormat = EGL_ALPHA_FORMAT_NONPRE;
|
||||
#endif
|
||||
EGLint i;
|
||||
|
||||
switch (type) {
|
||||
|
@ -35,12 +40,14 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
|||
break;
|
||||
case EGL_PIXMAP_BIT:
|
||||
func = "eglCreatePixmapSurface";
|
||||
renderBuffer = EGL_SINGLE_BUFFER;
|
||||
break;
|
||||
case EGL_PBUFFER_BIT:
|
||||
func = "eglCreatePBufferSurface";
|
||||
break;
|
||||
case EGL_SCREEN_BIT_MESA:
|
||||
func = "eglCreateScreenSurface";
|
||||
renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
|
||||
break;
|
||||
default:
|
||||
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
|
||||
|
@ -113,6 +120,55 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
|||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_RENDER_BUFFER:
|
||||
if (type == EGL_WINDOW_BIT) {
|
||||
renderBuffer = attrib_list[++i];
|
||||
if (renderBuffer != EGL_BACK_BUFFER &&
|
||||
renderBuffer != EGL_SINGLE_BUFFER) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
case EGL_COLORSPACE:
|
||||
if (type == EGL_WINDOW_BIT ||
|
||||
type == EGL_PBUFFER_BIT ||
|
||||
type == EGL_PIXMAP_BIT) {
|
||||
colorspace = attrib_list[++i];
|
||||
if (colorspace != EGL_COLORSPACE_sRGB &&
|
||||
colorspace != EGL_COLORSPACE_LINEAR) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
case EGL_ALPHA_FORMAT:
|
||||
if (type == EGL_WINDOW_BIT ||
|
||||
type == EGL_PBUFFER_BIT ||
|
||||
type == EGL_PIXMAP_BIT) {
|
||||
alphaFormat = attrib_list[++i];
|
||||
if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE &&
|
||||
alphaFormat != EGL_ALPHA_FORMAT_PRE) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
|
@ -134,6 +190,15 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
|||
surf->MipmapTexture = mipmapTex;
|
||||
surf->MipmapLevel = 0;
|
||||
surf->SwapInterval = 0;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */
|
||||
surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */
|
||||
surf->VerticalResolution = EGL_UNKNOWN; /* set by caller */
|
||||
surf->AspectRatio = EGL_UNKNOWN; /* set by caller */
|
||||
surf->RenderBuffer = renderBuffer;
|
||||
surf->AlphaFormat = alphaFormat;
|
||||
surf->Colorspace = colorspace;
|
||||
#endif
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
@ -232,6 +297,11 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
|
|||
case EGL_CONFIG_ID:
|
||||
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
|
||||
return EGL_TRUE;
|
||||
/*XXX case EGL_LARGEST_PBUFFER:*/
|
||||
case EGL_SURFACE_TYPE:
|
||||
*value = surface->Type;
|
||||
return EGL_TRUE;
|
||||
#ifdef EGL_VERSION_1_1
|
||||
case EGL_TEXTURE_FORMAT:
|
||||
/* texture attributes: only for pbuffers, no error otherwise */
|
||||
if (surface->Type == EGL_PBUFFER_BIT)
|
||||
|
@ -249,9 +319,30 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
|
|||
if (surface->Type == EGL_PBUFFER_BIT)
|
||||
*value = surface->MipmapLevel;
|
||||
return EGL_TRUE;
|
||||
case EGL_SURFACE_TYPE:
|
||||
*value = surface->Type;
|
||||
#endif /* EGL_VERSION_1_1 */
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_SWAP_BEHAVIOR:
|
||||
*value = surface->SwapBehavior;
|
||||
return EGL_TRUE;
|
||||
case EGL_RENDER_BUFFER:
|
||||
*value = surface->RenderBuffer;
|
||||
return EGL_TRUE;
|
||||
case EGL_PIXEL_ASPECT_RATIO:
|
||||
*value = surface->AspectRatio;
|
||||
return EGL_TRUE;
|
||||
case EGL_HORIZONTAL_RESOLUTION:
|
||||
*value = surface->HorizontalResolution;
|
||||
return EGL_TRUE;
|
||||
case EGL_VERTICAL_RESOLUTION:
|
||||
*value = surface->VerticalResolution;
|
||||
return EGL_TRUE;
|
||||
case EGL_ALPHA_FORMAT:
|
||||
*value = surface->AlphaFormat;
|
||||
return EGL_TRUE;
|
||||
case EGL_COLORSPACE:
|
||||
*value = surface->Colorspace;
|
||||
return EGL_TRUE;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
|
||||
return EGL_FALSE;
|
||||
|
@ -416,3 +507,24 @@ _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval)
|
|||
surf->SwapInterval = interval;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
/**
|
||||
* Example function - drivers should do a proper implementation.
|
||||
*/
|
||||
EGLSurface
|
||||
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
|
||||
EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list)
|
||||
{
|
||||
if (buftype != EGL_OPENVG_IMAGE) {
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer");
|
||||
return ELG_NO_SURFACE;
|
||||
}
|
||||
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
|
|
@ -25,6 +25,15 @@ struct _egl_surface
|
|||
|
||||
/* If type == EGL_SCREEN_BIT: */
|
||||
EGLint VisibleRefCount; /* number of screens I'm displayed on */
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
|
||||
EGLint HorizontalResolution, VerticalResolution;
|
||||
EGLint AspectRatio;
|
||||
EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
|
||||
EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
|
||||
EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
};
|
||||
|
||||
|
||||
|
@ -94,4 +103,15 @@ extern EGLBoolean
|
|||
_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
extern EGLSurface
|
||||
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
|
||||
EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
|
||||
|
||||
#endif /* EGLSURFACE_INCLUDED */
|
||||
|
|
Loading…
Reference in New Issue