veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.23k stars 225 forks source link

Static libraries compiled without Vulkan support #395

Open jclc opened 5 years ago

jclc commented 5 years ago

When using the static libraries, trying to load Vulkan results in the error: Vulkan support is either not configured in SDL or not available in current SDL video driver (x11) or platform. The same function doesn't fail when using libs installed on the system. Tested on both amd64/linux and amd64/windows.

The static libraries should be compiled with Vulkan support enabled.

gen2brain commented 5 years ago

As I remember compiling with Vulkan support will add additional dependencies, and I wanted to avoid that. How often is that needed, and where? I don't have experience at all with Vulkan.

Probably will not happen before SDL releases a new version, building all static libraries is time-consuming, and I don't have an automated way to do the build currently. Adding new build flag for all platforms (what platforms Vulkan support?) is not that simple, e.g. even adding libmpg123 for mp3 support was not simple to add.

jclc commented 5 years ago

It shouldn't require anything extra, the headers are included in the source. The only Vulkan types SDL2 even cares about are the instance and surface pointers. Just enable the option in the makefile and it should work. You don't need to worry about the platform support either, SDL2 should know which platforms support it and just disable support on unsupported platforms. On Darwin, it enables support for MoltenVK.

If rebuilding the libraries is too much hassle, I don't have any issue waiting for the next release. I can still use the devel libraries on my system.

Edit: I should clarify that just like OpenGL, Vulkan functions are loaded externally on runtime, so no extra libraries are needed.

jclc commented 5 years ago

Here's a demo you can try it out on https://github.com/vulkan-go/demos/tree/master/vulkancube/vulkancube_sdl2

gen2brain commented 4 years ago

Static libraries are updated, now with Vulkan support. I tried your demo and it works.