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 @@
#define MAJOR_VERSION 4
#define MINOR_VERSION 1
#define BUILD_VERSION 0
#define BUILD_REVISION 1
#define BUILD_REVISION 2
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -284,7 +284,7 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
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);
......
......@@ -59,7 +59,7 @@ namespace egl
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
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);
EGLContext createContext(EGLConfig configHandle, const Context *shareContext, EGLint clientVersion);
EGLSyncKHR createSync(Context *context);
......
......@@ -4,14 +4,21 @@ global:
eglBindAPI;
eglBindTexImage;
eglChooseConfig;
eglClientWaitSync;
eglCopyBuffers;
eglCreateContext;
eglCreateImage;
eglCreatePbufferFromClientBuffer;
eglCreatePbufferSurface;
eglCreatePixmapSurface;
eglCreatePlatformPixmapSurface;
eglCreatePlatformWindowSurface;
eglCreateSync;
eglCreateWindowSurface;
eglDestroyContext;
eglDestroyImage;
eglDestroySurface;
eglDestroySync;
eglGetConfigAttrib;
eglGetConfigs;
eglGetCurrentContext;
......@@ -19,7 +26,9 @@ global:
eglGetCurrentSurface;
eglGetDisplay;
eglGetError;
eglGetPlatformDisplay;
eglGetProcAddress;
eglGetSyncAttrib;
eglInitialize;
eglMakeCurrent;
eglQueryAPI;
......@@ -35,6 +44,7 @@ global:
eglWaitClient;
eglWaitGL;
eglWaitNative;
eglWaitSync;
# Extensions
eglCreateImageKHR;
......@@ -56,4 +66,4 @@ global:
local:
*;
};
\ No newline at end of file
};
......@@ -368,14 +368,20 @@ EGLBoolean WaitNative(EGLint engine);
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface surface);
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
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);
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 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 CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *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);
EGLint ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
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);
}
......@@ -551,46 +557,101 @@ EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx,
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
return egl::GetProcAddress(procname);
......
......@@ -6280,16 +6280,6 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP
__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[] =
{
#define FUNCTION(name) {#name, (__eglMustCastToProperFunctionPointerType)name}
......@@ -6593,12 +6583,29 @@ extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetP
static const size_t numFunctions = sizeof glFunctions / sizeof(Function);
static const Function *const glFunctionsEnd = glFunctions + numFunctions;
Function needle;
needle.name = procname;
// The 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.
#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)
{
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());
if(result != glFunctionsEnd && strcmp(procname, result->name) == 0)
{
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