Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use vkCreateWin32SurfaceKHR to create vulkan surface

I want to use vulkan with SDL2 but I am stuck at the surface creation stage, i cannot use vkCreateWin32SurfaceKHR extension function as well as VkWin32SurfaceCreateInfoKHR extension struct as they are undefined, while i don't have any issues using other extension elements like (vkGetPhysicalDeviceSurfaceSupportKHR , etc ..), does the surface extension needs a separate header file? how can i get it to work?

the preprocessor directives i use are as follows

#include <vulkan\vulkan.h>
#include <SDL.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <exception>
#define VK_USE_PLATFORM_WIN32_KHR

Please note that i have used Vulkan with glfw without having any program this is my second attempt of running vulkan, so i don't think i have any driver support issue.

like image 399
BulBul Avatar asked Mar 10 '23 13:03

BulBul


1 Answers

Put the #define VK_USE_PLATFORM_WIN32_KHR before you #include <vulkan\vulkan.h>

then you can grab the native info you need from SDL_GetWindowWMInfo.

like image 185
ratchet freak Avatar answered Mar 31 '23 11:03

ratchet freak