1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Make OSMesa backend an almost proper null backend

It still depends on POSIX time and TLS.
This commit is contained in:
Camilla Löwy 2017-02-28 20:27:10 +01:00
parent e9560ef021
commit 53f46d32e2
6 changed files with 25 additions and 26 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 <elmindreda@glfw.org>
@ -49,6 +49,6 @@ void _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void)
{
return _GLFW_VERSION_NUMBER " none OSMesa";
return _GLFW_VERSION_NUMBER " null OSMesa";
}

View File

@ -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 <elmindreda@glfw.org>

View File

@ -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 <elmindreda@glfw.org>
@ -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 <dlfcn.h>
#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_

View File

@ -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 <elmindreda@glfw.org>
@ -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,