user7927120
user7927120

Reputation:

SDL_CreateWindow fails when SDL_WINDOW_VULKAN flag set

when I try to run this code

if(SDL_Init(SDL_INIT_VIDEO) < 0)
    printf("%s\n", SDL_GetError());
if(!SDL_CreateWindow("test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_VULKAN))
    printf("%s\n", SDL_GetError());

after installing working gpu drivers and having linked vulkan, I get this output:

Vulkan support is either not configured in SDL or not available in video driver

I'm running on ubuntu with a Geforce GTX 660M + official drivers and SDL2 version 2.0.8. Seems like a bug in SDL, but I wanted to ask to make sure.

Upvotes: 3

Views: 3235

Answers (1)

aram
aram

Reputation: 1444

Linking with the vulkan lib doesn't mean that SDL is actually using the vulkan functions. You can link anything with a library that you don't use and it wont trigger any warning or problems.

Try compiling

int main() { return 0; }

And add all the link flags you want.

The error is telling you the SDL binaries you have arent compiled with vulkan support enabled. You'll need to compile SDL by hand. Vulkan is probably macroe'd away if no compile flag is set.

By the way I went to the rules of libsdl2 in ubuntu packages (I'm guessign you have ubunt 18.04 >) and in fact vulkan is disabled

# the SDL module for Vulkan not compiling even in Linux at the moment
confflags += --disable-video-vulkan

Upvotes: 2

Related Questions