From 53f46d32e2951738f42cf429119d4018dc0b8b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 28 Feb 2017 20:27:10 +0100 Subject: [PATCH] Make OSMesa backend an almost proper null backend It still depends on POSIX time and TLS. --- src/CMakeLists.txt | 7 +++---- src/internal.h | 2 +- src/{osmesa_init.c => null_init.c} | 4 ++-- src/{osmesa_monitor.c => null_monitor.c} | 2 +- src/{osmesa_platform.h => null_platform.h} | 16 ++++++++-------- src/{osmesa_window.c => null_window.c} | 20 ++++++++++---------- 6 files changed, 25 insertions(+), 26 deletions(-) rename src/{osmesa_init.c => null_init.c} (95%) rename src/{osmesa_monitor.c => null_monitor.c} (98%) rename src/{osmesa_platform.h => null_platform.h} (87%) rename src/{osmesa_window.c => null_window.c} (93%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c3afb8f..4ddb41cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,11 +53,10 @@ elseif (_GLFW_MIR) linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c egl_context.c) elseif (_GLFW_OSMESA) - set(glfw_HEADERS ${common_HEADERS} osmesa_platform.h null_joystick.h + set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h posix_time.h posix_tls.h osmesa_context.h) - set(glfw_SOURCES ${common_SOURCES} osmesa_init.c osmesa_monitor.c - osmesa_window.c null_joystick.c posix_time.c posix_tls.c - osmesa_context.c) + set(glfw_SOURCES ${common_SOURCES} null_init.c null_monitor.c null_window.c + null_joystick.c posix_time.c posix_tls.c osmesa_context.c) endif() if (APPLE) diff --git a/src/internal.h b/src/internal.h index e8ba6eec..eec0c9a7 100644 --- a/src/internal.h +++ b/src/internal.h @@ -184,7 +184,7 @@ typedef void (APIENTRY * PFN_vkVoidFunction)(void); #elif defined(_GLFW_MIR) #include "mir_platform.h" #elif defined(_GLFW_OSMESA) - #include "osmesa_platform.h" + #include "null_platform.h" #else #error "No supported window creation API selected" #endif diff --git a/src/osmesa_init.c b/src/null_init.c similarity index 95% rename from src/osmesa_init.c rename to src/null_init.c index a0142044..e2c9c74b 100644 --- a/src/osmesa_init.c +++ b/src/null_init.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.3 OSMesa - www.glfw.org +// GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2006-2016 Camilla Löwy @@ -49,6 +49,6 @@ void _glfwPlatformTerminate(void) const char* _glfwPlatformGetVersionString(void) { - return _GLFW_VERSION_NUMBER " none OSMesa"; + return _GLFW_VERSION_NUMBER " null OSMesa"; } diff --git a/src/osmesa_monitor.c b/src/null_monitor.c similarity index 98% rename from src/osmesa_monitor.c rename to src/null_monitor.c index d996a802..f5678bbc 100644 --- a/src/osmesa_monitor.c +++ b/src/null_monitor.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.3 OSMesa - www.glfw.org +// GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2006-2016 Camilla Löwy diff --git a/src/osmesa_platform.h b/src/null_platform.h similarity index 87% rename from src/osmesa_platform.h rename to src/null_platform.h index 0d929bda..3218610d 100644 --- a/src/osmesa_platform.h +++ b/src/null_platform.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.3 OSMesa - www.glfw.org +// GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2006-2016 Camilla Löwy @@ -25,12 +25,12 @@ // //======================================================================== -#ifndef _glfw3_osmesa_platform_h_ -#define _glfw3_osmesa_platform_h_ +#ifndef _glfw3_null_platform_h_ +#define _glfw3_null_platform_h_ #include -#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowOSMesa osmesa +#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null #define _GLFW_PLATFORM_CONTEXT_STATE #define _GLFW_PLATFORM_MONITOR_STATE @@ -55,13 +55,13 @@ #define _glfw_dlsym(handle, name) dlsym(handle, name) #endif -// OSMesa-specific per-window data +// Null-specific per-window data // -typedef struct _GLFWwindowOSMesa +typedef struct _GLFWwindowNull { int width; int height; -} _GLFWwindowOSMesa; +} _GLFWwindowNull; -#endif // _glfw3_osmesa_platform_h_ +#endif // _glfw3_null_platform_h_ diff --git a/src/osmesa_window.c b/src/null_window.c similarity index 93% rename from src/osmesa_window.c rename to src/null_window.c index def78e9b..7e564de3 100644 --- a/src/osmesa_window.c +++ b/src/null_window.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.3 OSMesa - www.glfw.org +// GLFW 3.3 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2006-2016 Camilla Löwy @@ -31,8 +31,8 @@ static int createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { - window->osmesa.width = wndconfig->width; - window->osmesa.height = wndconfig->height; + window->null.width = wndconfig->width; + window->null.height = wndconfig->height; return GLFW_TRUE; } @@ -62,7 +62,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, } else { - _glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: EGL not available"); + _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); return GLFW_FALSE; } } @@ -104,15 +104,15 @@ void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { if (width) - *width = window->osmesa.width; + *width = window->null.width; if (height) - *height = window->osmesa.height; + *height = window->null.height; } void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { - window->osmesa.width = width; - window->osmesa.height = height; + window->null.width = width; + window->null.height = height; } void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, @@ -128,9 +128,9 @@ void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d) void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { if (width) - *width = window->osmesa.width; + *width = window->null.width; if (height) - *height = window->osmesa.height; + *height = window->null.height; } void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,