comparison src/vulkan.nim @ 10:0660ba9d1930

did: make it work on windows
author sam <sam@basx.dev>
date Sat, 24 Dec 2022 22:32:46 +0700
parents 4ed9cb098315
children 90e117952f74
comparison
equal deleted inserted replaced
8:1134f41a49e9 10:0660ba9d1930
28 28
29 let vkHandleDLL = loadLib(vkDLL) 29 let vkHandleDLL = loadLib(vkDLL)
30 if isNil(vkHandleDLL): 30 if isNil(vkHandleDLL):
31 quit("could not load: " & vkDLL) 31 quit("could not load: " & vkDLL)
32 32
33 let vkGetProcAddress = cast[proc(s: cstring): pointer {.stdcall.}](symAddr(vkHandleDLL, "vkGetInstanceProcAddr"))
34 if vkGetProcAddress == nil:
35 quit("failed to load `vkGetInstanceProcAddr` from " & vkDLL)
36
37 vkGetProc = proc(procName: cstring): pointer {.cdecl.} = 33 vkGetProc = proc(procName: cstring): pointer {.cdecl.} =
38 when defined(windows):
39 result = vkGetProcAddress(procName)
40 if result != nil:
41 return
42 result = symAddr(vkHandleDLL, procName) 34 result = symAddr(vkHandleDLL, procName)
43 if result == nil: 35 if result == nil:
44 raiseInvalidLibrary(procName) 36 raiseInvalidLibrary(procName)
45 37
46 proc setVKGetProc*(getProc: proc(procName: cstring): pointer {.cdecl.}) = 38 proc setVKGetProc*(getProc: proc(procName: cstring): pointer {.cdecl.}) =