OSMesa: Cleanup

Fixes formatting, semantics and documentation.  Adds
glfwGetOSMesaContext.  Adds support for OSMesa context attributes.
Updates changelog and credits.  Adds license and copyright headers.
Removes superfluous code (the shared code provides many conveniences).
Removes loading of unused OSMesa functions.  Removes empty platform
structs.  Fixes version string format.  Removes build dependency on
the OSMesa header and library (only the library is needed and only at
runtime).

Closes #850.
This commit is contained in:
Camilla Berglund
2016-10-13 17:24:51 +02:00
parent 368fa9475d
commit fef21361c5
14 changed files with 611 additions and 350 deletions
+44 -40
View File
@@ -1,15 +1,40 @@
//========================================================================
// GLFW 3.3 OSMesa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#ifndef _osmesa_platform_h_
#define _osmesa_platform_h_
#ifndef _glfw3_osmesa_platform_h_
#define _glfw3_osmesa_platform_h_
#include <dlfcn.h>
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowOSMesa osmesa
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorOSMesa osmesa
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorOSMesa osmesa
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWwinlibraryOSMesa osmesawin
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowOSMesa osmesa
#define _GLFW_PLATFORM_MONITOR_STATE
#define _GLFW_PLATFORM_CURSOR_STATE
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE
#define _GLFW_EGL_CONTEXT_STATE
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE
@@ -18,44 +43,23 @@
#include "posix_time.h"
#include "posix_tls.h"
#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
#define _glfw_dlclose(handle) dlclose(handle)
#define _glfw_dlsym(handle, name) dlsym(handle, name)
// TODO(dalyj) "PLACEHOLDER" variables are there to silence "empty struct"
// warnings
#if defined(_GLFW_WIN32)
#define _glfw_dlopen(name) LoadLibraryA(name)
#define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle)
#define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name)
#else
#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
#define _glfw_dlclose(handle) dlclose(handle)
#define _glfw_dlsym(handle, name) dlsym(handle, name)
#endif
// OSMesa-specific per-window data
//
typedef struct _GLFWwindowOSMesa
{
int width;
int height;
int width;
int height;
} _GLFWwindowOSMesa;
// OSMesa-specific global data
//
typedef struct _GLFWwinlibraryOSMesa
{
int PLACEHOLDER;
} _GLFWwinlibraryOSMesa;
// OSMesa-specific per-monitor data
//
typedef struct _GLFWmonitorOSMesa
{
int PLACEHOLDER;
} _GLFWmonitorOSMesa;
// OSMesa-specific per-cursor data
//
typedef struct _GLFWcursorOSMesa
{
int PLACEHOLDER;
} _GLFWcursorOSMesa;
#endif // _osmesa_platform_h_
#endif // _glfw3_osmesa_platform_h_