aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-02-02 10:05:41 +0000
committerGitHub <noreply@github.com>2026-02-02 10:05:41 +0000
commit4d938862a21d12a2a203175e06c84c4c17b0e7f7 (patch)
tree2f25ab180aac3fd393d5c853e777f436ff550bcb
parentf7901cffc9f4983259586241d5b336cdb6377b9c (diff)
parent54caa6af008d2f8513bd7fca3aa0a8a5973070b4 (diff)
Merge pull request #5816 from jakubtomsu/win32-rawinput-and-barriers
[core:sys/windows] Sync Barriers, macros for buffered rawinput
-rw-r--r--core/sys/windows/kernel32.odin10
-rw-r--r--core/sys/windows/types.odin15
-rw-r--r--core/sys/windows/user32.odin8
3 files changed, 33 insertions, 0 deletions
diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin
index 0309ff16f..f66698dd8 100644
--- a/core/sys/windows/kernel32.odin
+++ b/core/sys/windows/kernel32.odin
@@ -225,6 +225,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 f9e9764e2..06156c912 100644
--- a/core/sys/windows/types.odin
+++ b/core/sys/windows/types.odin
@@ -3017,6 +3017,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 580c09b45..beee65ee6 100644
--- a/core/sys/windows/user32.odin
+++ b/core/sys/windows/user32.odin
@@ -412,6 +412,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