diff --git a/src/egl_context.c b/src/egl_context.c index b9403dee..e9d8fee3 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -78,7 +78,7 @@ static const char* getErrorString(EGLint error) static int getConfigAttrib(EGLConfig config, int attrib) { int value; - _glfw_eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value); + eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value); return value; } @@ -93,7 +93,7 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* closest; int i, nativeCount, usableCount; - _glfw_eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount); + eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount); if (!nativeCount) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned"); @@ -101,8 +101,7 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig, } nativeConfigs = calloc(nativeCount, sizeof(EGLConfig)); - _glfw_eglGetConfigs(_glfw.egl.display, nativeConfigs, - nativeCount, &nativeCount); + eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount); usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig)); usableCount = 0; @@ -242,23 +241,20 @@ int _glfwInitContextAPI(void) _glfw.egl.GetProcAddress = _glfw_dlsym(_glfw.egl.handle, "eglGetProcAddress"); - _glfw.egl.display = - _glfw_eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY); + _glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY); if (_glfw.egl.display == EGL_NO_DISPLAY) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to get EGL display: %s", - getErrorString(_glfw_eglGetError())); + getErrorString(eglGetError())); return GLFW_FALSE; } - if (!_glfw_eglInitialize(_glfw.egl.display, - &_glfw.egl.major, - &_glfw.egl.minor)) + if (!eglInitialize(_glfw.egl.display, &_glfw.egl.major, &_glfw.egl.minor)) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to initialize EGL: %s", - getErrorString(_glfw_eglGetError())); + getErrorString(eglGetError())); return GLFW_FALSE; } @@ -274,11 +270,9 @@ int _glfwInitContextAPI(void) // void _glfwTerminateContextAPI(void) { - if (_glfw_eglTerminate) - _glfw_eglTerminate(_glfw.egl.display); - if (_glfw.egl.handle) { + eglTerminate(_glfw.egl.display); _glfw_dlclose(_glfw.egl.handle); _glfw.egl.handle = NULL; } @@ -315,21 +309,21 @@ int _glfwCreateContext(_GLFWwindow* window, if (ctxconfig->api == GLFW_OPENGL_ES_API) { - if (!_glfw_eglBindAPI(EGL_OPENGL_ES_API)) + if (!eglBindAPI(EGL_OPENGL_ES_API)) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to bind OpenGL ES: %s", - getErrorString(_glfw_eglGetError())); + getErrorString(eglGetError())); return GLFW_FALSE; } } else { - if (!_glfw_eglBindAPI(EGL_OPENGL_API)) + if (!eglBindAPI(EGL_OPENGL_API)) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to bind OpenGL: %s", - getErrorString(_glfw_eglGetError())); + getErrorString(eglGetError())); return GLFW_FALSE; } } @@ -401,27 +395,27 @@ int _glfwCreateContext(_GLFWwindow* window, // Context release behaviors (GL_KHR_context_flush_control) are not yet // supported on EGL but are not a hard constraint, so ignore and continue - window->context.egl.handle = _glfw_eglCreateContext(_glfw.egl.display, - config, share, attribs); + window->context.egl.handle = eglCreateContext(_glfw.egl.display, + config, share, attribs); if (window->context.egl.handle == EGL_NO_CONTEXT) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "EGL: Failed to create context: %s", - getErrorString(_glfw_eglGetError())); + getErrorString(eglGetError())); return GLFW_FALSE; } window->context.egl.surface = - _glfw_eglCreateWindowSurface(_glfw.egl.display, - config, - (EGLNativeWindowType)_GLFW_EGL_NATIVE_WINDOW, - NULL); + eglCreateWindowSurface(_glfw.egl.display, + config, + _GLFW_EGL_NATIVE_WINDOW, + NULL); if (window->context.egl.surface == EGL_NO_SURFACE) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to create window surface: %s", - getErrorString(_glfw_eglGetError())); + getErrorString(eglGetError())); return GLFW_FALSE; } @@ -515,13 +509,13 @@ void _glfwDestroyContext(_GLFWwindow* window) if (window->context.egl.surface) { - _glfw_eglDestroySurface(_glfw.egl.display, window->context.egl.surface); + eglDestroySurface(_glfw.egl.display, window->context.egl.surface); window->context.egl.surface = EGL_NO_SURFACE; } if (window->context.egl.handle) { - _glfw_eglDestroyContext(_glfw.egl.display, window->context.egl.handle); + eglDestroyContext(_glfw.egl.display, window->context.egl.handle); window->context.egl.handle = EGL_NO_CONTEXT; } } @@ -546,8 +540,8 @@ GLFWbool _glfwChooseVisual(const _GLFWctxconfig* ctxconfig, return GLFW_FALSE; } - _glfw_eglGetConfigAttrib(_glfw.egl.display, native, - EGL_NATIVE_VISUAL_ID, &visualID); + eglGetConfigAttrib(_glfw.egl.display, native, + EGL_NATIVE_VISUAL_ID, &visualID); desired.screen = _glfw.x11.screen; desired.visualid = visualID; @@ -577,17 +571,17 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) { if (window) { - _glfw_eglMakeCurrent(_glfw.egl.display, - window->context.egl.surface, - window->context.egl.surface, - window->context.egl.handle); + eglMakeCurrent(_glfw.egl.display, + window->context.egl.surface, + window->context.egl.surface, + window->context.egl.handle); } else { - _glfw_eglMakeCurrent(_glfw.egl.display, - EGL_NO_SURFACE, - EGL_NO_SURFACE, - EGL_NO_CONTEXT); + eglMakeCurrent(_glfw.egl.display, + EGL_NO_SURFACE, + EGL_NO_SURFACE, + EGL_NO_CONTEXT); } _glfwSetContextTLS(window); @@ -595,18 +589,17 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) void _glfwPlatformSwapBuffers(_GLFWwindow* window) { - _glfw_eglSwapBuffers(_glfw.egl.display, window->context.egl.surface); + eglSwapBuffers(_glfw.egl.display, window->context.egl.surface); } void _glfwPlatformSwapInterval(int interval) { - _glfw_eglSwapInterval(_glfw.egl.display, interval); + eglSwapInterval(_glfw.egl.display, interval); } int _glfwPlatformExtensionSupported(const char* extension) { - const char* extensions = _glfw_eglQueryString(_glfw.egl.display, - EGL_EXTENSIONS); + const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS); if (extensions) { if (_glfwStringInExtensionString(extension, extensions)) @@ -628,7 +621,7 @@ GLFWglproc _glfwPlatformGetProcAddress(const char* procname) return proc; } - return _glfw_eglGetProcAddress(procname); + return eglGetProcAddress(procname); } diff --git a/src/egl_context.h b/src/egl_context.h index 7de7439e..b803f015 100644 --- a/src/egl_context.h +++ b/src/egl_context.h @@ -96,6 +96,11 @@ typedef MirEGLNativeWindowType EGLNativeWindowType; #define EGL_NONE 0x3038 #define EGL_EXTENSIONS 0x3055 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 +#define EGL_NATIVE_VISUAL_ID 0x302e +#define EGL_NO_SURFACE ((EGLSurface) 0) +#define EGL_NO_DISPLAY ((EGLDisplay) 0) +#define EGL_NO_CONTEXT ((EGLContext) 0) + #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 @@ -106,13 +111,9 @@ typedef MirEGLNativeWindowType EGLNativeWindowType; #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb -#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd #define EGL_CONTEXT_FLAGS_KHR 0x30fc #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3 -#define EGL_NATIVE_VISUAL_ID 0x302e -#define EGL_NO_SURFACE ((EGLSurface) 0) -#define EGL_NO_DISPLAY ((EGLDisplay) 0) -#define EGL_NO_CONTEXT ((EGLContext) 0) typedef int EGLint; typedef unsigned int EGLBoolean; @@ -139,22 +140,22 @@ typedef EGLBoolean (EGLAPIENTRY * PFNEGLSWAPBUFFERSPROC)(EGLDisplay,EGLSurface); typedef EGLBoolean (EGLAPIENTRY * PFNEGLSWAPINTERVALPROC)(EGLDisplay,EGLint); typedef const char* (EGLAPIENTRY * PFNEGLQUERYSTRINGPROC)(EGLDisplay,EGLint); typedef GLFWglproc (EGLAPIENTRY * PFNEGLGETPROCADDRESSPROC)(const char*); -#define _glfw_eglGetConfigAttrib _glfw.egl.GetConfigAttrib -#define _glfw_eglGetConfigs _glfw.egl.GetConfigs -#define _glfw_eglGetDisplay _glfw.egl.GetDisplay -#define _glfw_eglGetError _glfw.egl.GetError -#define _glfw_eglInitialize _glfw.egl.Initialize -#define _glfw_eglTerminate _glfw.egl.Terminate -#define _glfw_eglBindAPI _glfw.egl.BindAPI -#define _glfw_eglCreateContext _glfw.egl.CreateContext -#define _glfw_eglDestroySurface _glfw.egl.DestroySurface -#define _glfw_eglDestroyContext _glfw.egl.DestroyContext -#define _glfw_eglCreateWindowSurface _glfw.egl.CreateWindowSurface -#define _glfw_eglMakeCurrent _glfw.egl.MakeCurrent -#define _glfw_eglSwapBuffers _glfw.egl.SwapBuffers -#define _glfw_eglSwapInterval _glfw.egl.SwapInterval -#define _glfw_eglQueryString _glfw.egl.QueryString -#define _glfw_eglGetProcAddress _glfw.egl.GetProcAddress +#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib +#define eglGetConfigs _glfw.egl.GetConfigs +#define eglGetDisplay _glfw.egl.GetDisplay +#define eglGetError _glfw.egl.GetError +#define eglInitialize _glfw.egl.Initialize +#define eglTerminate _glfw.egl.Terminate +#define eglBindAPI _glfw.egl.BindAPI +#define eglCreateContext _glfw.egl.CreateContext +#define eglDestroySurface _glfw.egl.DestroySurface +#define eglDestroyContext _glfw.egl.DestroyContext +#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface +#define eglMakeCurrent _glfw.egl.MakeCurrent +#define eglSwapBuffers _glfw.egl.SwapBuffers +#define eglSwapInterval _glfw.egl.SwapInterval +#define eglQueryString _glfw.egl.QueryString +#define eglGetProcAddress _glfw.egl.GetProcAddress #define _GLFW_PLATFORM_FBCONFIG EGLConfig egl #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextEGL egl diff --git a/src/mir_platform.h b/src/mir_platform.h index 2e5a7078..21ae0193 100644 --- a/src/mir_platform.h +++ b/src/mir_platform.h @@ -43,8 +43,8 @@ #error "The Mir backend depends on EGL platform support" #endif -#define _GLFW_EGL_NATIVE_WINDOW window->mir.window -#define _GLFW_EGL_NATIVE_DISPLAY _glfw.mir.display +#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->mir.window) +#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.mir.display) #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowMir mir #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorMir mir diff --git a/src/win32_platform.h b/src/win32_platform.h index 50129131..d4e1f7f4 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -146,7 +146,7 @@ typedef HRESULT (WINAPI * SETPROCESSDPIAWARENESS_T)(PROCESS_DPI_AWARENESS); #if defined(_GLFW_WGL) #include "wgl_context.h" #elif defined(_GLFW_EGL) - #define _GLFW_EGL_NATIVE_WINDOW window->win32.handle + #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->win32.handle) #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY #include "egl_context.h" #else diff --git a/src/wl_platform.h b/src/wl_platform.h index dc7530d4..389421cd 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -41,8 +41,8 @@ #error "The Wayland backend depends on EGL platform support" #endif -#define _GLFW_EGL_NATIVE_WINDOW window->wl.native -#define _GLFW_EGL_NATIVE_DISPLAY _glfw.wl.display +#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native) +#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display) #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl diff --git a/src/x11_platform.h b/src/x11_platform.h index bfc0d807..7f599a2e 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -64,8 +64,8 @@ #if defined(_GLFW_GLX) #include "glx_context.h" #elif defined(_GLFW_EGL) - #define _GLFW_EGL_NATIVE_WINDOW window->x11.handle - #define _GLFW_EGL_NATIVE_DISPLAY _glfw.x11.display + #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->x11.handle) + #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.x11.display) #include "egl_context.h" #else #error "No supported context creation API selected"