From abaacfe78d4bf78eef9960add82dd4893398f3ff Mon Sep 17 00:00:00 2001 From: hikari Date: Tue, 6 Dec 2022 01:53:19 +0200 Subject: sys/windows: fix wgl function loading in accordance with OpenGL wiki --- core/sys/windows/wgl.odin | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/sys/windows/wgl.odin b/core/sys/windows/wgl.odin index e91463a3c..56f61ed32 100644 --- a/core/sys/windows/wgl.odin +++ b/core/sys/windows/wgl.odin @@ -87,6 +87,12 @@ foreign Opengl32 { } // Used by vendor:OpenGL +// https://www.khronos.org/opengl/wiki/Load_OpenGL_Functions#Windows gl_set_proc_address :: proc(p: rawptr, name: cstring) { - (^rawptr)(p)^ = wglGetProcAddress(name) + func := wglGetProcAddress(name) + if uintptr(func) == 0 || uintptr(func) == 1 || uintptr(func) == 2 || uintptr(func) == 3 || uintptr(func) == ~uintptr(0) { + module := LoadLibraryW(L("opengl32.dll")) + func = GetProcAddress(module, name) + } + (^rawptr)(p)^ = func } -- cgit v1.2.3 From 89eb351d2b86a6c3473c06e5e4987e224699511f Mon Sep 17 00:00:00 2001 From: hikari Date: Tue, 6 Dec 2022 02:01:35 +0200 Subject: sys/windows: wgl style fix --- core/sys/windows/wgl.odin | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/sys/windows/wgl.odin b/core/sys/windows/wgl.odin index 56f61ed32..77cff2fa9 100644 --- a/core/sys/windows/wgl.odin +++ b/core/sys/windows/wgl.odin @@ -90,7 +90,8 @@ foreign Opengl32 { // https://www.khronos.org/opengl/wiki/Load_OpenGL_Functions#Windows gl_set_proc_address :: proc(p: rawptr, name: cstring) { func := wglGetProcAddress(name) - if uintptr(func) == 0 || uintptr(func) == 1 || uintptr(func) == 2 || uintptr(func) == 3 || uintptr(func) == ~uintptr(0) { + switch uintptr(func) { + case 0, 1, 2, 3, ~uintptr(0): module := LoadLibraryW(L("opengl32.dll")) func = GetProcAddress(module, name) } -- cgit v1.2.3 From 605d66845a7068d64e7137288fd7b6c83d4db276 Mon Sep 17 00:00:00 2001 From: Dragos Popescu Date: Tue, 6 Dec 2022 02:58:33 +0100 Subject: core:sys/windows: Added CSIDL_PROFILE --- core/sys/windows/types.odin | 1 + 1 file changed, 1 insertion(+) diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin index 430fbb329..9a2a21070 100644 --- a/core/sys/windows/types.odin +++ b/core/sys/windows/types.odin @@ -1261,6 +1261,7 @@ SWP_ASYNCWINDOWPOS :: 0x4000 // same as SWP_CREATESPB CSIDL_APPDATA :: 0x001a // \Application Data CSIDL_COMMON_APPDATA :: 0x0023 // All Users\Application Data +CSIDL_PROFILE :: 0x0028 // \ HWND_TOP :: HWND( uintptr(0)) // 0 HWND_BOTTOM :: HWND( uintptr(1)) // 1 -- cgit v1.2.3