Null: Add non-functional EGL support

This is done in preparation for runtime platform selection, to make sure
every platform can build with EGL enabled.

It may be possible to add support for things like the ANGLE null
platform later.
This commit is contained in:
Camilla Löwy 2021-07-14 20:06:22 +02:00
parent 8b8d10bc01
commit d0776e04a3
3 changed files with 24 additions and 5 deletions

View File

@ -48,7 +48,8 @@ elseif (_GLFW_OSMESA)
target_sources(glfw PRIVATE null_platform.h null_joystick.h posix_time.h target_sources(glfw PRIVATE null_platform.h null_joystick.h posix_time.h
posix_thread.h osmesa_context.h null_init.c posix_thread.h osmesa_context.h null_init.c
null_monitor.c null_window.c null_joystick.c null_monitor.c null_window.c null_joystick.c
posix_time.c posix_thread.c osmesa_context.c) posix_time.c posix_thread.c egl_context.c
osmesa_context.c)
endif() endif()
if (_GLFW_X11 OR _GLFW_WAYLAND) if (_GLFW_X11 OR _GLFW_WAYLAND)

View File

@ -48,10 +48,11 @@ void _glfwPlatformTerminate(void)
{ {
_glfw_free(_glfw.null.clipboardString); _glfw_free(_glfw.null.clipboardString);
_glfwTerminateOSMesa(); _glfwTerminateOSMesa();
_glfwTerminateEGL();
} }
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
return _GLFW_VERSION_NUMBER " null OSMesa"; return _GLFW_VERSION_NUMBER " null OSMesa EGL";
} }

View File

@ -121,10 +121,12 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
return GLFW_FALSE; return GLFW_FALSE;
} }
else else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
{ {
_glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); if (!_glfwInitEGL())
return GLFW_FALSE; return GLFW_FALSE;
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
return GLFW_FALSE;
} }
} }
@ -522,6 +524,21 @@ const char* _glfwPlatformGetClipboardString(void)
return _glfw.null.clipboardString; return _glfw.null.clipboardString;
} }
EGLenum _glfwPlatformGetEGLPlatform(EGLint** attribs)
{
return 0;
}
EGLNativeDisplayType _glfwPlatformGetEGLNativeDisplay(void)
{
return 0;
}
EGLNativeWindowType _glfwPlatformGetEGLNativeWindow(_GLFWwindow* window)
{
return 0;
}
const char* _glfwPlatformGetScancodeName(int scancode) const char* _glfwPlatformGetScancodeName(int scancode)
{ {
if (scancode < GLFW_KEY_SPACE || scancode > GLFW_KEY_LAST) if (scancode < GLFW_KEY_SPACE || scancode > GLFW_KEY_LAST)