vulkan-go / demos

Vulkan API crossplatform demos in Go

Home Page:https://vulkanGo.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux Support

4ydx opened this issue · comments

commented

What would it take to look at supporting linux? I would like to slowly contribute something but I am a bit unsure about where to start.

Assume nvidia hardware on a machine that already runs steam.

Hi! In the main repo I got a bridge https://github.com/vulkan-go/vulkan/blob/master/vulkan_wrapper.c
That obtains pointers this way:

void* libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);

This should work fine in linux, so no changes here.

Next, in the manifest for automatic generation https://github.com/vulkan-go/vulkan/blob/master/vulkan.yml I enabled android KHR only, VK_USE_PLATFORM_ANDROID_KHR. the list of other platforms and their requirements is there: https://github.com/vulkan-go/vulkan/blob/master/vulkan/vk_platform.h I'm not sure what is your platform specifically in Linux, there are plenty of them.

So, given that you have Wayland, simply throw in wayland headers and re-generate the code of vulkan bindings. vk.WaylandSurfaceCreateInfo should appear accepting 2 handles of wayland display and surface. And finally write your own version of NewVulkanDeviceAndroid as seen here https://github.com/vulkan-go/demos/blob/master/vulkandraw/vulkan.go#L260 to call vk.WaylandSurfaceCreateInfo and discover supported layers and extensions.

@4ydx

I implemented support for Windows and OS X,
stay tuned — one day Linux support comes too.

GLFW is the best way to handle desktop OSes though.