From 658744e2224bc5b7a14208b3a7d8a4a9bfd50e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 12 Oct 2020 23:47:35 +0200 Subject: [PATCH 01/27] Update USE_MSVC_RUNTIME_LIBRARY_DLL for CMake 3.15 This makes USE_MSVC_RUNTIME_LIBRARY_DLL update the directory scope CMAKE_MSVC_RUNTIME_LIBRARY variable instead of CMAKE_C_FLAGS on CMake 3.15 and later. Solution proposed by @moritz-h. Fixes #1783. Closes #1796. (cherry picked from commit f4a73296049b432720c9b6c230e479f9b41d74d3) --- CMakeLists.txt | 6 +++++- README.md | 3 ++- docs/compile.dox | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a203cce..eb248c88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,8 +80,10 @@ if (MSVC) # Workaround for VS 2008 not shipping with stdint.h list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008") endif() +endif() - if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) +if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) + if (${CMAKE_VERSION} VERSION_LESS 3.15) foreach (flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE @@ -96,6 +98,8 @@ if (MSVC) endif() endforeach() + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() endif() diff --git a/README.md b/README.md index 5538a8a7..fe1d6634 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,8 @@ information on what to include when reporting a bug. ## Changelog -There is nothing here yet. + - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or + later (#1783,#1796) ## Contact diff --git a/docs/compile.dox b/docs/compile.dox index 8a4fb583..aa6f0f08 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -234,6 +234,10 @@ __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or th static library version of the Visual C++ runtime library. If set to `ON`, the DLL version of the Visual C++ library is used. +@note On CMake 3.15 and later you can set the +[CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html) +variable instead of this option. + @anchor GLFW_USE_HYBRID_HPG __GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and `AmdPowerXpressRequestHighPerformance` symbols, which force the use of the From bcaf8daa7250e3a0356113661762deb131e75370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 10 Dec 2020 00:28:09 +0100 Subject: [PATCH 02/27] Fix grammar in MoltenVK support docs (cherry picked from commit 4c90e21e8f2d2b1edf5741527385cad9b71bc526) --- include/GLFW/glfw3.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 1b059062..96f53351 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -5708,9 +5708,8 @@ GLFWAPI int glfwVulkanSupported(void); * returned array, as it is an error to specify an extension more than once in * the `VkInstanceCreateInfo` struct. * - * @remark @macos This function currently supports either the - * `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface` - * extension. + * @remark @macos GLFW currently supports both the `VK_MVK_macos_surface` and + * the newer `VK_EXT_metal_surface` extensions. * * @pointer_lifetime The returned array is allocated and freed by GLFW. You * should not free it yourself. It is guaranteed to be valid only until the @@ -5793,7 +5792,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * * @remark @macos This function currently always returns `GLFW_TRUE`, as the - * `VK_MVK_macos_surface` extension does not provide + * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide * a `vkGetPhysicalDevice*PresentationSupport` type function. * * @thread_safety This function may be called from any thread. For From 583dcbcc19a093d28535f0418e00fbd2f115c39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 12 Apr 2021 00:00:40 +0200 Subject: [PATCH 03/27] Replace GL_ARB_debug_output in context guide New code should use GL_KHR_debug instead but it's not as good an example to use in this case as the symbols it adds has no suffixes. (cherry picked from commit ec621a00bd96cbc41a7e1f630adf155ae2d08267) --- docs/context.dox | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/context.dox b/docs/context.dox index 69b8fa7f..25de69ff 100644 --- a/docs/context.dox +++ b/docs/context.dox @@ -142,9 +142,9 @@ as extensions until they become obsolete. An extension is defined by: -- An extension name (e.g. `GL_ARB_debug_output`) -- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`) -- New OpenGL functions (e.g. `glGetDebugMessageLogARB`) +- An extension name (e.g. `GL_ARB_gl_spirv`) +- New OpenGL tokens (e.g. `GL_SPIR_V_BINARY_ARB`) +- New OpenGL functions (e.g. `glSpecializeShaderARB`) Note the `ARB` affix, which stands for Architecture Review Board and is used for official extensions. The extension above was created by the ARB, but there @@ -229,9 +229,9 @@ To check whether a specific extension is supported, use the `GLAD_GL_xxx` booleans. @code -if (GLAD_GL_ARB_debug_output) +if (GLAD_GL_ARB_gl_spirv) { - // Use GL_ARB_debug_output + // Use GL_ARB_gl_spirv } @endcode @@ -263,8 +263,8 @@ included in your development environment may be several years out of date and may not include the extensions you wish to use. The header defines function pointer types for all functions of all extensions it -supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for -`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer +supports. These have names like `PFNGLSPECIALIZESHADERARBPROC` (for +`glSpecializeShaderARB`), i.e. the name is made uppercase and `PFN` (pointer to function) and `PROC` (procedure) are added to the ends. To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including @@ -284,7 +284,7 @@ is necessary to check at run-time whether the context supports the extension. This is done with @ref glfwExtensionSupported. @code -if (glfwExtensionSupported("GL_ARB_debug_output")) +if (glfwExtensionSupported("GL_ARB_gl_spirv")) { // The extension is supported by the current context } @@ -303,7 +303,7 @@ your operating system, making it necessary to fetch them at run time. You can retrieve pointers to these functions with @ref glfwGetProcAddress. @code -PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB"); +PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB"); @endcode In general, you should avoid giving the function pointer variables the (exact) @@ -317,28 +317,28 @@ when used together. #define GLFW_INCLUDE_GLEXT #include -#define glGetDebugMessageLogARB pfnGetDebugMessageLog -PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog; +#define glSpecializeShaderARB pfnSpecializeShaderARB +PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB; // Flag indicating whether the extension is supported -int has_ARB_debug_output = 0; +int has_ARB_gl_spirv = 0; void load_extensions(void) { - if (glfwExtensionSupported("GL_ARB_debug_output")) + if (glfwExtensionSupported("GL_ARB_gl_spirv")) { - pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC) - glfwGetProcAddress("glGetDebugMessageLogARB"); - has_ARB_debug_output = 1; + pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC) + glfwGetProcAddress("glSpecializeShaderARB"); + has_ARB_gl_spirv = 1; } } void some_function(void) { - if (has_ARB_debug_output) + if (has_ARB_gl_spirv) { // Now the extension function can be called as usual - glGetDebugMessageLogARB(...); + glSpecializeShaderARB(...); } } @endcode From 3cded29c2f1a8829ad9ee1c4fe653a0d6b11f65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 12 Apr 2021 00:04:33 +0200 Subject: [PATCH 04/27] Replace GL_ARB_debug_output in comments (cherry picked from commit 85bce8a8ead47214404bc66c73aa49f13976a102) --- include/GLFW/glfw3native.h | 4 ++-- src/win32_platform.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 267e75ca..e09468bb 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -83,8 +83,8 @@ extern "C" { #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for - // example to allow applications to correctly declare a GL_ARB_debug_output - // callback) but windows.h assumes no one will define APIENTRY before it does + // example to allow applications to correctly declare a GL_KHR_debug callback) + // but windows.h assumes no one will define APIENTRY before it does #if defined(GLFW_APIENTRY_DEFINED) #undef APIENTRY #undef GLFW_APIENTRY_DEFINED diff --git a/src/win32_platform.h b/src/win32_platform.h index 003b8a14..5e8c9fd9 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -39,8 +39,8 @@ #endif // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for -// example to allow applications to correctly declare a GL_ARB_debug_output -// callback) but windows.h assumes no one will define APIENTRY before it does +// example to allow applications to correctly declare a GL_KHR_debug callback) +// but windows.h assumes no one will define APIENTRY before it does #undef APIENTRY // GLFW on Windows is Unicode only and does not work in MBCS mode From 5dd6716ee9a51ae10fe195987e4a17db20a6774f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 12 Apr 2021 20:56:53 +0200 Subject: [PATCH 05/27] Win32: Fix compilation with standalone LLVM The /clang: suffix passed to Clang-CL was accidentally also passed to the regular standalone Clang, which caused compilation to fail. We now pass /W3 to Clang-CL, which it interprets as -Wall. The _CRT_SECURE_NO_WARNINGS macro is now defined for both Clang and Clang-CL. The /entry: flag passed to link.exe is now also passed to lld-link, letting the windows subsystem tests and examples link. Fixes #1807. Closes #1824. Closes #1874. (cherry picked from commit 061a0263a9783c1442ad96a061c717c167ab4a76) --- README.md | 1 + examples/CMakeLists.txt | 9 +++++++-- src/CMakeLists.txt | 20 ++++++++------------ tests/CMakeLists.txt | 9 +++++++-- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fe1d6634..7db24057 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or later (#1783,#1796) + - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874) ## Contact diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a884e6bc..0eba4e65 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -7,7 +7,8 @@ if (MATH_LIBRARY) link_libraries("${MATH_LIBRARY}") endif() -if (MSVC) +# Workaround for the MS CRT deprecating parts of the standard library +if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() @@ -62,9 +63,13 @@ if (GLFW_USE_OSMESA) endif() if (MSVC) - # Tell MSVC to use main instead of WinMain for Windows subsystem executables + # Tell MSVC to use main instead of WinMain set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") +elseif (CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + # Tell Clang using MS CRT to use main instead of WinMain + set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES + LINK_FLAGS "-Wl,/entry:mainCRTStartup") endif() if (APPLE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a409459b..0d0f52f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -121,18 +121,14 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU") endif() # Enable a reasonable set of warnings -if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR - CMAKE_C_COMPILER_ID STREQUAL "Clang" OR - CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - - if (CMAKE_C_SIMULATE_ID STREQUAL "MSVC") - # Tell Clang-CL that this is a Clang flag - target_compile_options(glfw PRIVATE "/clang:-Wall") - else() - target_compile_options(glfw PRIVATE "-Wall") - endif() -elseif (MSVC) +# NOTE: The order matters here, Clang-CL matches both MSVC and Clang +if (MSVC) target_compile_options(glfw PRIVATE "/W3") +elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR + CMAKE_C_COMPILER_ID STREQUAL "Clang" OR + CMAKE_C_COMPILER_ID STREQUAL "AppleClang") + + target_compile_options(glfw PRIVATE "-Wall") endif() if (WIN32) @@ -176,7 +172,7 @@ if (BUILD_SHARED_LIBS) endif() endif() -if (MSVC) +if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5232720f..91374b2f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,8 @@ if (MATH_LIBRARY) link_libraries("${MATH_LIBRARY}") endif() -if (MSVC) +# Workaround for the MS CRT deprecating parts of the standard library +if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() @@ -69,9 +70,13 @@ set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES FOLDER "GLFW3/Tests") if (MSVC) - # Tell MSVC to use main instead of WinMain for Windows subsystem executables + # Tell MSVC to use main instead of WinMain set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") +elseif (CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + # Tell Clang using MS CRT to use main instead of WinMain + set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES + LINK_FLAGS "-Wl,/entry:mainCRTStartup") endif() if (APPLE) From 9ef9b1361a319f3cf6c34372b4c1c3d2066a20b0 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Thu, 15 Apr 2021 18:54:45 +0300 Subject: [PATCH 06/27] Fix hardcoded runtime destination in CMake install Closes #1883. Closes #1884. (cherry picked from commit e3f916808ddc9b1064d7d585a2d5bbac9fa53038) --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d0f52f3..f29f9402 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -179,7 +179,7 @@ endif() if (GLFW_INSTALL) install(TARGETS glfw EXPORT glfwTargets - RUNTIME DESTINATION "bin" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() From 30b02dd70910f19da7006e855dc47af3af6b86f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 22 Apr 2021 23:07:50 +0200 Subject: [PATCH 07/27] Fix description of video mode ordering in docs The two final sorting criteria were not included in the documentation. Fixes #1889. (cherry picked from commit 0e9ec7788b4985a0df698080258e4091d18dcc3b) --- README.md | 1 + include/GLFW/glfw3.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7db24057..493568f2 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ skills. - Andrew Corrigan - Bailey Cosier - Noel Cower + - CuriouserThing - Jason Daly - Jarrod Davis - Olivier Delannoy diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 96f53351..546620ed 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -2279,8 +2279,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); * * This function returns an array of all video modes supported by the specified * monitor. The returned array is sorted in ascending order, first by color - * bit depth (the sum of all channel depths) and then by resolution area (the - * product of width and height). + * bit depth (the sum of all channel depths), then by resolution area (the + * product of width and height), then resolution width and finally by refresh + * rate. * * @param[in] monitor The monitor to query. * @param[out] count Where to store the number of video modes in the returned From 52b2775c2eeb89677b016d27b8a82eb1dc3f2cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 16 Apr 2021 17:09:44 +0200 Subject: [PATCH 08/27] Win32: Fix macros being enabled for other backends _UNICODE should not be defined for other backends even when built on Windows. (cherry picked from commit a646f51bca867e04254c5fdcb741741265bc4d6c) --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f29f9402..7f434baf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -131,7 +131,7 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR target_compile_options(glfw PRIVATE "-Wall") endif() -if (WIN32) +if (_GLFW_WIN32) target_compile_definitions(glfw PRIVATE _UNICODE) endif() From 728aaccbbb4fc48c54ea795c7da75f8c5faf37c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 20 Apr 2021 15:37:48 +0200 Subject: [PATCH 09/27] Win32: Always define UNICODE and _UNICODE (cherry picked from commit 9a3a8bc26799f9a57f62ab7980537a48090c89e7) --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f434baf..6fbf7f69 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -132,7 +132,7 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR endif() if (_GLFW_WIN32) - target_compile_definitions(glfw PRIVATE _UNICODE) + target_compile_definitions(glfw PRIVATE UNICODE _UNICODE) endif() # HACK: When building on MinGW, WINVER and UNICODE need to be defined before @@ -140,7 +140,7 @@ endif() # win32_platform.h. We define them here until a saner solution can be found # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. if (MINGW) - target_compile_definitions(glfw PRIVATE UNICODE WINVER=0x0501) + target_compile_definitions(glfw PRIVATE WINVER=0x0501) endif() if (BUILD_SHARED_LIBS) From 2a5038e4e93d727c5d06606f295745a2c5ce4546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 12 May 2021 18:49:35 +0200 Subject: [PATCH 10/27] Fix header version macro descriptions in docs (cherry picked from commit e17ffcd0db4541816ebf4cf973ebcee18e287733) --- include/GLFW/glfw3.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 546620ed..eca882e6 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -276,23 +276,24 @@ extern "C" { /*! @name GLFW version macros * @{ */ -/*! @brief The major version number of the GLFW library. +/*! @brief The major version number of the GLFW header. * - * This is incremented when the API is changed in non-compatible ways. + * The major version number of the GLFW header. This is incremented when the + * API is changed in non-compatible ways. * @ingroup init */ #define GLFW_VERSION_MAJOR 3 -/*! @brief The minor version number of the GLFW library. +/*! @brief The minor version number of the GLFW header. * - * This is incremented when features are added to the API but it remains - * backward-compatible. + * The minor version number of the GLFW header. This is incremented when + * features are added to the API but it remains backward-compatible. * @ingroup init */ #define GLFW_VERSION_MINOR 3 -/*! @brief The revision number of the GLFW library. +/*! @brief The revision number of the GLFW header. * - * This is incremented when a bug fix release is made that does not contain any - * API changes. + * The revision number of the GLFW header. This is incremented when a bug fix + * release is made that does not contain any API changes. * @ingroup init */ #define GLFW_VERSION_REVISION 5 From a149810df95fffd0f8e586d853e63f6af408fa09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 12 May 2021 18:53:06 +0200 Subject: [PATCH 11/27] Clarify documentation for hints (cherry picked from commit bbbbd3e87094d44191197659ab07081262f07d06) --- docs/intro.dox | 2 +- docs/window.dox | 88 ++++++++++++++++++++----------------------------- 2 files changed, 37 insertions(+), 53 deletions(-) diff --git a/docs/intro.dox b/docs/intro.dox index a72b620e..e563b505 100644 --- a/docs/intro.dox +++ b/docs/intro.dox @@ -86,7 +86,7 @@ Setting these hints requires no platform specific headers or functions. @anchor GLFW_JOYSTICK_HAT_BUTTONS __GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not have @ref -glfwGetJoystickHats. Set this with @ref glfwInitHint. +glfwGetJoystickHats. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @subsubsection init_hints_osx macOS specific init hints diff --git a/docs/window.dox b/docs/window.dox index ce851737..8933b5ea 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -236,7 +236,8 @@ does not affect window decorations. Possible values are `GLFW_TRUE` and @anchor GLFW_FOCUS_ON_SHOW_hint __GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input -focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. +focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and +`GLFW_FALSE`. @anchor GLFW_SCALE_TO_MONITOR __GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be @@ -271,7 +272,6 @@ __GLFW_ACCUM_ALPHA_BITS__ specify the desired bit depths of the various components of the accumulation buffer. A value of `GLFW_DONT_CARE` means the application has no preference. -@par Accumulation buffers are a legacy OpenGL feature and should not be used in new code. @@ -279,7 +279,6 @@ code. __GLFW_AUX_BUFFERS__ specifies the desired number of auxiliary buffers. A value of `GLFW_DONT_CARE` means the application has no preference. -@par Auxiliary buffers are a legacy OpenGL feature and should not be used in new code. @@ -296,14 +295,12 @@ the application has no preference. __GLFW_SRGB_CAPABLE__ specifies whether the framebuffer should be sRGB capable. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. -@par -__OpenGL:__ If enabled and supported by the system, the `GL_FRAMEBUFFER_SRGB` -enable will control sRGB rendering. By default, sRGB rendering will be -disabled. +@note __OpenGL:__ If enabled and supported by the system, the +`GL_FRAMEBUFFER_SRGB` enable will control sRGB rendering. By default, sRGB +rendering will be disabled. -@par -__OpenGL ES:__ If enabled and supported by the system, the context will always -have sRGB rendering enabled. +@note __OpenGL ES:__ If enabled and supported by the system, the context will +always have sRGB rendering enabled. @anchor GLFW_DOUBLEBUFFER __GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double @@ -332,28 +329,25 @@ create the context. Possible values are `GLFW_NATIVE_CONTEXT_API`, `GLFW_EGL_CONTEXT_API` and `GLFW_OSMESA_CONTEXT_API`. This is a hard constraint. If no client API is requested, this hint is ignored. -@par -@macos The EGL API is not available on this platform and requests to use it -will fail. +An [extension loader library](@ref context_glext_auto) that assumes it knows +which API was used to create the current context may fail if you change this +hint. This can be resolved by having it load functions via @ref +glfwGetProcAddress. -@par -__Wayland:__ The EGL API _is_ the native context creation API, so this hint +@note @macos The EGL API is not available on this platform and requests to use +it will fail. + +@note @wayland The EGL API _is_ the native context creation API, so this hint will have no effect. -@par -__OSMesa:__ As its name implies, an OpenGL context created with OSMesa does not -update the window contents when its buffers are swapped. Use OpenGL functions -or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer and @ref -glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents. +@note @x11 On some Linux systems, creating contexts via both the native and EGL +APIs in a single process will cause the application to segfault. Stick to one +API or the other on Linux for now. -@note An OpenGL extension loader library that assumes it knows which context -creation API is used on a given platform may fail if you change this hint. This -can be resolved by having it load via @ref glfwGetProcAddress, which always uses -the selected API. - -@bug On some Linux systems, creating contexts via both the native and EGL APIs -in a single process will cause the application to segfault. Stick to one API or -the other on Linux for now. +@note __OSMesa:__ As its name implies, an OpenGL context created with OSMesa +does not update the window contents when its buffers are swapped. Use OpenGL +functions or the OSMesa native access functions @ref glfwGetOSMesaColorBuffer +and @ref glfwGetOSMesaDepthBuffer to retrieve the framebuffer contents. @anchor GLFW_CONTEXT_VERSION_MAJOR_hint @anchor GLFW_CONTEXT_VERSION_MINOR_hint @@ -361,27 +355,24 @@ __GLFW_CONTEXT_VERSION_MAJOR__ and __GLFW_CONTEXT_VERSION_MINOR__ specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API. -@note Do not confuse these hints with `GLFW_VERSION_MAJOR` and -`GLFW_VERSION_MINOR`, which provide the API version of the GLFW header. - -@par -__OpenGL:__ These hints are not hard constraints, but creation will fail if the -OpenGL version of the created context is less than the one requested. It is -therefore perfectly safe to use the default of version 1.0 for legacy code and -you will still get backwards-compatible contexts of version 3.0 and above when -available. - -@par While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints. -@par -__OpenGL ES:__ These hints are not hard constraints, but creation will fail if -the OpenGL ES version of the created context is less than the one requested. -Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, -and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, -but OpenGL ES 2.0 is not backward compatible with 1.x. +Do not confuse these hints with @ref GLFW_VERSION_MAJOR and @ref +GLFW_VERSION_MINOR, which provide the API version of the GLFW header. + +@note __OpenGL:__ These hints are not hard constraints, but creation will fail +if the OpenGL version of the created context is less than the one requested. It +is therefore perfectly safe to use the default of version 1.0 for legacy code +and you will still get backwards-compatible contexts of version 3.0 and above +when available. + +@note __OpenGL ES:__ These hints are not hard constraints, but creation will +fail if the OpenGL ES version of the created context is less than the one +requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was +requested, and vice versa. This is because OpenGL ES 3.x is backward compatible +with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x. @note @macos The OS only supports forward-compatible core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version @@ -396,7 +387,6 @@ forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored. -@par Forward-compatibility is described in detail in the [OpenGL Reference Manual](https://www.opengl.org/registry/). @@ -405,7 +395,6 @@ __GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. -@par Debug contexts for OpenGL and OpenGL ES are described in detail by the [GL_KHR_debug](https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt) extension. @@ -418,7 +407,6 @@ a specific profile. If requesting an OpenGL version below 3.2, `GLFW_OPENGL_ANY_PROFILE` must be used. If OpenGL ES is requested, this hint is ignored. -@par OpenGL profiles are described in detail in the [OpenGL Reference Manual](https://www.opengl.org/registry/). @@ -438,7 +426,6 @@ the pipeline will be flushed whenever the context is released from being the current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will not be flushed on release. -@par Context release behaviors are described in detail by the [GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt) extension. @@ -448,7 +435,6 @@ __GLFW_CONTEXT_NO_ERROR__ specifies whether errors should be generated by the context. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, situations that would have generated errors instead cause undefined behavior. -@par The no error mode for OpenGL and OpenGL ES is described in detail by the [GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt) extension. @@ -474,12 +460,10 @@ run on the discrete GPU. This only affects systems with both integrated and discrete GPUs. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This is ignored on other platforms. -@par Simpler programs and tools may want to enable this to save power, while games and other applications performing advanced rendering will want to leave it disabled. -@par A bundled application that wishes to participate in Automatic Graphics Switching should also declare this in its `Info.plist` by setting the `NSSupportsAutomaticGraphicsSwitching` key to `true`. From 020ce991709939151f2f66aab0d25f894ef3c013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 May 2021 15:03:49 +0200 Subject: [PATCH 12/27] Remove claim that EGL is not supported on macOS (cherry picked from commit a39115a27b3f4695729e1a72e41b3217a841b94f) --- docs/window.dox | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/window.dox b/docs/window.dox index 8933b5ea..2fcf11f8 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -334,9 +334,6 @@ which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via @ref glfwGetProcAddress. -@note @macos The EGL API is not available on this platform and requests to use -it will fail. - @note @wayland The EGL API _is_ the native context creation API, so this hint will have no effect. From e756ae1d854107fb911ed866f519fa95a6ac9b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 May 2021 17:32:31 +0200 Subject: [PATCH 13/27] Make monitor and joystick names static strings Related to #478. (cherry picked from commit da236ba807b73fb8050e52f1f1450266e7529659) --- src/cocoa_monitor.m | 8 ++++---- src/input.c | 3 +-- src/internal.h | 4 ++-- src/monitor.c | 4 +--- src/wl_monitor.c | 6 ++---- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index 55638cf0..6271828e 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -63,7 +63,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen) &it) != 0) { // This may happen if a desktop Mac is running headless - return NULL; + return _glfw_strdup("Display"); } while ((service = IOIteratorNext(it)) != 0) @@ -101,7 +101,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen) { _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find service port for display"); - return NULL; + return _glfw_strdup("Display"); } CFDictionaryRef names = @@ -114,7 +114,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen) { // This may happen if a desktop Mac is running headless CFRelease(info); - return NULL; + return _glfw_strdup("Display"); } const CFIndex size = @@ -356,7 +356,7 @@ void _glfwPollMonitorsNS(void) const CGSize size = CGDisplayScreenSize(displays[i]); char* name = getMonitorName(displays[i], screen); if (!name) - name = _glfw_strdup("Unknown"); + continue; _GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height); monitor->ns.displayID = displays[i]; diff --git a/src/input.c b/src/input.c index 337d5cf0..56277ca4 100644 --- a/src/input.c +++ b/src/input.c @@ -430,7 +430,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, js = _glfw.joysticks + jid; js->present = GLFW_TRUE; - js->name = _glfw_strdup(name); js->axes = calloc(axisCount, sizeof(float)); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->hats = calloc(hatCount, 1); @@ -438,6 +437,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, js->buttonCount = buttonCount; js->hatCount = hatCount; + strncpy(js->name, name, sizeof(js->name) - 1); strncpy(js->guid, guid, sizeof(js->guid) - 1); js->mapping = findValidMapping(js); @@ -448,7 +448,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, // void _glfwFreeJoystick(_GLFWjoystick* js) { - free(js->name); free(js->axes); free(js->buttons); free(js->hats); diff --git a/src/internal.h b/src/internal.h index 91631c06..2a5668af 100644 --- a/src/internal.h +++ b/src/internal.h @@ -423,7 +423,7 @@ struct _GLFWwindow // struct _GLFWmonitor { - char* name; + char name[128]; void* userPointer; // Physical dimensions in millimeters. @@ -484,7 +484,7 @@ struct _GLFWjoystick int buttonCount; unsigned char* hats; int hatCount; - char* name; + char name[128]; void* userPointer; char guid[33]; _GLFWmapping* mapping; diff --git a/src/monitor.c b/src/monitor.c index c6bcfd39..73411412 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM) monitor->widthMM = widthMM; monitor->heightMM = heightMM; - if (name) - monitor->name = _glfw_strdup(name); + strncpy(monitor->name, name, sizeof(monitor->name) - 1); return monitor; } @@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor) _glfwFreeGammaArrays(&monitor->currentRamp); free(monitor->modes); - free(monitor->name); free(monitor); } diff --git a/src/wl_monitor.c b/src/wl_monitor.c index a7b05c60..d1448a24 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -47,15 +47,13 @@ static void outputHandleGeometry(void* data, int32_t transform) { struct _GLFWmonitor *monitor = data; - char name[1024]; monitor->wl.x = x; monitor->wl.y = y; monitor->widthMM = physicalWidth; monitor->heightMM = physicalHeight; - snprintf(name, sizeof(name), "%s %s", make, model); - monitor->name = _glfw_strdup(name); + snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model); } static void outputHandleMode(void* data, @@ -133,7 +131,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) } // The actual name of this output will be set in the geometry handler. - monitor = _glfwAllocMonitor(NULL, 0, 0); + monitor = _glfwAllocMonitor("", 0, 0); output = wl_registry_bind(_glfw.wl.registry, name, From 508e24c01c6169b26bdf3e1310449f19f1613087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 May 2021 21:38:46 +0200 Subject: [PATCH 14/27] Add tracking of single-/double-buffering This adds the state part of 04f21abb52e557addb932af1634b29658fd3a6ae (Make GLFW_DOUBLEBUFFER a window attribute), but without the associated API change, because this is needed by later bug fixes that will go into the stable branch. --- src/internal.h | 1 + src/window.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/internal.h b/src/internal.h index 2a5668af..b28e9424 100644 --- a/src/internal.h +++ b/src/internal.h @@ -375,6 +375,7 @@ struct _GLFWwindow GLFWbool focusOnShow; GLFWbool shouldClose; void* userPointer; + GLFWbool doublebuffer; GLFWvidmode videoMode; _GLFWmonitor* monitor; _GLFWcursor* cursor; diff --git a/src/window.c b/src/window.c index 44de03bb..b87a2609 100644 --- a/src/window.c +++ b/src/window.c @@ -205,6 +205,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, window->focusOnShow = wndconfig.focusOnShow; window->cursorMode = GLFW_CURSOR_NORMAL; + window->doublebuffer = fbconfig.doublebuffer; + window->minwidth = GLFW_DONT_CARE; window->minheight = GLFW_DONT_CARE; window->maxwidth = GLFW_DONT_CARE; From 07c29d1c1cf7d9f2aaa93550a2a50dea4c40a69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 May 2021 21:41:51 +0200 Subject: [PATCH 15/27] Skip initial buffer swap when single-buffered This skips the buffer swap after the initial glClear performed during window creation, if the window is single-buffered. This call confused apitrace into thinking the window was double-buffered. Fixes #1873. (cherry picked from commit 184377b493cd382485914624b30574cfd39216ba) --- README.md | 1 + src/context.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 493568f2..a7e8460e 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ information on what to include when reporting a bug. ## Changelog + - Bugfix: Buffers were swapped at creation on single-buffered windows (#1873) - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or later (#1783,#1796) - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874) diff --git a/src/context.c b/src/context.c index 867e399f..647a9942 100644 --- a/src/context.c +++ b/src/context.c @@ -570,7 +570,9 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) window->context.getProcAddress("glClear"); glClear(GL_COLOR_BUFFER_BIT); - window->context.swapBuffers(window); + + if (window->doublebuffer) + window->context.swapBuffers(window); } glfwMakeContextCurrent((GLFWwindow*) previous); From 6769ffcd0fc0250b1cf378a89308e7cf2b73830f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 14 May 2021 17:14:13 +0200 Subject: [PATCH 16/27] Move single/double-buffer filtering to backends There is no need to enumerate framebuffer configs that will just be filtered out later by the GLFW_DOUBLEBUFFER hard constraint. (cherry picked from commit fd79b02840a36b74e4289cc53dc332de6403b8fd) --- src/context.c | 6 ------ src/glx_context.c | 5 +++-- src/wgl_context.c | 10 ++++++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/context.c b/src/context.c index 647a9942..b3c78e80 100644 --- a/src/context.c +++ b/src/context.c @@ -196,12 +196,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, continue; } - if (desired->doublebuffer != current->doublebuffer) - { - // Double buffering is a hard constraint - continue; - } - // Count number of missing buffers { missing = 0; diff --git a/src/glx_context.c b/src/glx_context.c index fbbb8977..ec1adc75 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -92,6 +92,9 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, continue; } + if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer) + continue; + if (desired->transparent) { XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n); @@ -119,8 +122,6 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, if (getGLXFBConfigAttrib(n, GLX_STEREO)) u->stereo = GLFW_TRUE; - if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER)) - u->doublebuffer = GLFW_TRUE; if (_glfw.glx.ARB_multisample) u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES); diff --git a/src/wgl_context.c b/src/wgl_context.c index b7d1c4d4..a76795d8 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -165,6 +165,9 @@ static int choosePixelFormat(_GLFWwindow* window, if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) continue; + if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer) + continue; + u->redBits = findAttribValue(WGL_RED_BITS_ARB); u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB); u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB); @@ -182,8 +185,6 @@ static int choosePixelFormat(_GLFWwindow* window, if (findAttribValue(WGL_STEREO_ARB)) u->stereo = GLFW_TRUE; - if (findAttribValue(WGL_DOUBLE_BUFFER_ARB)) - u->doublebuffer = GLFW_TRUE; if (_glfw.wgl.ARB_multisample) u->samples = findAttribValue(WGL_SAMPLES_ARB); @@ -239,6 +240,9 @@ static int choosePixelFormat(_GLFWwindow* window, if (pfd.iPixelType != PFD_TYPE_RGBA) continue; + if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer) + continue; + u->redBits = pfd.cRedBits; u->greenBits = pfd.cGreenBits; u->blueBits = pfd.cBlueBits; @@ -256,8 +260,6 @@ static int choosePixelFormat(_GLFWwindow* window, if (pfd.dwFlags & PFD_STEREO) u->stereo = GLFW_TRUE; - if (pfd.dwFlags & PFD_DOUBLEBUFFER) - u->doublebuffer = GLFW_TRUE; } u->handle = pixelFormat; From 163fa83fac1d6e9fcdca37917a40f00a968703eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 14 May 2021 17:22:26 +0200 Subject: [PATCH 17/27] EGL: Fix creation of single-buffered windows The EGL backend ignored the state of GLFW_DOUBLEBUFFER and always created a double-buffered EGL window. This sets the EGL_RENDER_BUFFER attribute at EGL window creation appropriately. Fixes #1843. (cherry picked from commit 114776a24605418e6d719d2f30141e351e93c6e0) --- src/egl_context.c | 5 ++++- src/egl_context.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/egl_context.c b/src/egl_context.c index 6288fb7c..8feb211d 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); - u->doublebuffer = GLFW_TRUE; + u->doublebuffer = desired->doublebuffer; u->handle = (uintptr_t) n; usableCount++; @@ -596,6 +596,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR); } + if (!fbconfig->doublebuffer) + setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER); + setAttrib(EGL_NONE, EGL_NONE); window->context.egl.surface = diff --git a/src/egl_context.h b/src/egl_context.h index 6d42e11c..2a752e69 100644 --- a/src/egl_context.h +++ b/src/egl_context.h @@ -80,6 +80,8 @@ typedef struct wl_egl_window* EGLNativeWindowType; #define EGL_OPENGL_ES_API 0x30a0 #define EGL_OPENGL_API 0x30a2 #define EGL_NONE 0x3038 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_SINGLE_BUFFER 0x3085 #define EGL_EXTENSIONS 0x3055 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_NATIVE_VISUAL_ID 0x302e From 45336c1104cea81ab0e576e76ed2c61e6e1a2398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 7 Jun 2021 22:34:33 +0200 Subject: [PATCH 18/27] Fix numeric conversion warnings in example (cherry picked from commit df15a33e1035d47c223e83ecd4018e392c851969) --- examples/heightmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/heightmap.c b/examples/heightmap.c index 13a3c1e1..988dd0b8 100644 --- a/examples/heightmap.c +++ b/examples/heightmap.c @@ -292,12 +292,12 @@ static void generate_heightmap__circle(float* center_x, float* center_y, { float sign; /* random value for element in between [0-1.0] */ - *center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); - *center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); - *size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX); - sign = (1.0f * rand()) / (1.0f * RAND_MAX); + *center_x = (MAP_SIZE * rand()) / (float) RAND_MAX; + *center_y = (MAP_SIZE * rand()) / (float) RAND_MAX; + *size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX; + sign = (1.0f * rand()) / (float) RAND_MAX; sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f; - *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX); + *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX; } /* Run the specified number of iterations of the generation process for the From 8bf39cf1f4106928dcfc4c8bb436e6164ef189c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 7 Jun 2021 22:21:23 +0200 Subject: [PATCH 19/27] Migrate from Travis CI to GitHub Actions The old Travis CI .org service has been throttled for a while now and is said to be shutting down completely next week. This migrates the Travis CI build jobs to GitHub Actions, with minor changes. - The trailing whitespace detection has been removed for now. - The libegl1-mesa-dev dependency for Wayland has been removed as it appears to no longer be necessary for building. (cherry picked from commit 5a6001a83be1c788e7795d891b6a9dd5931e460e) --- .github/workflows/build.yml | 91 ++++++++++++++++++++++++++++ .travis.yml | 114 ------------------------------------ README.md | 2 +- 3 files changed, 92 insertions(+), 115 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..74b28e4a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,91 @@ +name: Build +on: + pull_request: + push: + branches: [ ci, master, 3.3-stable ] +permissions: + statuses: write + contents: read +env: + CC: clang + CFLAGS: -Werror + +jobs: + build-linux-x11-clang: + name: X11 (Linux, Clang) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt update + sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev + + - name: Configure static library + run: cmake -S . -B build-static + - name: Build static library + run: cmake --build build-static --parallel + + - name: Configure shared library + run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON + - name: Build shared library + run: cmake --build build-shared --parallel + + build-linux-wayland-clang: + name: Wayland (Linux, Clang) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt update + sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev + + - name: Configure static library + run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON + - name: Build static library + run: cmake --build build-static --parallel + + - name: Configure shared library + run: cmake -S . -B build-shared -D GLFW_USE_WAYLAND=ON -D BUILD_SHARED_LIBS=ON + - name: Build shared library + run: cmake --build build-shared --parallel + + build-linux-null-clang: + name: Null (Linux, Clang) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt update + sudo apt install libosmesa6-dev + + - name: Configure static library + run: cmake -S . -B build-static -D GLFW_USE_OSMESA=ON + - name: Build static library + run: cmake --build build-static --parallel + + - name: Configure shared library + run: cmake -S . -B build-shared -D GLFW_USE_OSMESA=ON -D BUILD_SHARED_LIBS=ON + - name: Build shared library + run: cmake --build build-shared --parallel + + build-macos-cocoa-clang: + name: Cocoa (macOS, Clang) + runs-on: macos-latest + env: + MACOSX_DEPLOYMENT_TARGET: 10.8 + steps: + - uses: actions/checkout@v2 + + - name: Configure static library + run: cmake -S . -B build-static + - name: Build static library + run: cmake --build build-static --parallel + + - name: Configure shared library + run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON + - name: Build shared library + run: cmake --build build-shared --parallel + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8e2619bf..00000000 --- a/.travis.yml +++ /dev/null @@ -1,114 +0,0 @@ -language: c -compiler: clang -branches: - only: - - ci - - master - - 3.3-stable -matrix: - include: - - os: linux - dist: xenial - name: "X11 shared library" - addons: - apt: - packages: - - libxrandr-dev - - libxinerama-dev - - libxcursor-dev - - libxi-dev - env: - - BUILD_SHARED_LIBS=ON - - CFLAGS=-Werror - - os: linux - dist: xenial - name: "X11 static library" - addons: - apt: - packages: - - libxrandr-dev - - libxinerama-dev - - libxcursor-dev - - libxi-dev - env: - - BUILD_SHARED_LIBS=OFF - - CFLAGS=-Werror - - os: linux - dist: focal - name: "Wayland shared library" - addons: - apt: - packages: - - extra-cmake-modules - - wayland-protocols - - libwayland-dev - - libxkbcommon-dev - - libegl1-mesa-dev - env: - - USE_WAYLAND=ON - - BUILD_SHARED_LIBS=ON - - CFLAGS=-Werror - - os: linux - dist: focal - name: "Wayland static library" - addons: - apt: - packages: - - extra-cmake-modules - - wayland-protocols - - libwayland-dev - - libxkbcommon-dev - - libegl1-mesa-dev - env: - - USE_WAYLAND=ON - - BUILD_SHARED_LIBS=OFF - - CFLAGS=-Werror - - os: linux - dist: bionic - name: "Null shared library" - addons: - apt: - packages: - - libosmesa6-dev - env: - - BUILD_SHARED_LIBS=ON - - USE_OSMESA=ON - - CFLAGS=-Werror - - os: linux - dist: bionic - name: "Null static library" - addons: - apt: - packages: - - libosmesa6-dev - env: - - BUILD_SHARED_LIBS=OFF - - USE_OSMESA=ON - - CFLAGS=-Werror - - os: osx - name: "Cocoa shared library" - env: - - BUILD_SHARED_LIBS=ON - - CFLAGS=-Werror - - MACOSX_DEPLOYMENT_TARGET=10.8 - - os: osx - name: "Cocoa static library" - env: - - BUILD_SHARED_LIBS=OFF - - CFLAGS=-Werror - - MACOSX_DEPLOYMENT_TARGET=10.8 -script: - - if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then - echo Trailing whitespace found, aborting; - exit 1; - fi - - mkdir build - - cd build - - cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DGLFW_USE_WAYLAND=${USE_WAYLAND} -DGLFW_USE_OSMESA=${USE_OSMESA} .. - - cmake --build . -notifications: - email: - recipients: - - ci@glfw.org - on_success: never - on_failure: always diff --git a/README.md b/README.md index a7e8460e..f4a6ca64 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GLFW -[![Build status](https://travis-ci.org/glfw/glfw.svg?branch=master)](https://travis-ci.org/glfw/glfw) +[![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions) [![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw) [![Coverity Scan](https://scan.coverity.com/projects/4884/badge.svg)](https://scan.coverity.com/projects/glfw-glfw) From 4e1aeb899c6eba370612a0e7722d54f91b7c2602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 25 Jun 2021 00:14:38 +0200 Subject: [PATCH 20/27] Add CI dependency still needed by stable branch The main branch no longer needs the extra-cmake-modules package but the stable branch still does. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74b28e4a..48e1666c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: - name: Install dependencies run: | sudo apt update - sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev + sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev extra-cmake-modules - name: Configure static library run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON From 45d1f547cd20cba0408a6f183c4067a220780b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 9 Jun 2021 16:44:45 +0200 Subject: [PATCH 21/27] Move VS 2019 builds from AppVeyor to GH Actions GitHub runners unfortunately do not come with MinGW or VS 2010 pre-installed, so moving those builds will be more involved. MinGW-w64 is not a good replacement for MinGW as it is far more complete. This gives at least some feedback for all supported platforms via the GitHub Actions system. (cherry picked from commit 4e788fc6dc08d635aaae72ea5c804d79fe272daa) --- .appveyor.yml | 18 ++---------------- .github/workflows/build.yml | 31 ++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a21829a6..a4a01666 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,5 @@ image: - Visual Studio 2015 - - Visual Studio 2019 branches: only: - ci @@ -21,26 +20,13 @@ environment: - GENERATOR: Visual Studio 10 2010 BUILD_SHARED_LIBS: OFF CFLAGS: /WX - - GENERATOR: Visual Studio 16 2019 - BUILD_SHARED_LIBS: ON - CFLAGS: /WX - - GENERATOR: Visual Studio 16 2019 - BUILD_SHARED_LIBS: OFF - CFLAGS: /WX matrix: fast_finish: true - exclude: - - image: Visual Studio 2015 - GENERATOR: Visual Studio 16 2019 - - image: Visual Studio 2019 - GENERATOR: Visual Studio 10 2010 - - image: Visual Studio 2019 - GENERATOR: MinGW Makefiles for: - matrix: - except: - - GENERATOR: Visual Studio 10 2010 + only: + - GENERATOR: MinGW Makefiles build_script: - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin% - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48e1666c..1ca689ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,14 +6,14 @@ on: permissions: statuses: write contents: read -env: - CC: clang - CFLAGS: -Werror jobs: build-linux-x11-clang: name: X11 (Linux, Clang) runs-on: ubuntu-latest + env: + CC: clang + CFLAGS: -Werror steps: - uses: actions/checkout@v2 - name: Install dependencies @@ -34,6 +34,9 @@ jobs: build-linux-wayland-clang: name: Wayland (Linux, Clang) runs-on: ubuntu-latest + env: + CC: clang + CFLAGS: -Werror steps: - uses: actions/checkout@v2 - name: Install dependencies @@ -54,6 +57,9 @@ jobs: build-linux-null-clang: name: Null (Linux, Clang) runs-on: ubuntu-latest + env: + CC: clang + CFLAGS: -Werror steps: - uses: actions/checkout@v2 - name: Install dependencies @@ -75,6 +81,7 @@ jobs: name: Cocoa (macOS, Clang) runs-on: macos-latest env: + CFLAGS: -Werror MACOSX_DEPLOYMENT_TARGET: 10.8 steps: - uses: actions/checkout@v2 @@ -89,3 +96,21 @@ jobs: - name: Build shared library run: cmake --build build-shared --parallel + build-windows-win32-vs2019: + name: Win32 (Windows, VS2019) + runs-on: windows-latest + env: + CFLAGS: /WX + steps: + - uses: actions/checkout@v2 + + - name: Configure static library + run: cmake -S . -B build-static -G "Visual Studio 16 2019" + - name: Build static library + run: cmake --build build-static --parallel + + - name: Configure shared library + run: cmake -S . -B build-shared -G "Visual Studio 16 2019" -D BUILD_SHARED_LIBS=ON + - name: Build shared library + run: cmake --build build-shared --parallel + From 5ecf2cbdbf086def1b7b038e3e251082a860fe96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 9 Jun 2021 16:48:34 +0200 Subject: [PATCH 22/27] Add 'latest' branch to all CI builds With 3.4, the tip of the 'latest' branch will be a merge commit for 3.3-stable and the main branch, and not simply a fast-foward to an already tested commit. This sets up a tiny additional safety net before that merge. (cherry picked from commit 3b132286502edbed1d05145e7e7e1a8cd7d8b976) --- .appveyor.yml | 1 + .github/workflows/build.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index a4a01666..2742949b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,6 +4,7 @@ branches: only: - ci - master + - latest - 3.3-stable skip_tags: true environment: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ca689ed..014498ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: pull_request: push: - branches: [ ci, master, 3.3-stable ] + branches: [ ci, master, latest, 3.3-stable ] permissions: statuses: write contents: read From 6518847f4d333baf44f124de88c4514f09ebfaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 9 Jun 2021 22:36:13 +0200 Subject: [PATCH 23/27] Update IRC network to Libera.Chat The `#glfw` IRC channel is moving to the Libera.Chat network due to the recent takeover of the Freenode network. (cherry picked from commit 78380c7761043b0e4ab1190e3cccbe4d94359aa6) --- README.md | 2 +- docs/CONTRIBUTING.md | 2 +- docs/SUPPORT.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f4a6ca64..775e42cf 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ well as news, documentation and other information about the project. If you have questions related to the use of GLFW, we have a [forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on -[Freenode](http://freenode.net/). +[Libera.Chat](https://libera.chat/). If you have a bug to report, a patch to submit or a feature you'd like to request, please file it in the diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 070cff95..11ddf09b 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -24,7 +24,7 @@ section](https://discourse.glfw.org/c/support) of the forum, under the [Stack Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on Stack Exchange or in the IRC channel `#glfw` on -[Freenode](http://freenode.net/). +[Libera.Chat](https://libera.chat/). Questions about the design or implementation of GLFW or about future plans should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the diff --git a/docs/SUPPORT.md b/docs/SUPPORT.md index 604957d0..fdef2597 100644 --- a/docs/SUPPORT.md +++ b/docs/SUPPORT.md @@ -5,7 +5,7 @@ guides and the API reference. If you have questions about using GLFW, we have a [forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on -[Freenode](http://freenode.net/). +[Libera.Chat](https://libera.chat/). Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues). Please check the [contribution From db34aea144399433b5d43a219751d245ac36aa0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 9 Jun 2021 22:43:27 +0200 Subject: [PATCH 24/27] Fix some documentation URLs still using http: Some URLs in the documentation were overlooked during the switch to https: for the GLFW website. This updates those and a few third-party URLs. (cherry picked from commit 787295b3aff950abd45bee3495ac1200eb6bc5e1) --- README.md | 24 ++++++++++++------------ docs/SUPPORT.md | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 775e42cf..ba2240ca 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,18 @@ GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On Linux both X11 and Wayland are supported. GLFW is licensed under the [zlib/libpng -license](http://www.glfw.org/license.html). +license](https://www.glfw.org/license.html). -You can [download](http://www.glfw.org/download.html) the latest stable release +You can [download](https://www.glfw.org/download.html) the latest stable release as source or Windows binaries, or fetch the `latest` branch from GitHub. Each release starting with 3.0 also has a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with source and binary archives. -The [documentation](http://www.glfw.org/docs/latest/) is available online and is +The [documentation](https://www.glfw.org/docs/latest/) is available online and is included in all source and binary archives. See the [release notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and deprecations in the latest release. For more details see the [version -history](http://www.glfw.org/changelog.html). +history](https://www.glfw.org/changelog.html). The `master` branch is the stable integration branch and _should_ always compile and run on all supported platforms, although details of newly added features may @@ -34,9 +34,9 @@ fixes live in [other branches](https://github.com/glfw/glfw/branches/all) until they are stable enough to merge. If you are new to GLFW, you may find the -[tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If +[tutorial](https://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If you have used GLFW 2 in the past, there is a [transition -guide](http://www.glfw.org/docs/latest/moving.html) for moving to the GLFW +guide](https://www.glfw.org/docs/latest/moving.html) for moving to the GLFW 3 API. @@ -52,16 +52,16 @@ MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC and Clang. It will likely compile in other environments as well, but this is not regularly tested. -There are [pre-compiled Windows binaries](http://www.glfw.org/download.html) +There are [pre-compiled Windows binaries](https://www.glfw.org/download.html) available for all supported compilers. -See the [compilation guide](http://www.glfw.org/docs/latest/compile.html) for +See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for more information about how to compile GLFW yourself. ## Using GLFW -See the [documentation](http://www.glfw.org/docs/latest/) for tutorials, guides +See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides and the API reference. @@ -79,7 +79,7 @@ Unix-like systems running the X Window System are supported even without a desktop environment or modern extensions, although some features require a running window or clipboard manager. The OSMesa backend requires Mesa 6.3. -See the [compatibility guide](http://www.glfw.org/docs/latest/compat.html) +See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html) in the documentation for more information. @@ -104,7 +104,7 @@ located in the `deps/` directory. - [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk -The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can +The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can find that tool. @@ -126,7 +126,7 @@ information on what to include when reporting a bug. ## Contact -On [glfw.org](http://www.glfw.org/) you can find the latest version of GLFW, as +On [glfw.org](https://www.glfw.org/) you can find the latest version of GLFW, as well as news, documentation and other information about the project. If you have questions related to the use of GLFW, we have a diff --git a/docs/SUPPORT.md b/docs/SUPPORT.md index fdef2597..79a45a8f 100644 --- a/docs/SUPPORT.md +++ b/docs/SUPPORT.md @@ -1,6 +1,6 @@ # Support resources -See the [latest documentation](http://www.glfw.org/docs/latest/) for tutorials, +See the [latest documentation](https://www.glfw.org/docs/latest/) for tutorials, guides and the API reference. If you have questions about using GLFW, we have a From e04cd8283ee7519eee44367b5b04f8e6d3dfb623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 14 Jun 2021 21:21:17 +0200 Subject: [PATCH 25/27] Add notes on getting the HDC of a window on Win32 Related to #1913. (cherry picked from commit 15e05adf67203baf5c6c5349240208502c68b27c) --- include/GLFW/glfw3native.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index e09468bb..d887b94f 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -161,6 +161,14 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor); * @return The `HWND` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * + * @remark The `HDC` associated with the window can be queried with the + * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) + * function. + * @code + * HDC dc = GetDC(glfwGetWin32Window(window)); + * @endcode + * This DC is private and does not need to be released. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * @@ -177,6 +185,14 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window); * @return The `HGLRC` of the specified window, or `NULL` if an * [error](@ref error_handling) occurred. * + * @remark The `HDC` associated with the window can be queried with the + * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) + * function. + * @code + * HDC dc = GetDC(glfwGetWin32Window(window)); + * @endcode + * This DC is private and does not need to be released. + * * @thread_safety This function may be called from any thread. Access is not * synchronized. * From b1a8bc5d69f81640ee5f736f1aa26ccf1db61dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 15 Jun 2021 18:14:56 +0200 Subject: [PATCH 26/27] Add missing changelog entry Related to #1843. (cherry picked from commit 6f7c61c6b3bac75168838a803fa8ce303879817d) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ba2240ca..3c8dbccf 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or later (#1783,#1796) - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874) + - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) ## Contact From 813edfa494f1f694bfe2b6d27bb731da2e277d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 22 Jun 2021 00:06:51 +0200 Subject: [PATCH 27/27] Wayland: Fix case of epollshim find module name This fixes a warning during the configuration step of CMake. (cherry picked from commit 5b73fc8b80011e9853e97e1c1fa3b566d69bf469) --- CMake/modules/FindEpollShim.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/modules/FindEpollShim.cmake b/CMake/modules/FindEpollShim.cmake index 2facb419..f34d0709 100644 --- a/CMake/modules/FindEpollShim.cmake +++ b/CMake/modules/FindEpollShim.cmake @@ -13,5 +13,5 @@ if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) +find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)