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

Fix GLAPIENTRY not being defined for native access

This is a follow-up to 535c3ce632.

That commit made glfw3native.h undefine GLAPIENTRY whenever
GLFW_EXPOSE_NATIVE_GLX or GLFW_EXPOSE_NATIVE_OSMESA was defined, on the
assumption that it was glfw3.h that had defined GLAPIENTRY.

If gl.h or an extension loader header has been included before glfw3.h,
then it has defined inclusion guards preventing GLAPIENTRY from being
defined later when the GLX or OSMesa header includes gl.h.

This commit ensures GLAPIENTRY is only undefined if glfw3.h defined it.

Related to #2010
This commit is contained in:
Camilla Löwy 2022-05-03 19:54:08 +02:00
parent 5c3ebfb9cc
commit ce85c7dcaf
2 changed files with 9 additions and 2 deletions

View File

@ -6383,6 +6383,7 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
*/ */
#ifndef GLAPIENTRY #ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY #define GLAPIENTRY APIENTRY
#define GLFW_GLAPIENTRY_DEFINED
#endif #endif
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */

View File

@ -116,7 +116,10 @@ extern "C" {
* default it also acts as an OpenGL header * default it also acts as an OpenGL header
* However, glx.h will include gl.h, which will define it unconditionally * However, glx.h will include gl.h, which will define it unconditionally
*/ */
#if defined(GLFW_GLAPIENTRY_DEFINED)
#undef GLAPIENTRY #undef GLAPIENTRY
#undef GLFW_GLAPIENTRY_DEFINED
#endif
#include <GL/glx.h> #include <GL/glx.h>
#endif #endif
#if defined(GLFW_EXPOSE_NATIVE_EGL) #if defined(GLFW_EXPOSE_NATIVE_EGL)
@ -127,7 +130,10 @@ extern "C" {
* default it also acts as an OpenGL header * default it also acts as an OpenGL header
* However, osmesa.h will include gl.h, which will define it unconditionally * However, osmesa.h will include gl.h, which will define it unconditionally
*/ */
#if defined(GLFW_GLAPIENTRY_DEFINED)
#undef GLAPIENTRY #undef GLAPIENTRY
#undef GLFW_GLAPIENTRY_DEFINED
#endif
#include <GL/osmesa.h> #include <GL/osmesa.h>
#endif #endif