mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 08:50:15 +00:00
Split out TLS code into separate modules.
This allows the TLS code to be re-used by partial ports like EGL.
This commit is contained in:
+6
-22
@@ -32,22 +32,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// Thread local storage attribute macro
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
#define _GLFW_TLS __declspec(thread)
|
||||
#elif defined(__GNUC__)
|
||||
#define _GLFW_TLS __thread
|
||||
#else
|
||||
#define _GLFW_TLS
|
||||
#endif
|
||||
|
||||
|
||||
// The per-thread current context/window pointer
|
||||
//
|
||||
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
||||
|
||||
|
||||
// Return a description of the specified EGL error
|
||||
//
|
||||
static const char* getErrorString(EGLint error)
|
||||
@@ -207,6 +191,9 @@ static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
|
||||
//
|
||||
int _glfwInitContextAPI(void)
|
||||
{
|
||||
if (!_glfwInitTLS())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfw.egl.display = eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY);
|
||||
if (_glfw.egl.display == EGL_NO_DISPLAY)
|
||||
{
|
||||
@@ -237,6 +224,8 @@ int _glfwInitContextAPI(void)
|
||||
void _glfwTerminateContextAPI(void)
|
||||
{
|
||||
eglTerminate(_glfw.egl.display);
|
||||
|
||||
_glfwTerminateTLS();
|
||||
}
|
||||
|
||||
#define setEGLattrib(attribName, attribValue) \
|
||||
@@ -482,12 +471,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
|
||||
_glfwCurrentWindow = window;
|
||||
}
|
||||
|
||||
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
||||
{
|
||||
return _glfwCurrentWindow;
|
||||
_glfwSetCurrentContext(window);
|
||||
}
|
||||
|
||||
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
||||
|
||||
Reference in New Issue
Block a user