From 7d9f915ff985786e6068ef62f98be2d00540262a Mon Sep 17 00:00:00 2001 From: jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> Date: Thu, 16 Oct 2025 15:59:22 +0200 Subject: [PATCH 1/4] barriers, rawinput macros --- core/sys/windows/kernel32.odin | 10 ++++++++++ core/sys/windows/types.odin | 15 +++++++++++++++ core/sys/windows/user32.odin | 8 ++++++++ test.odin | 9 +++++++++ 4 files changed, 42 insertions(+) create mode 100644 test.odin diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin index ff27cf79541..9fb862815e9 100644 --- a/core/sys/windows/kernel32.odin +++ b/core/sys/windows/kernel32.odin @@ -213,6 +213,16 @@ foreign kernel32 { ) -> BOOL --- WaitForSingleObject :: proc(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD --- WaitForSingleObjectEx :: proc(hHandle: HANDLE, dwMilliseconds: DWORD, bAlterable: BOOL) -> DWORD --- + EnterSynchronizationBarrier :: proc( + lpBarrier: ^SYNCHRONIZATION_BARRIER, + dwFlags: SYNCHRONIZATION_BARRIER_FLAGS, + ) -> BOOL --- + InitializeSynchronizationBarrier :: proc( + lpBarrier: ^SYNCHRONIZATION_BARRIER, + lTotalThreads: LONG, + lSpinCount: LONG, + ) -> BOOL --- + DeleteSynchronizationBarrier :: proc(lpBarrier: ^SYNCHRONIZATION_BARRIER) -> BOOL --- Sleep :: proc(dwMilliseconds: DWORD) --- GetProcessId :: proc(handle: HANDLE) -> DWORD --- CopyFileW :: proc( diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin index 904970589c2..a838fa35989 100644 --- a/core/sys/windows/types.odin +++ b/core/sys/windows/types.odin @@ -2991,6 +2991,21 @@ CRITICAL_SECTION :: struct { SpinCount: ULONG_PTR, } +SYNCHRONIZATION_BARRIER :: struct { + Reserved1: DWORD, + Reserved2: DWORD, + Reserved3: [2]ULONG_PTR, + Reserved4: DWORD, + Reserved5: DWORD, +} + +SYNCHRONIZATION_BARRIER_FLAG :: enum { + SPIN_ONLY = 0, + BLOCK_ONLY = 1, + NO_DELETE = 2, +} +SYNCHRONIZATION_BARRIER_FLAGS :: distinct bit_set[SYNCHRONIZATION_BARRIER_FLAG; DWORD] + REPARSE_MOUNTPOINT_DATA_BUFFER :: struct { ReparseTag: DWORD, ReparseDataLength: DWORD, diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin index 49ebb49cbd1..51cbde4ae8a 100644 --- a/core/sys/windows/user32.odin +++ b/core/sys/windows/user32.odin @@ -398,6 +398,14 @@ MAKEINTRESOURCEW :: #force_inline proc "contextless" (#any_int i: int) -> LPWSTR return cast(LPWSTR)uintptr(WORD(i)) } +RAWINPUT_ALIGN :: proc(x: uintptr) -> uintptr { + return (x + size_of(uintptr) - 1) & ~uintptr(size_of(uintptr) - 1) +} + +NEXTRAWINPUTBLOCK :: proc(ptr: ^RAWINPUT) -> ^RAWINPUT { + return cast(^RAWINPUT)RAWINPUT_ALIGN(uintptr(ptr) + uintptr(ptr.header.dwSize)) +} + Monitor_From_Flags :: enum DWORD { MONITOR_DEFAULTTONULL = 0x00000000, // Returns NULL MONITOR_DEFAULTTOPRIMARY = 0x00000001, // Returns a handle to the primary display monitor diff --git a/test.odin b/test.odin new file mode 100644 index 00000000000..e0c1d9371d5 --- /dev/null +++ b/test.odin @@ -0,0 +1,9 @@ +package min_max_test + +import "core:fmt" + +main :: proc() { + a: f32 = max(1) + b: f32 = min(2) + fmt.println(a, b) +} \ No newline at end of file From ada70ca6255562e456064ab71b0f856e5eafd921 Mon Sep 17 00:00:00 2001 From: jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:06:53 +0200 Subject: [PATCH 2/4] remove accidental test file --- test.odin | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 test.odin diff --git a/test.odin b/test.odin deleted file mode 100644 index e0c1d9371d5..00000000000 --- a/test.odin +++ /dev/null @@ -1,9 +0,0 @@ -package min_max_test - -import "core:fmt" - -main :: proc() { - a: f32 = max(1) - b: f32 = min(2) - fmt.println(a, b) -} \ No newline at end of file From f7ea85ccb2b7cb6cf8ec73e737a36397da645c3f Mon Sep 17 00:00:00 2001 From: jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:08:08 +0200 Subject: [PATCH 3/4] forgot to use tabs, as always --- core/sys/windows/types.odin | 16 ++++++++-------- core/sys/windows/user32.odin | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin index a838fa35989..61e5d7820c3 100644 --- a/core/sys/windows/types.odin +++ b/core/sys/windows/types.odin @@ -2992,17 +2992,17 @@ CRITICAL_SECTION :: struct { } SYNCHRONIZATION_BARRIER :: struct { - Reserved1: DWORD, - Reserved2: DWORD, - Reserved3: [2]ULONG_PTR, - Reserved4: DWORD, - Reserved5: DWORD, + Reserved1: DWORD, + Reserved2: DWORD, + Reserved3: [2]ULONG_PTR, + Reserved4: DWORD, + Reserved5: DWORD, } SYNCHRONIZATION_BARRIER_FLAG :: enum { - SPIN_ONLY = 0, - BLOCK_ONLY = 1, - NO_DELETE = 2, + SPIN_ONLY = 0, + BLOCK_ONLY = 1, + NO_DELETE = 2, } SYNCHRONIZATION_BARRIER_FLAGS :: distinct bit_set[SYNCHRONIZATION_BARRIER_FLAG; DWORD] diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin index 51cbde4ae8a..4eb389f6b11 100644 --- a/core/sys/windows/user32.odin +++ b/core/sys/windows/user32.odin @@ -399,11 +399,11 @@ MAKEINTRESOURCEW :: #force_inline proc "contextless" (#any_int i: int) -> LPWSTR } RAWINPUT_ALIGN :: proc(x: uintptr) -> uintptr { - return (x + size_of(uintptr) - 1) & ~uintptr(size_of(uintptr) - 1) + return (x + size_of(uintptr) - 1) & ~uintptr(size_of(uintptr) - 1) } NEXTRAWINPUTBLOCK :: proc(ptr: ^RAWINPUT) -> ^RAWINPUT { - return cast(^RAWINPUT)RAWINPUT_ALIGN(uintptr(ptr) + uintptr(ptr.header.dwSize)) + return cast(^RAWINPUT)RAWINPUT_ALIGN(uintptr(ptr) + uintptr(ptr.header.dwSize)) } Monitor_From_Flags :: enum DWORD { From 54caa6af008d2f8513bd7fca3aa0a8a5973070b4 Mon Sep 17 00:00:00 2001 From: jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> Date: Sat, 18 Oct 2025 16:36:49 +0200 Subject: [PATCH 4/4] empty push to re-run CI