diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-03-21 15:43:25 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-21 15:43:25 +0000 |
| commit | 5c9da66595ddae871097b343d1781d55f70fcd95 (patch) | |
| tree | a774203bab50d01e3c5e43d3c4ebe763da0fe92e | |
| parent | 9cbb9d85518c7d3334120b4c22acc4d8812687fe (diff) | |
| parent | 65e68f11f81bb44dd9c81b81f3c5590f113878f7 (diff) | |
Merge pull request #3294 from laytan/update-glfw-from-3.3.8-to-3.4
glfw: update from 3.3.8 to 3.4
| -rw-r--r-- | glfw3.dll | bin | 0 -> 232448 bytes | |||
| -rw-r--r-- | tests/vendor/glfw/test_vendor_glfw.odin | 6 | ||||
| -rw-r--r-- | vendor/glfw/bindings/bindings.odin | 29 | ||||
| -rw-r--r-- | vendor/glfw/bindings/types.odin | 11 | ||||
| -rw-r--r-- | vendor/glfw/constants.odin | 97 | ||||
| -rw-r--r-- | vendor/glfw/lib/darwin/libglfw3.a | bin | 595160 -> 656832 bytes | |||
| -rw-r--r-- | vendor/glfw/lib/glfw3.dll | bin | 216576 -> 232448 bytes | |||
| -rw-r--r-- | vendor/glfw/lib/glfw3.lib | bin | 634898 -> 706276 bytes | |||
| -rw-r--r-- | vendor/glfw/lib/glfw3_mt.lib | bin | 634316 -> 706026 bytes | |||
| -rw-r--r-- | vendor/glfw/lib/glfw3dll.lib | bin | 30306 -> 31378 bytes | |||
| -rw-r--r-- | vendor/glfw/native_darwin.odin | 14 | ||||
| -rw-r--r-- | vendor/glfw/native_windows.odin | 18 | ||||
| -rw-r--r-- | vendor/glfw/types.odin | 6 | ||||
| -rw-r--r-- | vendor/glfw/wrapper.odin | 7 |
14 files changed, 124 insertions, 64 deletions
diff --git a/glfw3.dll b/glfw3.dll Binary files differnew file mode 100644 index 000000000..0511a9a8c --- /dev/null +++ b/glfw3.dll diff --git a/tests/vendor/glfw/test_vendor_glfw.odin b/tests/vendor/glfw/test_vendor_glfw.odin index baf46aa7e..ce55ad7ef 100644 --- a/tests/vendor/glfw/test_vendor_glfw.odin +++ b/tests/vendor/glfw/test_vendor_glfw.odin @@ -6,8 +6,8 @@ import "vendor:glfw" import "core:os" GLFW_MAJOR :: 3 -GLFW_MINOR :: 3 -GLFW_PATCH :: 4 +GLFW_MINOR :: 4 +GLFW_PATCH :: 0 TEST_count := 0 TEST_fail := 0 @@ -46,4 +46,4 @@ main :: proc() { test_glfw :: proc(t: ^testing.T) { major, minor, patch := glfw.GetVersion() expect(t, major == GLFW_MAJOR && minor == GLFW_MINOR, fmt.tprintf("Expected GLFW.GetVersion: %v.%v.%v, got %v.%v.%v instead", GLFW_MAJOR, GLFW_MINOR, GLFW_PATCH, major, minor, patch)) -}
\ No newline at end of file +} diff --git a/vendor/glfw/bindings/bindings.odin b/vendor/glfw/bindings/bindings.odin index bb50b8973..164a8ea2d 100644 --- a/vendor/glfw/bindings/bindings.odin +++ b/vendor/glfw/bindings/bindings.odin @@ -21,14 +21,21 @@ when ODIN_OS == .Windows { "system:shell32.lib", } } -} else when ODIN_OS == .Linux { - foreign import glfw "system:glfw" } else when ODIN_OS == .Darwin { - foreign import glfw { - "../lib/darwin/libglfw3.a", - "system:Cocoa.framework", - "system:IOKit.framework", - "system:OpenGL.framework", + when GLFW_SHARED { + foreign import glfw { + "system:glfw", + "system:Cocoa.framework", + "system:IOKit.framework", + "system:OpenGL.framework", + } + } else { + foreign import glfw { + "../lib/darwin/libglfw3.a", + "system:Cocoa.framework", + "system:IOKit.framework", + "system:OpenGL.framework", + } } } else { foreign import glfw "system:glfw" @@ -44,6 +51,10 @@ foreign glfw { InitHint :: proc(hint, value: c.int) --- + InitAllocator :: proc(#by_ptr allocator: Allocator) --- + + InitVulkanLoader :: proc(loader: vk.ProcGetInstanceProcAddr) --- + GetVersion :: proc(major, minor, rev: ^c.int) --- GetError :: proc(description: ^cstring) -> c.int --- @@ -94,6 +105,7 @@ foreign glfw { GetKey :: proc(window: WindowHandle, key: c.int) -> c.int --- GetKeyName :: proc(key, scancode: c.int) -> cstring --- SetWindowShouldClose :: proc(window: WindowHandle, value: b32) --- + GetWindowTitle :: proc(window: WindowHandle) -> cstring --- JoystickPresent :: proc(joy: c.int) -> b32 --- GetJoystickName :: proc(joy: c.int) -> cstring --- GetKeyScancode :: proc(key: c.int) -> c.int --- @@ -184,5 +196,8 @@ foreign glfw { SetJoystickCallback :: proc(cbfun: JoystickProc) -> JoystickProc --- SetErrorCallback :: proc(cbfun: ErrorProc) -> ErrorProc --- + + GetPlatform :: proc() -> c.int --- + PlatformSupported :: proc(platform: c.int) -> b32 --- } diff --git a/vendor/glfw/bindings/types.odin b/vendor/glfw/bindings/types.odin index a3bee3fae..5bdbf9cb9 100644 --- a/vendor/glfw/bindings/types.odin +++ b/vendor/glfw/bindings/types.odin @@ -30,6 +30,13 @@ GamepadState :: struct { axes: [6]f32, } +Allocator :: struct { + allocate: AllocateProc, + reallocate: ReallocateProc, + deallocate: DeallocateProc, + user: rawptr, +} + /*** Procedure type declarations ***/ WindowIconifyProc :: #type proc "c" (window: WindowHandle, iconified: c.int) WindowRefreshProc :: #type proc "c" (window: WindowHandle) @@ -53,3 +60,7 @@ CursorEnterProc :: #type proc "c" (window: WindowHandle, entered: c.int) JoystickProc :: #type proc "c" (joy, event: c.int) ErrorProc :: #type proc "c" (error: c.int, description: cstring) + +AllocateProc :: #type proc "c" (size: c.size_t, user: rawptr) -> rawptr +ReallocateProc :: #type proc "c" (block: rawptr, size: c.size_t, user: rawptr) -> rawptr +DeallocateProc :: #type proc "c" (block: rawptr, user: rawptr) diff --git a/vendor/glfw/constants.odin b/vendor/glfw/constants.odin index 90c46f4bc..ce4f80584 100644 --- a/vendor/glfw/constants.odin +++ b/vendor/glfw/constants.odin @@ -6,8 +6,8 @@ GLFW_SHARED :: #config(GLFW_SHARED, false) /*** Constants ***/ /* Versions */ VERSION_MAJOR :: 3 -VERSION_MINOR :: 3 -VERSION_REVISION :: 8 +VERSION_MINOR :: 4 +VERSION_REVISION :: 0 /* Booleans */ TRUE :: true @@ -251,17 +251,21 @@ GAMEPAD_AXIS_RIGHT_TRIGGER :: 5 GAMEPAD_AXIS_LAST :: GAMEPAD_AXIS_RIGHT_TRIGGER /* Error constants */ -NO_ERROR :: 0x00000000 -NOT_INITIALIZED :: 0x00010001 -NO_CURRENT_CONTEXT :: 0x00010002 -INVALID_ENUM :: 0x00010003 -INVALID_VALUE :: 0x00010004 -OUT_OF_MEMORY :: 0x00010005 -API_UNAVAILABLE :: 0x00010006 -VERSION_UNAVAILABLE :: 0x00010007 -PLATFORM_ERROR :: 0x00010008 -FORMAT_UNAVAILABLE :: 0x00010009 -NO_WINDOW_CONTEXT :: 0x0001000A +NO_ERROR :: 0x00000000 +NOT_INITIALIZED :: 0x00010001 +NO_CURRENT_CONTEXT :: 0x00010002 +INVALID_ENUM :: 0x00010003 +INVALID_VALUE :: 0x00010004 +OUT_OF_MEMORY :: 0x00010005 +API_UNAVAILABLE :: 0x00010006 +VERSION_UNAVAILABLE :: 0x00010007 +PLATFORM_ERROR :: 0x00010008 +FORMAT_UNAVAILABLE :: 0x00010009 +NO_WINDOW_CONTEXT :: 0x0001000A +CURSOR_UNAVAILABLE :: 0x0001000B +FEATURE_UNAVAILABLE :: 0x0001000C +FEATURE_UNIMPLEMENTED :: 0x0001000D +PLATFORM_UNAVAILABLE :: 0x0001000E /* Window attributes */ FOCUSED :: 0x00020001 @@ -276,6 +280,9 @@ CENTER_CURSOR :: 0x00020009 TRANSPARENT_FRAMEBUFFER :: 0x0002000A HOVERED :: 0x0002000B FOCUS_ON_SHOW :: 0x0002000C +MOUSE_PASSTHROUGH :: 0x0002000D +POSITION_X :: 0x0002000E +POSITION_Y :: 0x0002000F /* Pixel window attributes */ RED_BITS :: 0x00021001 @@ -302,12 +309,14 @@ CONTEXT_VERSION_MINOR :: 0x00022003 CONTEXT_REVISION :: 0x00022004 CONTEXT_ROBUSTNESS :: 0x00022005 OPENGL_FORWARD_COMPAT :: 0x00022006 -OPENGL_DEBUG_CONTEXT :: 0x00022007 +CONTEXT_DEBUG :: 0x00022007 +OPENGL_DEBUG_CONTEXT :: CONTEXT_DEBUG // Backwards compatibility OPENGL_PROFILE :: 0x00022008 CONTEXT_RELEASE_BEHAVIOR :: 0x00022009 CONTEXT_NO_ERROR :: 0x0002200A CONTEXT_CREATION_API :: 0x0002200B SCALE_TO_MONITOR :: 0x0002200C +SCALE_FRAMEBUFFER :: 0x0002200D /* Cross platform attributes */ COCOA_RETINA_FRAMEBUFFER :: 0x00023001 @@ -315,6 +324,9 @@ COCOA_FRAME_NAME :: 0x00023002 COCOA_GRAPHICS_SWITCHING :: 0x00023003 X11_CLASS_NAME :: 0x00024001 X11_INSTANCE_NAME :: 0x00024002 +WIN32_KEYBOARD_MENU :: 0x00025001 +WIN32_SHOWDEFAULT :: 0x00025002 +WAYLAND_APP_ID :: 0x00026001 /* APIs */ NO_API :: 0 @@ -341,6 +353,7 @@ LOCK_KEY_MODS :: 0x00033004 CURSOR_NORMAL :: 0x00034001 CURSOR_HIDDEN :: 0x00034002 CURSOR_DISABLED :: 0x00034003 +CURSOR_CAPTURED :: 0x00034004 /* Mouse motion */ RAW_MOUSE_MOTION :: 0x00033005 @@ -355,24 +368,56 @@ NATIVE_CONTEXT_API :: 0x00036001 EGL_CONTEXT_API :: 0x00036002 OSMESA_CONTEXT_API :: 0x00036003 +ANGLE_PLATFORM_TYPE_NONE :: 0x00037001 +ANGLE_PLATFORM_TYPE_OPENGL :: 0x00037002 +ANGLE_PLATFORM_TYPE_OPENGLES :: 0x00037003 +ANGLE_PLATFORM_TYPE_D3D9 :: 0x00037004 +ANGLE_PLATFORM_TYPE_D3D11 :: 0x00037005 +ANGLE_PLATFORM_TYPE_VULKAN :: 0x00037007 +ANGLE_PLATFORM_TYPE_METAL :: 0x00037008 + +WAYLAND_PREFER_LIBDECOR :: 0x00038001 +WAYLAND_DISABLE_LIBDECOR :: 0x00038002 + +ANY_POSITION :: 0x80000000 + /* Types of cursors */ -ARROW_CURSOR :: 0x00036001 -IBEAM_CURSOR :: 0x00036002 -CROSSHAIR_CURSOR :: 0x00036003 -HAND_CURSOR :: 0x00036004 -HRESIZE_CURSOR :: 0x00036005 -VRESIZE_CURSOR :: 0x00036006 -RESIZE_NWSE_CURSOR :: 0x00036007 -RESIZE_NESW_CURSOR :: 0x00036008 +ARROW_CURSOR :: 0x00036001 +IBEAM_CURSOR :: 0x00036002 +CROSSHAIR_CURSOR :: 0x00036003 +POINTING_HAND_CURSOR :: 0x00036004 +RESIZE_EW_CURSOR :: 0x00036005 +RESIZE_NS_CURSOR :: 0x00036006 +RESIZE_NWSE_CURSOR :: 0x00036007 +RESIZE_NESW_CURSOR :: 0x00036008 +RESIZE_ALL_CURSOR :: 0x00036009 +NOT_ALLOWED_CURSOR :: 0x0003600A + +/* Backwards compatibility cursors. */ +HRESIZE_CURSOR :: RESIZE_EW_CURSOR +VRESIZE_CURSOR :: RESIZE_NS_CURSOR +HAND_CURSOR :: POINTING_HAND_CURSOR /* Joystick? */ CONNECTED :: 0x00040001 DISCONNECTED :: 0x00040002 -/* macOS specific init hint. */ -JOYSTICK_HAT_BUTTONS :: 0x00050001 -COCOA_CHDIR_RESOURCES :: 0x00051001 -COCOA_MENUBAR :: 0x00051002 +JOYSTICK_HAT_BUTTONS :: 0x00050001 +ANGLE_PLATFORM_TYPE :: 0x00050002 +PLATFORM :: 0x00050003 + +/* Platform specific init hints. */ +COCOA_CHDIR_RESOURCES :: 0x00051001 +COCOA_MENUBAR :: 0x00051002 +X11_XCB_VULKAN_SURFACE :: 0x00052001 +WAYLAND_LIBDECOR :: 0x00053001 + +ANY_PLATFORM :: 0x00060000 +PLATFORM_WIN32 :: 0x00060001 +PLATFORM_COCOA :: 0x00060002 +PLATFORM_WAYLAND :: 0x00060003 +PLATFORM_X11 :: 0x00060004 +PLATFORM_NULL :: 0x00060005 /* */ DONT_CARE :: -1 diff --git a/vendor/glfw/lib/darwin/libglfw3.a b/vendor/glfw/lib/darwin/libglfw3.a Binary files differindex 77506567f..08fb5935c 100644 --- a/vendor/glfw/lib/darwin/libglfw3.a +++ b/vendor/glfw/lib/darwin/libglfw3.a diff --git a/vendor/glfw/lib/glfw3.dll b/vendor/glfw/lib/glfw3.dll Binary files differindex 733404cf4..0511a9a8c 100644 --- a/vendor/glfw/lib/glfw3.dll +++ b/vendor/glfw/lib/glfw3.dll diff --git a/vendor/glfw/lib/glfw3.lib b/vendor/glfw/lib/glfw3.lib Binary files differindex 2a52eb4eb..92de42955 100644 --- a/vendor/glfw/lib/glfw3.lib +++ b/vendor/glfw/lib/glfw3.lib diff --git a/vendor/glfw/lib/glfw3_mt.lib b/vendor/glfw/lib/glfw3_mt.lib Binary files differindex 30ba4adab..eee805592 100644 --- a/vendor/glfw/lib/glfw3_mt.lib +++ b/vendor/glfw/lib/glfw3_mt.lib diff --git a/vendor/glfw/lib/glfw3dll.lib b/vendor/glfw/lib/glfw3dll.lib Binary files differindex e1b3f3efc..40d5189d9 100644 --- a/vendor/glfw/lib/glfw3dll.lib +++ b/vendor/glfw/lib/glfw3dll.lib diff --git a/vendor/glfw/native_darwin.odin b/vendor/glfw/native_darwin.odin index 181a53e24..999de218b 100644 --- a/vendor/glfw/native_darwin.odin +++ b/vendor/glfw/native_darwin.odin @@ -4,18 +4,10 @@ package glfw import NS "vendor:darwin/Foundation" -when GLFW_SHARED { - #panic("Dynamic linking for glfw is not supported for darwin yet") - foreign import glfw {"_"} -} else { - foreign import glfw { - "lib/darwin/libglfw3.a", - } -} - @(default_calling_convention="c", link_prefix="glfw") -foreign glfw { - GetCocoaWindow :: proc(window: WindowHandle) -> ^NS.Window --- +foreign { + GetCocoaWindow :: proc(window: WindowHandle) -> ^NS.Window --- + GetCocoaView :: proc(window: WindowHandle) -> ^NS.View --- } // TODO: diff --git a/vendor/glfw/native_windows.odin b/vendor/glfw/native_windows.odin index 9903ff298..ce0dbf66f 100644 --- a/vendor/glfw/native_windows.odin +++ b/vendor/glfw/native_windows.odin @@ -4,24 +4,8 @@ package glfw import win32 "core:sys/windows" -when GLFW_SHARED { - foreign import glfw { - "lib/glfw3dll.lib", - "system:user32.lib", - "system:gdi32.lib", - "system:shell32.lib", - } -} else { - foreign import glfw { - "lib/glfw3_mt.lib", - "system:user32.lib", - "system:gdi32.lib", - "system:shell32.lib", - } -} - @(default_calling_convention="c", link_prefix="glfw") -foreign glfw { +foreign { GetWin32Adapter :: proc(monitor: MonitorHandle) -> cstring --- GetWin32Monitor :: proc(monitor: MonitorHandle) -> cstring --- GetWin32Window :: proc(window: WindowHandle) -> win32.HWND --- diff --git a/vendor/glfw/types.odin b/vendor/glfw/types.odin index f537df7a2..cfe810fe5 100644 --- a/vendor/glfw/types.odin +++ b/vendor/glfw/types.odin @@ -11,6 +11,8 @@ GammaRamp :: glfw.GammaRamp Image :: glfw.Image GamepadState :: glfw.GamepadState +Allocator :: glfw.Allocator + /*** Procedure type declarations ***/ WindowIconifyProc :: glfw.WindowIconifyProc WindowRefreshProc :: glfw.WindowRefreshProc @@ -34,3 +36,7 @@ CursorEnterProc :: glfw.CursorEnterProc JoystickProc :: glfw.JoystickProc ErrorProc :: glfw.ErrorProc + +AllocateProc :: glfw.AllocateProc +ReallocateProc :: glfw.ReallocateProc +DeallocateProc :: glfw.DeallocateProc diff --git a/vendor/glfw/wrapper.odin b/vendor/glfw/wrapper.odin index 6ef46c183..fa9329aa7 100644 --- a/vendor/glfw/wrapper.odin +++ b/vendor/glfw/wrapper.odin @@ -8,6 +8,10 @@ Terminate :: glfw.Terminate InitHint :: glfw.InitHint +InitAllocator :: glfw.InitAllocator + +InitVulkanLoader :: glfw.InitVulkanLoader + GetVersion :: proc "c" () -> (major, minor, rev: c.int) { glfw.GetVersion(&major, &minor, &rev) return @@ -121,6 +125,7 @@ GetKeyName :: proc "c" (key, scancode: c.int) -> string { return string(glfw.GetKeyName(key, scancode)) } SetWindowShouldClose :: glfw.SetWindowShouldClose +GetWindowTitle :: glfw.GetWindowTitle JoystickPresent :: glfw.JoystickPresent GetJoystickName :: proc "c" (joy: c.int) -> string { return string(glfw.GetJoystickName(joy)) @@ -237,6 +242,8 @@ SetJoystickCallback :: glfw.SetJoystickCallback SetErrorCallback :: glfw.SetErrorCallback +GetPlatform :: glfw.GetPlatform +PlatformSupported :: glfw.PlatformSupported // Used by vendor:OpenGL gl_set_proc_address :: proc(p: rawptr, name: cstring) { |