From ff923e5d6a1de96e1a2e7d5d11aaff34a349fe9d Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Wed, 30 Oct 2024 23:08:36 +0100 Subject: [PATCH] Adds a patch to automatically apply the macOS fix to glad after its generation. --- source/third_party/glad/README.md | 2 ++ source/third_party/glad/fix_macos.patch | 17 +++++++++++++++++ source/third_party/glad/update-headers.cmd | 1 + source/third_party/glad/update-headers.sh | 1 + 4 files changed, 21 insertions(+) create mode 100644 source/third_party/glad/fix_macos.patch diff --git a/source/third_party/glad/README.md b/source/third_party/glad/README.md index 100358d992..60688fd604 100644 --- a/source/third_party/glad/README.md +++ b/source/third_party/glad/README.md @@ -17,6 +17,8 @@ pip install -r requirements.txt Do not revert the WFG patch in include/glad/gl.h (around line 1765): do not add the change reverting it after the generation of the file +Currently it's automatically applied by running the update-headers script. +On Windows you need to run it under Git Bash or with the `patch` program in PATH. Build the source files for all four backends with their respective extensions - GL diff --git a/source/third_party/glad/fix_macos.patch b/source/third_party/glad/fix_macos.patch new file mode 100644 index 0000000000..b3844fad6e --- /dev/null +++ b/source/third_party/glad/fix_macos.patch @@ -0,0 +1,17 @@ +diff --git b/include/glad/gl.h a/include/glad/gl.h +index 0a8db581a6..4c7c3564c3 100644 +--- b/include/glad/gl.h ++++ a/include/glad/gl.h +@@ -1763,7 +1763,11 @@ typedef void *GLeglImageOES; + typedef char GLchar; + typedef char GLcharARB; + #ifdef __APPLE__ +-typedef void *GLhandleARB; ++// --- Patched by WFG ++// See https://bugs.freedesktop.org/show_bug.cgi?id=66346 ++// macOS considers those to be different. ++// typedef void *GLhandleARB; ++typedef GLuint GLhandleARB; + #else + typedef unsigned int GLhandleARB; + #endif diff --git a/source/third_party/glad/update-headers.cmd b/source/third_party/glad/update-headers.cmd index 737542a1c4..33b56366d2 100644 --- a/source/third_party/glad/update-headers.cmd +++ b/source/third_party/glad/update-headers.cmd @@ -6,6 +6,7 @@ python -m glad --api="glx=1.4" --extensions="../extensions/glx.txt" --out-path=" python -m glad --api="wgl=1.0" --extensions="../extensions/wgl.txt" --out-path="../" c python -m glad --api="vulkan=1.1" --extensions="../extensions/vulkan.txt" --out-path="../" c cd .. +patch -p1 --ignore-whitespace --fuzz 1 < fix_macos.patch MOVE src\gl.c src\gl.cpp MOVE src\gles2.c src\gles2.cpp MOVE src\glx.c src\glx.cpp diff --git a/source/third_party/glad/update-headers.sh b/source/third_party/glad/update-headers.sh index 41cb1b16ea..e06c9d7d82 100755 --- a/source/third_party/glad/update-headers.sh +++ b/source/third_party/glad/update-headers.sh @@ -8,6 +8,7 @@ python -m glad --api="egl=1.5" --extensions="../extensions/egl.txt" --out-path="../" c python -m glad --api="vulkan=1.1" --extensions="../extensions/vulkan.txt" --out-path="../" c ) +patch -p1 --ignore-whitespace --fuzz 1