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
#define GLAPIENTRY APIENTRY
#define GLFW_GLAPIENTRY_DEFINED
#endif
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */

View File

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