From 0f87124b98b7b36fc627b79701c62f85b433df90 Mon Sep 17 00:00:00 2001 From: Itms Date: Sun, 8 Sep 2024 09:26:46 +0200 Subject: [PATCH] Some glad improvements - Silence a MSVC warning in vulkan.cpp, refs #6987 - Document the patching of gl.h for macOS, from r26094 - Fix shellcheck warnings in the generation script --- build/premake/premake5.lua | 4 ++++ source/third_party/glad/README.md | 3 +++ source/third_party/glad/include/glad/gl.h | 1 + source/third_party/glad/update-headers.sh | 17 +++++++++-------- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index d20fefb9e4..ab7ffefd6f 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -959,6 +959,10 @@ function setup_all_libs () files { glad_path.."src/egl.cpp", glad_path.."src/glx.cpp" } end end + -- on Windows, silence a build warning in vulkan.cpp + filter "action:vs*" + buildoptions { "/wd4551" } + filter {} -- Third-party libraries that are built as part of the main project, diff --git a/source/third_party/glad/README.md b/source/third_party/glad/README.md index ea6d3d24f6..100358d992 100644 --- a/source/third_party/glad/README.md +++ b/source/third_party/glad/README.md @@ -15,6 +15,9 @@ cd glad 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 + Build the source files for all four backends with their respective extensions - GL ```sh diff --git a/source/third_party/glad/include/glad/gl.h b/source/third_party/glad/include/glad/gl.h index accbf4a149..c18e58ab88 100644 --- a/source/third_party/glad/include/glad/gl.h +++ b/source/third_party/glad/include/glad/gl.h @@ -1763,6 +1763,7 @@ typedef void *GLeglImageOES; typedef char GLchar; typedef char GLcharARB; #ifdef __APPLE__ +// --- Patched by WFG // See https://bugs.freedesktop.org/show_bug.cgi?id=66346 // macOS considers those to be different. // typedef void *GLhandleARB; diff --git a/source/third_party/glad/update-headers.sh b/source/third_party/glad/update-headers.sh index 4862769784..41cb1b16ea 100755 --- a/source/third_party/glad/update-headers.sh +++ b/source/third_party/glad/update-headers.sh @@ -1,12 +1,13 @@ #!/bin/sh -cd glad -python -m glad --api="gl:core=2.1" --extensions="../extensions/gl.txt" --out-path="../" c -python -m glad --api="gles2=2.0" --extensions="../extensions/gles2.txt" --out-path="../" c -python -m glad --api="glx=1.4" --extensions="../extensions/glx.txt" --out-path="../" c -python -m glad --api="wgl=1.0" --extensions="../extensions/wgl.txt" --out-path="../" c -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 -cd .. +( + cd glad || exit + python -m glad --api="gl:core=2.1" --extensions="../extensions/gl.txt" --out-path="../" c + python -m glad --api="gles2=2.0" --extensions="../extensions/gles2.txt" --out-path="../" c + python -m glad --api="glx=1.4" --extensions="../extensions/glx.txt" --out-path="../" c + python -m glad --api="wgl=1.0" --extensions="../extensions/wgl.txt" --out-path="../" c + 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 +) mv src/gl.c src/gl.cpp mv src/gles2.c src/gles2.cpp mv src/glx.c src/glx.cpp