From 6903c469a78d7f2a4a23182deef6761732a78f51 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 25 May 2022 17:46:04 +0000 Subject: [PATCH] Roll third_party/glfw/ 947731113..62e175ef9 (275 commits) Also update the BUILD.gn files for GLFW. https://chromium.googlesource.com/external/github.com/glfw/glfw/+log/94773111300f..62e175ef9fae $ git log 947731113..62e175ef9 --date=short --no-merges --format='%ad %ae %s' 2022-05-05 elmindreda Win32: Add comment clarifying use of ToUnicode 2022-05-03 elmindreda Fix GLAPIENTRY not being defined for native access 2022-05-03 elmindreda Remove OSMesa specific code from offscreen example 2022-04-21 elmindreda Win32: Make monitor area retrieval more consistent 2022-04-21 elmindreda Fix and clarify comments for GLFWAPI 2022-04-06 elmindreda Move last bits of window setup to platform code 2021-11-09 elmindreda Simplify struct stitching for sync primitives 2022-04-08 elmindreda Wayland: Add support for older wayland-scanner 2022-04-06 elmindreda Win32: Fix message reported by VS 2022 2022-04-06 elmindreda Win32: Remove superfluous cast 2022-04-18 elmindreda Move CODEOWNERS to .github directory 2022-04-18 elmindreda X11: Fix segfault on malformed INCR response 2022-04-18 elmindreda X11: Fix returned clipboard string freed too early 2022-04-18 elmindreda Document delayed initialization of EGL display 2022-04-18 elmindreda Update stb_image_write.h to version 1.16 2022-04-28 elmindreda X11: Fix OSMesa library not being unloaded 2022-04-28 elmindreda Wayland: Fix OSMesa library not being unloaded 2022-04-28 elmindreda Cocoa: Fix EGL and OSMesa not being unloaded 2022-04-28 elmindreda Win32: Fix OSMesa library not being unloaded 2022-04-21 elmindreda Fix order of error checks in glfwSetGammaRamp 2022-04-08 elmindreda Fix glfwMakeContextCurrent using uninitialized TLS 2022-03-31 elmindreda Wayland: Add support for file drop events 2022-03-31 elmindreda Wayland: Clean up listener struct initialization 2022-03-29 elmindreda Wayland: Make data offer reading a generic utility 2022-03-29 elmindreda Wayland: Move window related code to window module 2022-03-24 elmindreda Wayland: Remove check for error that cannot happen 2022-03-24 elmindreda Wayland: Remove error reporting of external bugs 2022-03-24 elmindreda Wayland: Clean up clipboard writing 2022-03-24 elmindreda Move URI list parsing to shared code 2022-03-24 elmindreda Wayland: Add strerror output to error descriptions 2022-03-24 elmindreda Wayland: Clean up clipboard reading 2022-03-24 elmindreda Wayland: Simplify clipboard string allocation 2022-03-23 elmindreda Wayland: Improve handling of pending data offers 2022-03-24 elmindreda Wayland: Return our clipboard without roundtrips 2022-03-23 elmindreda Wayland: Fix error paths not closing sending fd 2022-03-23 elmindreda Wayland: Rename listener user data parameters 2022-03-23 elmindreda Wayland: Clean up pointer declarations 2022-03-23 elmindreda Wayland: Rename data transfer parameters 2022-03-22 elmindreda Wayland: Fix phrasing and type of error messages 2022-03-22 elmindreda Wayland: Fix partial writes of clipboard string 2022-03-22 elmindreda Wayland: Remove superfluous global struct member 2022-03-22 elmindreda Wayland: Fix double free on data source error 2022-03-22 elmindreda Wayland: Fix handling of clipboard set to self 2022-03-21 elmindreda Fix missing newline 2022-03-22 elmindreda POSIX: Fix data type of return values 2022-03-18 elmindreda Cocoa: Fix AirPlay causing harmless init error 2022-03-17 elmindreda Win32: Fix using executable instance and not ours 2022-03-15 elmindreda Add checks for some invalid values to public API 2022-03-15 elmindreda Win32: Fix glfwGetKeyScancode for GLFW_KEY_PAUSE 2022-03-15 elmindreda Win32: Fix scancode and key for Alt+PrtSc events (...) 2021-07-14 elmindreda Add credit 2021-07-07 david.v.mckay realizing "as you would" is platform dependent 2021-07-07 david.v.mckay Clarify "as you would" for beginners. 2021-06-25 elmindreda Remove errors for gamepad element mismatch 2021-06-23 lazylumpster+github Consistent subsections in compile guide 2021-06-22 elmindreda Wayland: Fix missing constant on FreeBSD 2021-06-22 elmindreda Wayland: Fix case of epollshim find module name 2021-06-15 elmindreda Add missing changelog entry 2021-06-14 elmindreda Add notes on getting the HDC of a window on Win32 2021-06-09 elmindreda Fix some documentation URLs still using http: 2021-06-09 elmindreda Update IRC network to Libera.Chat 2021-06-09 elmindreda Add 'latest' branch to all CI builds 2021-06-09 elmindreda Move VS 2019 builds from AppVeyor to GH Actions 2021-06-07 elmindreda Migrate from Travis CI to GitHub Actions 2021-06-07 elmindreda Fix numeric conversion warnings in example 2021-05-14 elmindreda EGL: Fix creation of single-buffered windows 2021-05-14 elmindreda Move single/double-buffer filtering to backends 2021-05-13 elmindreda Skip initial buffer swap when single-buffered 2021-05-13 elmindreda Make GLFW_DOUBLEBUFFER a window attribute 2021-05-13 elmindreda Make monitor and joystick names static strings 2021-05-13 elmindreda Remove claim that EGL is not supported on macOS 2021-05-12 elmindreda Clarify documentation for hints 2021-05-12 elmindreda Fix header version macro descriptions in docs 2021-04-20 elmindreda Win32: Always define UNICODE and _UNICODE 2021-04-16 elmindreda Win32: Fix macros being enabled for other backends 2021-04-22 elmindreda Fix description of video mode ordering in docs 2021-04-15 konstantin Fix hardcoded runtime destination in CMake install 2021-04-12 elmindreda Win32: Fix compilation with standalone LLVM 2021-04-12 elmindreda Replace GL_ARB_debug_output in comments 2021-04-12 elmindreda Replace GL_ARB_debug_output in context guide 2021-04-11 elmindreda Add Vulkan device presentation support to glfwinfo 2021-04-11 elmindreda Add window surface creation to glfwinfo 2020-12-10 elmindreda Fix grammar in MoltenVK support docs 2021-04-11 elmindreda Add GLFW_X11_XCB_VULKAN_SURFACE flag to glfwinfo 2020-12-10 elmindreda Add docs for GLFW_X11_XCB_VULKAN_SURFACE 2020-10-23 caramelli.devel Add GLFW_X11_XCB_VULKAN_SURFACE init hint 2020-10-12 elmindreda Update USE_MSVC_RUNTIME_LIBRARY_DLL for CMake 3.15 2021-03-21 elmindreda Fix implicit double-to-float in linmath.h 2021-03-19 elmindreda Add issue number to changelog 2021-03-19 elmindreda Remove deprecated Doxygen tag 2021-03-15 elmindreda Win32: Add warning when option will have no effect 2020-08-20 elmindreda Ignore cached state when setting window attributes 2021-03-10 elmindreda Update linmath.h 2021-03-09 elmindreda Win32: Add MinGW-w64 detection to version string 2021-03-08 elmindreda X11: Fix attribs not applied on leaving fullscreen 2021-02-17 elmindreda Update changelog 2021-02-09 elmindreda Wayland: Move DPI fallback work to output done 2021-01-20 elmindreda Win32: Fix content area rescaling on older systems 2021-01-19 elmindreda Win32: Fix full screen windows affected by scaling 2021-02-10 elmindreda Cocoa: Fix console apps getting a dock icon Created with: roll-dep third_party/glfw Bug: dawn:1246 Change-Id: I516d939e791868b158c5c6daefc9d7ad18cdb461 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91432 Reviewed-by: Austin Eng Commit-Queue: Corentin Wallez --- DEPS | 2 +- third_party/gn/glfw/BUILD.gn | 117 ++++++++++++++++++++++------------- 2 files changed, 74 insertions(+), 45 deletions(-) diff --git a/DEPS b/DEPS index 1ad452582b..cef6310d0a 100644 --- a/DEPS +++ b/DEPS @@ -120,7 +120,7 @@ deps = { # GLFW for tests and samples 'third_party/glfw': { - 'url': '{chromium_git}/external/github.com/glfw/glfw@94773111300fee0453844a4c9407af7e880b4df8', + 'url': '{chromium_git}/external/github.com/glfw/glfw@62e175ef9fae75335575964c845a302447c012c7', }, 'third_party/vulkan_memory_allocator': { diff --git a/third_party/gn/glfw/BUILD.gn b/third_party/gn/glfw/BUILD.gn index b592b4d2c4..1c00094c13 100644 --- a/third_party/gn/glfw/BUILD.gn +++ b/third_party/gn/glfw/BUILD.gn @@ -25,23 +25,6 @@ glfw_dir = dawn_glfw_dir config("glfw_public") { include_dirs = [ "${glfw_dir}/include" ] - - if (is_win) { - defines = [ "_GLFW_WIN32" ] - } - - if (is_mac) { - defines = [ "_GLFW_COCOA" ] - } - - if (is_linux) { - # ANGLE builds only libEGL.so, so tell GLFW to load that instead of - # the default libEGL.so.1. - defines = [ - "_GLFW_X11", - "_GLFW_EGL_LIBRARY=\"libEGL.so\"", - ] - } } static_library("glfw") { @@ -59,56 +42,79 @@ static_library("glfw") { cflags_c = [ "-Wno-sign-compare", "-Wno-missing-field-initializers", + "-Wno-macro-redefined", ] } + defines = [] + libs = [] + + # Common sources. sources = [ "${glfw_dir}/include/GLFW/glfw3.h", "${glfw_dir}/include/GLFW/glfw3native.h", "${glfw_dir}/src/context.c", "${glfw_dir}/src/egl_context.c", - "${glfw_dir}/src/egl_context.h", "${glfw_dir}/src/init.c", "${glfw_dir}/src/input.c", "${glfw_dir}/src/internal.h", + "${glfw_dir}/src/mappings.h", "${glfw_dir}/src/monitor.c", + "${glfw_dir}/src/null_init.c", + "${glfw_dir}/src/null_joystick.c", + "${glfw_dir}/src/null_joystick.h", + "${glfw_dir}/src/null_monitor.c", + "${glfw_dir}/src/null_platform.h", + "${glfw_dir}/src/null_window.c", "${glfw_dir}/src/osmesa_context.c", - "${glfw_dir}/src/osmesa_context.h", + "${glfw_dir}/src/platform.c", + "${glfw_dir}/src/platform.h", "${glfw_dir}/src/vulkan.c", "${glfw_dir}/src/window.c", ] - libs = [] - if (is_win) { + # Code shared by all backends on an OS. + if (is_linux) { + defines += [ "_GLFW_EGL_LIBRARY=\"libEGL.so\"" ] sources += [ - "${glfw_dir}/src/wgl_context.c", - "${glfw_dir}/src/wgl_context.h", - "${glfw_dir}/src/win32_init.c", - "${glfw_dir}/src/win32_joystick.c", - "${glfw_dir}/src/win32_joystick.h", - "${glfw_dir}/src/win32_monitor.c", - "${glfw_dir}/src/win32_platform.h", - "${glfw_dir}/src/win32_thread.c", - "${glfw_dir}/src/win32_time.c", - "${glfw_dir}/src/win32_window.c", + "${glfw_dir}/src/posix_module.c", + "${glfw_dir}/src/posix_thread.c", + "${glfw_dir}/src/posix_thread.h", + "${glfw_dir}/src/posix_time.c", + "${glfw_dir}/src/posix_time.h", + ] + libs += [ + "m", + "rt", + "dl", ] } - if (is_linux || is_mac) { + if (is_mac) { sources += [ + "${glfw_dir}/src/cocoa_time.c", + "${glfw_dir}/src/cocoa_time.h", + "${glfw_dir}/src/posix_module.c", "${glfw_dir}/src/posix_thread.c", "${glfw_dir}/src/posix_thread.h", ] } - if (is_linux) { + if (is_win) { + sources += [ + "${glfw_dir}/src/win32_module.c", + "${glfw_dir}/src/win32_thread.c", + "${glfw_dir}/src/win32_thread.h", + "${glfw_dir}/src/win32_time.c", + "${glfw_dir}/src/win32_time.h", + ] + } + + # Per-backend code. + if (dawn_use_x11) { + defines += [ "_GLFW_X11" ] sources += [ "${glfw_dir}/src/glx_context.c", - "${glfw_dir}/src/glx_context.h", - "${glfw_dir}/src/linux_joystick.c", - "${glfw_dir}/src/linux_joystick.h", - "${glfw_dir}/src/posix_time.c", - "${glfw_dir}/src/posix_time.h", "${glfw_dir}/src/x11_init.c", "${glfw_dir}/src/x11_monitor.c", "${glfw_dir}/src/x11_platform.h", @@ -116,34 +122,44 @@ static_library("glfw") { "${glfw_dir}/src/xkb_unicode.c", "${glfw_dir}/src/xkb_unicode.h", ] - libs += [ - "rt", - "dl", "X11", + "Xi", "Xcursor", "Xinerama", "Xrandr", ] } + # No wayland support for GLFW in GN builds. + if (dawn_use_x11) { + if (is_linux) { + sources += [ + "${glfw_dir}/src/linux_joystick.c", + "${glfw_dir}/src/linux_joystick.h", + ] + } + sources += [ + "${glfw_dir}/src/posix_poll.c", + "${glfw_dir}/src/posix_poll.h", + ] + } if (is_mac) { + defines += [ "_GLFW_COCOA" ] sources += [ "${glfw_dir}/src/cocoa_init.m", "${glfw_dir}/src/cocoa_joystick.h", "${glfw_dir}/src/cocoa_joystick.m", "${glfw_dir}/src/cocoa_monitor.m", "${glfw_dir}/src/cocoa_platform.h", - "${glfw_dir}/src/cocoa_time.c", "${glfw_dir}/src/cocoa_window.m", - "${glfw_dir}/src/nsgl_context.h", "${glfw_dir}/src/nsgl_context.m", ] + frameworks = [ "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", - "CoreVideo.framework", ] cflags_objc = [ "-Wno-sign-compare", @@ -151,4 +167,17 @@ static_library("glfw") { "-Wno-objc-multiple-method-names", ] } + + if (is_win) { + defines += [ "_GLFW_WIN32" ] + sources += [ + "${glfw_dir}/src/wgl_context.c", + "${glfw_dir}/src/win32_init.c", + "${glfw_dir}/src/win32_joystick.c", + "${glfw_dir}/src/win32_joystick.h", + "${glfw_dir}/src/win32_monitor.c", + "${glfw_dir}/src/win32_platform.h", + "${glfw_dir}/src/win32_window.c", + ] + } }