I've been writing a wrapper library for Vulkan targeting MacOS. It was going fine until I hit this obstacle. There's a call to SDL_Vulkan_CreateSurface
which is supposed to return a pointer to a surface VkSurfaceKHR
. However, the returned pointer is not a memory address, but rather the number 1
. At first I thought this could be a bug with SDL, but then I noticed another call to another Vulkan API is returning 2
. I am out of options now and I'm hoping it's something I can fix on my end. This is the output
1== CREATE VULKAN INSTANCE
Enabling extensions:
VK_KHR_surface
VK_MVK_macos_surface
===
2== CREATE PHYSICAL DEVICE
Created GPU (Physical device): 0x00007fe23b81e380
3== CREATE SURFACE (Metal->MoltenVK)
Created Surface: 0x0000000000000001
4== CREATE DEVICE
Chosen queue Family is 0
Created Device: 0x00007fe23c017a10
5== CREATE COMMAND POOL
Created Command Pool: 0x0000000000000002
6== CREATE COMMAND BUFFER
Created Command Buffer: 0x00007fe23a4d2bd0
7== CREATE SWAPCHAIN
Segmentation fault: 11
The responsible function is this:
func createVulkanSurface() throws -> Surface {
var surface = VkSurfaceKHR(bitPattern: 0)
if SDL_Vulkan_CreateSurface(window, self.instance!.pointer, &surface) != SDL_TRUE {
throw lastSDLError()
}
return Surface(instance: self.instance!, surface: surface!)
}
The code is here: GitHub - alexanderuv/vulkanSwift: Vulkan sample using Swift+SDL2, built using SwiftPM (WIP)
Specific code above is here: vulkanSwift/Window.swift at master · alexanderuv/vulkanSwift · GitHub
Any help will be appreciated!