Closed CannibalVox closed 2 years ago
Some code:
instanceHandle := (C.VkInstance)(unsafe.Pointer(app.instance.Handle()))
proc := (C.PFN_vkCreateWin32SurfaceKHR)(C.vkGetInstanceProcAddr(instanceHandle, (*C.char)(C.CString("vkCreateWin32SurfaceKHR"))))
if proc == nil {
panic("NULL")
}
fmt.Printf("%x\n",uintptr(unsafe.Pointer(proc)))
surface, err := app.window.VulkanCreateSurface(instanceHandle)
if err != nil {
return err
}
Output:
7ffb06db7460
2021/08/24 22:26:08 VK_KHR_win32_surface extension is not enabled in the Vulkan instance.
Hi @CannibalVox, have you taken a look at this thread? I wonder if it is the same issue. https://discourse.libsdl.org/t/sdl-vulkan-createsurface-vk-khr-win32-surface-extension-not-enabled/24934
I'm not familiar with Vulkan so if that doesn't solve the issue, perhaps you could share a minimal example using your existing code? I will look into it!
@CannibalVox there are examples in vulkan-go, e.g. https://github.com/vulkan-go/demos/blob/master/vulkancube/vulkancube_sdl2/main.go
Hi @CannibalVox, have you taken a look at this thread? I wonder if it is the same issue. https://discourse.libsdl.org/t/sdl-vulkan-createsurface-vk-khr-win32-surface-extension-not-enabled/24934
I'm not familiar with Vulkan so if that doesn't solve the issue, perhaps you could share a minimal example using your existing code? I will look into it!
This was broadly the issue- SDL I guess likes to load its own copy of the vulkan DLL in order to make everything work, which means that instances loaded from another copy (i.e. the copy loaded by my vulkan library itself) won't work with SDL. In order to facilitate this it exposes a function pointer via VulkanGetVkGetInstanceProcAddr (and vulkan-go apparently builds its API functions from that here, rather than using the ones from the header file: https://github.com/vulkan-go/demos/blob/master/vulkancube/vulkancube_sdl2/main.go#L92).
Thank you for the help!
I'm attempting to use a vulkan surface in an application, and I am receiving the error
VK_KHR_win32_surface extension is not enabled in the Vulkan instance.
- in fact that extension is enabled in the instance. And that error is raised whenvkGetInstanceProcAddr(instance, "vkCreateWin32SurfaceKHR")
returns NULL (https://github.com/emscripten-ports/SDL2/blob/edfa5806ffc8a8fc05327ac709124a479514cab7/src/video/windows/SDL_windowsvulkan.c#L154) but if I call vkGetInstanceProcAddr myself it works just fine.It seems like I must be doing something wrong but I can't imagine what, is there an example I can refer to?