diff options
| author | Andre Weissflog <floooh@gmail.com> | 2026-01-19 14:34:52 +0100 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2026-01-19 14:34:52 +0100 |
| commit | a84dd54fb403d5fdbc395af6318a6a9425af0414 (patch) | |
| tree | 9d11e1cbb06547d5e8be19cb7bf9031a06c86f4e /sokol_app.h | |
| parent | 486d19da7c0e4fd20274ac5ec4e2f0fee358830c (diff) | |
sokol_gfx.h vk: windows support
Diffstat (limited to 'sokol_app.h')
| -rw-r--r-- | sokol_app.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sokol_app.h b/sokol_app.h index 99f25d11..c1411f15 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -2307,8 +2307,12 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); } #elif defined(_WIN32) // Windows (D3D11 or GL) #define _SAPP_WIN32 (1) - #if !defined(SOKOL_D3D11) && !defined(SOKOL_GLCORE) && !defined(SOKOL_WGPU) && !defined(SOKOL_NOAPI) - #error("sokol_app.h: unknown 3D API selected for Win32, must be SOKOL_D3D11, SOKOL_GLCORE, SOKOL_WGPU or SOKOL_NOAPI") + #if !defined(SOKOL_D3D11) && !defined(SOKOL_GLCORE) && !defined(SOKOL_WGPU) && !defined(SOKOL_VULKAN) && !defined(SOKOL_NOAPI) + #error("sokol_app.h: unknown 3D API selected for Win32, must be SOKOL_D3D11, SOKOL_GLCORE, SOKOL_WGPU, SOKOL_VULKAN or SOKOL_NOAPI") + #endif + #if defined(SOKOL_VULKAN) + #define VK_USE_PLATFORM_WIN32_KHR + #include <vulkan/vulkan.h> #endif #elif defined(__ANDROID__) // Android @@ -4517,6 +4521,12 @@ _SOKOL_PRIVATE void _sapp_vk_create_surface(void) { xlib_info.dpy = _sapp.x11.display; xlib_info.window = _sapp.x11.window; res = vkCreateXlibSurfaceKHR(_sapp.vk.instance, &xlib_info, 0, &_sapp.vk.surface); + #elif defined(_SAPP_WIN32) + _SAPP_STRUCT(VkWin32SurfaceCreateInfoKHR, win32_info); + win32_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; + win32_info.hinstance = GetModuleHandleW(NULL); + win32_info.hwnd = _sapp.win32.hwnd; + res = vkCreateWin32SurfaceKHR(_sapp.vk.instance, &win32_info, 0, &_sapp.vk.surface); #else #error "sokol_app.h: unsupported Vulkan platform" #endif |