Commit 48908cb9 by Nicolas Capens Committed by Nicolas Capens

Add EGL 1.5 entry points.

This enables running dEQP on Linux when it was built against an EGL 1.5 capable driver. Note that this is not a complete EGL 1.5 implementation. Change-Id: Ie29d9ec61e7e3694eb8862aad7432b77fe7c7bae Reviewed-on: https://swiftshader-review.googlesource.com/15909Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 02956e4c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define MAJOR_VERSION 4 #define MAJOR_VERSION 4
#define MINOR_VERSION 1 #define MINOR_VERSION 1
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 1 #define BUILD_REVISION 2
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -284,7 +284,7 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value) ...@@ -284,7 +284,7 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
return true; return true;
} }
EGLSurface Display::createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLint *attribList) EGLSurface Display::createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLAttrib *attribList)
{ {
const Config *configuration = mConfigSet.get(config); const Config *configuration = mConfigSet.get(config);
......
...@@ -59,7 +59,7 @@ namespace egl ...@@ -59,7 +59,7 @@ namespace egl
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value); bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
EGLSurface createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLint *attribList); EGLSurface createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLAttrib *attribList);
EGLSurface createPBufferSurface(EGLConfig config, const EGLint *attribList, EGLClientBuffer clientBuffer = nullptr); EGLSurface createPBufferSurface(EGLConfig config, const EGLint *attribList, EGLClientBuffer clientBuffer = nullptr);
EGLContext createContext(EGLConfig configHandle, const Context *shareContext, EGLint clientVersion); EGLContext createContext(EGLConfig configHandle, const Context *shareContext, EGLint clientVersion);
EGLSyncKHR createSync(Context *context); EGLSyncKHR createSync(Context *context);
......
...@@ -30,11 +30,14 @@ ...@@ -30,11 +30,14 @@
#endif #endif
#include <algorithm> #include <algorithm>
#include <vector>
#include <string.h> #include <string.h>
using namespace egl; namespace egl
{
static bool validateDisplay(egl::Display *display) namespace
{
bool validateDisplay(egl::Display *display)
{ {
if(display == EGL_NO_DISPLAY) if(display == EGL_NO_DISPLAY)
{ {
...@@ -49,7 +52,7 @@ static bool validateDisplay(egl::Display *display) ...@@ -49,7 +52,7 @@ static bool validateDisplay(egl::Display *display)
return true; return true;
} }
static bool validateConfig(egl::Display *display, EGLConfig config) bool validateConfig(egl::Display *display, EGLConfig config)
{ {
if(!validateDisplay(display)) if(!validateDisplay(display))
{ {
...@@ -64,7 +67,7 @@ static bool validateConfig(egl::Display *display, EGLConfig config) ...@@ -64,7 +67,7 @@ static bool validateConfig(egl::Display *display, EGLConfig config)
return true; return true;
} }
static bool validateContext(egl::Display *display, egl::Context *context) bool validateContext(egl::Display *display, egl::Context *context)
{ {
if(!validateDisplay(display)) if(!validateDisplay(display))
{ {
...@@ -79,7 +82,7 @@ static bool validateContext(egl::Display *display, egl::Context *context) ...@@ -79,7 +82,7 @@ static bool validateContext(egl::Display *display, egl::Context *context)
return true; return true;
} }
static bool validateSurface(egl::Display *display, egl::Surface *surface) bool validateSurface(egl::Display *display, egl::Surface *surface)
{ {
if(!validateDisplay(display)) if(!validateDisplay(display))
{ {
...@@ -94,8 +97,34 @@ static bool validateSurface(egl::Display *display, egl::Surface *surface) ...@@ -94,8 +97,34 @@ static bool validateSurface(egl::Display *display, egl::Surface *surface)
return true; return true;
} }
namespace egl // Class to facilitate conversion from EGLint to EGLAttrib lists.
class EGLAttribs
{ {
public:
explicit EGLAttribs(const EGLint *attrib_list)
{
if(attrib_list)
{
while(*attrib_list != EGL_NONE)
{
attrib.push_back(static_cast<EGLAttrib>(*attrib_list));
attrib_list++;
}
}
attrib.push_back(EGL_NONE);
}
operator const EGLAttrib*() const
{
return &attrib[0];
}
private:
std::vector<EGLAttrib> attrib;
};
}
EGLint GetError(void) EGLint GetError(void)
{ {
TRACE("()"); TRACE("()");
...@@ -301,10 +330,10 @@ EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, E ...@@ -301,10 +330,10 @@ EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, E
return success(EGL_TRUE); return success(EGL_TRUE);
} }
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list) EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
{ {
TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLNativeWindowType win = %p, " TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_window = %p, "
"const EGLint *attrib_list = %p)", dpy, config, window, attrib_list); "const EGLint *attrib_list = %p)", dpy, config, native_window, attrib_list);
egl::Display *display = egl::Display::get(dpy); egl::Display *display = egl::Display::get(dpy);
...@@ -313,12 +342,30 @@ EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindow ...@@ -313,12 +342,30 @@ EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindow
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
} }
if(!display->isValidWindow(window)) if(!display->isValidWindow((EGLNativeWindowType)native_window))
{ {
return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
} }
return display->createWindowSurface(window, config, attrib_list); return display->createWindowSurface((EGLNativeWindowType)native_window, config, attrib_list);
}
EGLSurface CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list)
{
TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_window = %p, "
"const EGLint *attrib_list = %p)", dpy, config, native_window, attrib_list);
EGLAttribs attribs(attrib_list);
return CreatePlatformWindowSurface(dpy, config, native_window, attribs);
}
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list)
{
TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLNativeWindowType window = %p, "
"const EGLint *attrib_list = %p)", dpy, config, window, attrib_list);
EGLAttribs attribs(attrib_list);
return CreatePlatformWindowSurface(dpy, config, (void*)window, attribs);
} }
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
...@@ -336,10 +383,10 @@ EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint * ...@@ -336,10 +383,10 @@ EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *
return display->createPBufferSurface(config, attrib_list); return display->createPBufferSurface(config, attrib_list);
} }
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
{ {
TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLNativePixmapType pixmap = %p, " TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_pixmap = %p, "
"const EGLint *attrib_list = %p)", dpy, config, pixmap, attrib_list); "const EGLint *attrib_list = %p)", dpy, config, native_pixmap, attrib_list);
egl::Display *display = egl::Display::get(dpy); egl::Display *display = egl::Display::get(dpy);
...@@ -353,6 +400,24 @@ EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmap ...@@ -353,6 +400,24 @@ EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmap
return success(EGL_NO_SURFACE); return success(EGL_NO_SURFACE);
} }
EGLSurface CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list)
{
TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_pixmap = %p, "
"const EGLint *attrib_list = %p)", dpy, config, native_pixmap, attrib_list);
EGLAttribs attribs(attrib_list);
return CreatePlatformPixmapSurface(dpy, config, native_pixmap, attribs);
}
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
{
TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLNativePixmapType pixmap = %p, "
"const EGLint *attrib_list = %p)", dpy, config, pixmap, attrib_list);
EGLAttribs attribs(attrib_list);
return CreatePlatformPixmapSurface(dpy, config, (void*)pixmap, attribs);
}
EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface) EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface)
{ {
TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p)", dpy, surface); TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p)", dpy, surface);
...@@ -1062,9 +1127,9 @@ EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType t ...@@ -1062,9 +1127,9 @@ EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType t
return success(EGL_FALSE); return success(EGL_FALSE);
} }
EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
{ {
TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p, EGLenum target = 0x%X, buffer = %p, const EGLint attrib_list = %p)", dpy, ctx, target, buffer, attrib_list); TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p, EGLenum target = 0x%X, buffer = %p, const EGLAttrib *attrib_list = %p)", dpy, ctx, target, buffer, attrib_list);
egl::Display *display = egl::Display::get(dpy); egl::Display *display = egl::Display::get(dpy);
egl::Context *context = static_cast<egl::Context*>(ctx); egl::Context *context = static_cast<egl::Context*>(ctx);
...@@ -1083,15 +1148,15 @@ EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLCl ...@@ -1083,15 +1148,15 @@ EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLCl
GLuint textureLevel = 0; GLuint textureLevel = 0;
if(attrib_list) if(attrib_list)
{ {
for(const EGLint *attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2) for(const EGLAttrib *attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2)
{ {
if(attribute[0] == EGL_IMAGE_PRESERVED_KHR) if(attribute[0] == EGL_IMAGE_PRESERVED_KHR)
{ {
imagePreserved = attribute[1]; imagePreserved = static_cast<EGLenum>(attribute[1]);
} }
else if(attribute[0] == EGL_GL_TEXTURE_LEVEL_KHR) else if(attribute[0] == EGL_GL_TEXTURE_LEVEL_KHR)
{ {
textureLevel = attribute[1]; textureLevel = static_cast<GLuint>(attribute[1]);
} }
else else
{ {
...@@ -1144,11 +1209,19 @@ EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLCl ...@@ -1144,11 +1209,19 @@ EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLCl
return error(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); return error(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
} }
EGLImageKHR eglImage = display->createSharedImage(image); EGLImage eglImage = display->createSharedImage(image);
return success(eglImage); return success(eglImage);
} }
EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
{
TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p, EGLenum target = 0x%X, buffer = %p, const EGLint attrib_list = %p)", dpy, ctx, target, buffer, attrib_list);
EGLAttribs attribs(attrib_list);
return CreateImage(dpy, ctx, target, buffer, attribs);
}
EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
{ {
TRACE("(EGLDisplay dpy = %p, EGLImageKHR image = %p)", dpy, image); TRACE("(EGLDisplay dpy = %p, EGLImageKHR image = %p)", dpy, image);
...@@ -1168,44 +1241,41 @@ EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) ...@@ -1168,44 +1241,41 @@ EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
return success(EGL_TRUE); return success(EGL_TRUE);
} }
EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) EGLDisplay GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
{ {
TRACE("(EGLenum platform = 0x%X, void *native_display = %p, const EGLint *attrib_list = %p)", platform, native_display, attrib_list); TRACE("(EGLenum platform = 0x%X, void *native_display = %p, const EGLAttrib *attrib_list = %p)", platform, native_display, attrib_list);
#if defined(__linux__) && !defined(__ANDROID__) #if defined(__linux__) && !defined(__ANDROID__)
switch(platform) switch(platform)
{ {
#if defined(USE_X11) case EGL_PLATFORM_X11_EXT:
case EGL_PLATFORM_X11_EXT: break; case EGL_PLATFORM_GBM_KHR:
#endif break;
case EGL_PLATFORM_GBM_KHR: break;
default: default:
return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY); return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
} }
if(platform == EGL_PLATFORM_GBM_KHR) if(platform == EGL_PLATFORM_X11_EXT)
{ {
if(!libX11)
{
return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY);
}
if(native_display != (void*)EGL_DEFAULT_DISPLAY || attrib_list != NULL) if(native_display != (void*)EGL_DEFAULT_DISPLAY || attrib_list != NULL)
{ {
return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY); // Unimplemented return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY); // Unimplemented
} }
return success(HEADLESS_DISPLAY);
} }
#if defined(USE_X11) else if(platform == EGL_PLATFORM_GBM_KHR)
else if(platform == EGL_PLATFORM_X11_EXT)
{ {
if(!libX11)
{
return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY);
}
if(native_display != (void*)EGL_DEFAULT_DISPLAY || attrib_list != NULL) if(native_display != (void*)EGL_DEFAULT_DISPLAY || attrib_list != NULL)
{ {
return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY); // Unimplemented return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY); // Unimplemented
} }
return success(HEADLESS_DISPLAY);
} }
#endif
return success(PRIMARY_DISPLAY); // We only support the default display return success(PRIMARY_DISPLAY); // We only support the default display
#else #else
...@@ -1213,19 +1283,17 @@ EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const E ...@@ -1213,19 +1283,17 @@ EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const E
#endif #endif
} }
EGLSurface CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list) EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
{ {
return CreateWindowSurface(dpy, config, (EGLNativeWindowType)native_window, attrib_list); TRACE("(EGLenum platform = 0x%X, void *native_display = %p, const EGLint *attrib_list = %p)", platform, native_display, attrib_list);
}
EGLSurface CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list) EGLAttribs attribs(attrib_list);
{ return GetPlatformDisplay(platform, native_display, attribs);
return CreatePixmapSurface(dpy, config, (EGLNativePixmapType)native_pixmap, attrib_list);
} }
EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
{ {
TRACE("(EGLDisplay dpy = %p, EGLunum type = %x, EGLint *attrib_list=%p)", dpy, type, attrib_list); TRACE("(EGLDisplay dpy = %p, EGLunum type = %x, EGLAttrib *attrib_list=%p)", dpy, type, attrib_list);
egl::Display *display = egl::Display::get(dpy); egl::Display *display = egl::Display::get(dpy);
...@@ -1256,6 +1324,14 @@ EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list ...@@ -1256,6 +1324,14 @@ EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list
return success(sync); return success(sync);
} }
EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
{
TRACE("(EGLDisplay dpy = %p, EGLunum type = %x, EGLint *attrib_list=%p)", dpy, type, attrib_list);
EGLAttribs attribs(attrib_list);
return CreateSync(dpy, type, attribs);
}
EGLBoolean DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) EGLBoolean DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
{ {
TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p)", dpy, sync); TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p)", dpy, sync);
...@@ -1306,9 +1382,9 @@ EGLint ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeK ...@@ -1306,9 +1382,9 @@ EGLint ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeK
return success(EGL_CONDITION_SATISFIED_KHR); return success(EGL_CONDITION_SATISFIED_KHR);
} }
EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLAttrib *value)
{ {
TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p, EGLint attribute = %x, EGLint *value = %p)", dpy, sync, attribute, value); TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p, EGLint attribute = %x, EGLAttrib *value = %p)", dpy, sync, attribute, value);
egl::Display *display = egl::Display::get(dpy); egl::Display *display = egl::Display::get(dpy);
FenceSync *eglSync = static_cast<FenceSync*>(sync); FenceSync *eglSync = static_cast<FenceSync*>(sync);
...@@ -1340,6 +1416,14 @@ EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, E ...@@ -1340,6 +1416,14 @@ EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, E
} }
} }
EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
{
EGLAttrib attrib_value;
EGLBoolean result = GetSyncAttrib(dpy, sync, attribute, &attrib_value);
*value = static_cast<EGLint>(attrib_value);
return result;
}
__eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname) __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname)
{ {
TRACE("(const char *procname = \"%s\")", procname); TRACE("(const char *procname = \"%s\")", procname);
...@@ -1367,20 +1451,27 @@ __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname) ...@@ -1367,20 +1451,27 @@ __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname)
FUNCTION(eglBindAPI), FUNCTION(eglBindAPI),
FUNCTION(eglBindTexImage), FUNCTION(eglBindTexImage),
FUNCTION(eglChooseConfig), FUNCTION(eglChooseConfig),
FUNCTION(eglClientWaitSync),
FUNCTION(eglClientWaitSyncKHR), FUNCTION(eglClientWaitSyncKHR),
FUNCTION(eglCopyBuffers), FUNCTION(eglCopyBuffers),
FUNCTION(eglCreateContext), FUNCTION(eglCreateContext),
FUNCTION(eglCreateImage),
FUNCTION(eglCreateImageKHR), FUNCTION(eglCreateImageKHR),
FUNCTION(eglCreatePbufferFromClientBuffer), FUNCTION(eglCreatePbufferFromClientBuffer),
FUNCTION(eglCreatePbufferSurface), FUNCTION(eglCreatePbufferSurface),
FUNCTION(eglCreatePixmapSurface), FUNCTION(eglCreatePixmapSurface),
FUNCTION(eglCreatePlatformPixmapSurface),
FUNCTION(eglCreatePlatformPixmapSurfaceEXT), FUNCTION(eglCreatePlatformPixmapSurfaceEXT),
FUNCTION(eglCreatePlatformWindowSurface),
FUNCTION(eglCreatePlatformWindowSurfaceEXT), FUNCTION(eglCreatePlatformWindowSurfaceEXT),
FUNCTION(eglCreateSync),
FUNCTION(eglCreateSyncKHR), FUNCTION(eglCreateSyncKHR),
FUNCTION(eglCreateWindowSurface), FUNCTION(eglCreateWindowSurface),
FUNCTION(eglDestroyContext), FUNCTION(eglDestroyContext),
FUNCTION(eglDestroyImage),
FUNCTION(eglDestroyImageKHR), FUNCTION(eglDestroyImageKHR),
FUNCTION(eglDestroySurface), FUNCTION(eglDestroySurface),
FUNCTION(eglDestroySync),
FUNCTION(eglDestroySyncKHR), FUNCTION(eglDestroySyncKHR),
FUNCTION(eglGetConfigAttrib), FUNCTION(eglGetConfigAttrib),
FUNCTION(eglGetConfigs), FUNCTION(eglGetConfigs),
...@@ -1389,8 +1480,10 @@ __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname) ...@@ -1389,8 +1480,10 @@ __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname)
FUNCTION(eglGetCurrentSurface), FUNCTION(eglGetCurrentSurface),
FUNCTION(eglGetDisplay), FUNCTION(eglGetDisplay),
FUNCTION(eglGetError), FUNCTION(eglGetError),
FUNCTION(eglGetPlatformDisplay),
FUNCTION(eglGetPlatformDisplayEXT), FUNCTION(eglGetPlatformDisplayEXT),
FUNCTION(eglGetProcAddress), FUNCTION(eglGetProcAddress),
FUNCTION(eglGetSyncAttrib),
FUNCTION(eglGetSyncAttribKHR), FUNCTION(eglGetSyncAttribKHR),
FUNCTION(eglInitialize), FUNCTION(eglInitialize),
FUNCTION(eglMakeCurrent), FUNCTION(eglMakeCurrent),
...@@ -1407,6 +1500,8 @@ __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname) ...@@ -1407,6 +1500,8 @@ __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname)
FUNCTION(eglWaitClient), FUNCTION(eglWaitClient),
FUNCTION(eglWaitGL), FUNCTION(eglWaitGL),
FUNCTION(eglWaitNative), FUNCTION(eglWaitNative),
FUNCTION(eglWaitSync),
FUNCTION(eglWaitSyncKHR),
#undef FUNCTION #undef FUNCTION
}; };
......
...@@ -4,14 +4,21 @@ global: ...@@ -4,14 +4,21 @@ global:
eglBindAPI; eglBindAPI;
eglBindTexImage; eglBindTexImage;
eglChooseConfig; eglChooseConfig;
eglClientWaitSync;
eglCopyBuffers; eglCopyBuffers;
eglCreateContext; eglCreateContext;
eglCreateImage;
eglCreatePbufferFromClientBuffer; eglCreatePbufferFromClientBuffer;
eglCreatePbufferSurface; eglCreatePbufferSurface;
eglCreatePixmapSurface; eglCreatePixmapSurface;
eglCreatePlatformPixmapSurface;
eglCreatePlatformWindowSurface;
eglCreateSync;
eglCreateWindowSurface; eglCreateWindowSurface;
eglDestroyContext; eglDestroyContext;
eglDestroyImage;
eglDestroySurface; eglDestroySurface;
eglDestroySync;
eglGetConfigAttrib; eglGetConfigAttrib;
eglGetConfigs; eglGetConfigs;
eglGetCurrentContext; eglGetCurrentContext;
...@@ -19,7 +26,9 @@ global: ...@@ -19,7 +26,9 @@ global:
eglGetCurrentSurface; eglGetCurrentSurface;
eglGetDisplay; eglGetDisplay;
eglGetError; eglGetError;
eglGetPlatformDisplay;
eglGetProcAddress; eglGetProcAddress;
eglGetSyncAttrib;
eglInitialize; eglInitialize;
eglMakeCurrent; eglMakeCurrent;
eglQueryAPI; eglQueryAPI;
...@@ -35,6 +44,7 @@ global: ...@@ -35,6 +44,7 @@ global:
eglWaitClient; eglWaitClient;
eglWaitGL; eglWaitGL;
eglWaitNative; eglWaitNative;
eglWaitSync;
# Extensions # Extensions
eglCreateImageKHR; eglCreateImageKHR;
...@@ -56,4 +66,4 @@ global: ...@@ -56,4 +66,4 @@ global:
local: local:
*; *;
}; };
\ No newline at end of file
...@@ -368,14 +368,20 @@ EGLBoolean WaitNative(EGLint engine); ...@@ -368,14 +368,20 @@ EGLBoolean WaitNative(EGLint engine);
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface surface); EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface surface);
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
EGLImageKHR CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image); EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image);
EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list); EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
EGLDisplay GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
EGLSurface CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); EGLSurface CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
EGLSurface CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); EGLSurface CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
EGLSyncKHR CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
EGLBoolean DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); EGLBoolean DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
EGLint ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); EGLint ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLAttrib *value);
__eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname); __eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname);
} }
...@@ -551,46 +557,101 @@ EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, ...@@ -551,46 +557,101 @@ EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx,
return egl::CreateImageKHR(dpy, ctx, target, buffer, attrib_list); return egl::CreateImageKHR(dpy, ctx, target, buffer, attrib_list);
} }
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
{
return egl::CreateImage(dpy, ctx, target, buffer, attrib_list);
}
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
{ {
return egl::DestroyImageKHR(dpy, image); return egl::DestroyImageKHR(dpy, image);
} }
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImageKHR image)
{
return egl::DestroyImageKHR(dpy, image);
}
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
{ {
return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list); return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
} }
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
{
return egl::GetPlatformDisplay(platform, native_display, attrib_list);
}
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list) EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list)
{ {
return egl::CreatePlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list); return egl::CreatePlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list);
} }
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
{
return egl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
}
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list) EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list)
{ {
return egl::CreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list); return egl::CreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list);
} }
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
{
return egl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
}
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
{ {
return egl::CreateSyncKHR(dpy, type, attrib_list); return egl::CreateSyncKHR(dpy, type, attrib_list);
} }
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
{
return egl::CreateSync(dpy, type, attrib_list);
}
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
{ {
return egl::DestroySyncKHR(dpy, sync); return egl::DestroySyncKHR(dpy, sync);
} }
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync(EGLDisplay dpy, EGLSyncKHR sync)
{
return egl::DestroySyncKHR(dpy, sync);
}
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
{ {
return egl::ClientWaitSyncKHR(dpy, sync, flags, timeout); return egl::ClientWaitSyncKHR(dpy, sync, flags, timeout);
} }
EGLAPI EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
{
return egl::ClientWaitSyncKHR(dpy, sync, flags, timeout);
}
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
{ {
return egl::GetSyncAttribKHR(dpy, sync, attribute, value); return egl::GetSyncAttribKHR(dpy, sync, attribute, value);
} }
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLAttrib *value)
{
return egl::GetSyncAttrib(dpy, sync, attribute, value);
}
EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
{
return egl::ClientWaitSyncKHR(dpy, sync, flags, EGL_FOREVER_KHR);
}
EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
{
return egl::ClientWaitSyncKHR(dpy, sync, flags, EGL_FOREVER_KHR);
}
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
{ {
return egl::GetProcAddress(procname); return egl::GetProcAddress(procname);
......
...@@ -6280,16 +6280,6 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP ...@@ -6280,16 +6280,6 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP
__eglMustCastToProperFunctionPointerType address; __eglMustCastToProperFunctionPointerType address;
}; };
struct CompareFunctor
{
bool operator()(const Function &a, const Function &b) const
{
return strcmp(a.name, b.name) < 0;
}
};
// This array must be kept sorted with respect to strcmp(), so that binary search works correctly.
// The Unix command "LC_COLLATE=C sort" will generate the correct order.
static const Function glFunctions[] = static const Function glFunctions[] =
{ {
#define FUNCTION(name) {#name, (__eglMustCastToProperFunctionPointerType)name} #define FUNCTION(name) {#name, (__eglMustCastToProperFunctionPointerType)name}
...@@ -6593,12 +6583,29 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP ...@@ -6593,12 +6583,29 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP
static const size_t numFunctions = sizeof glFunctions / sizeof(Function); static const size_t numFunctions = sizeof glFunctions / sizeof(Function);
static const Function *const glFunctionsEnd = glFunctions + numFunctions; static const Function *const glFunctionsEnd = glFunctions + numFunctions;
Function needle; // The array must be kept sorted with respect to strcmp(), so that binary search works correctly.
needle.name = procname; // The Unix command "LC_COLLATE=C sort" will generate the correct order.
#ifndef NDEBUG
for(size_t i = 0; i < numFunctions - 1; i++)
{
ASSERT(strcmp(glFunctions[i].name, glFunctions[i + 1].name) < 0);
}
#endif
if(procname && strncmp("gl", procname, 2) == 0) if(procname && strncmp("gl", procname, 2) == 0)
{ {
struct CompareFunctor
{
bool operator()(const Function &a, const Function &b) const
{
return strcmp(a.name, b.name) < 0;
}
};
Function needle;
needle.name = procname;
const Function *result = std::lower_bound(glFunctions, glFunctionsEnd, needle, CompareFunctor()); const Function *result = std::lower_bound(glFunctions, glFunctionsEnd, needle, CompareFunctor());
if(result != glFunctionsEnd && strcmp(procname, result->name) == 0) if(result != glFunctionsEnd && strcmp(procname, result->name) == 0)
{ {
return (__eglMustCastToProperFunctionPointerType)result->address; return (__eglMustCastToProperFunctionPointerType)result->address;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment