Created
September 3, 2017 18:47
-
-
Save icculus/ad23f873393423e1f1069502b92ad035 to your computer and use it in GitHub Desktop.
SDL vulkan explanation...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ok, I answered too quickly, and Twitter is terrible for this, so have a gist. | |
You call this function twice: the first time with a NULL and it just sets | |
extension_count to the number of strings it plans to give you, so you can | |
allocate space for them and call the function again. | |
*/ | |
// (you should check return values for errors in all this, but whatever.) | |
unsigned int count = 0; | |
const char **names = NULL; | |
SDL_Vulkan_GetInstanceExtensions(window, &count, NULL); | |
// now count is (probably) 2. Now you can make space: | |
names = new const char *[count]; | |
// now call again with that not-NULL array you just allocated. | |
SDL_Vulkan_GetInstanceExtensions(window, &count, names); | |
// Now names should have (count) strings in it: | |
for (unsigned int i = 0; i < count; i++) { | |
printf("Extension %d: %s\n", i, names[i]); | |
} | |
// use it for VkInstanceCreateInfo and when you're done, free it: | |
delete[] names; | |
// Ship your successful C++ game and retire a millionaire. THE END. --ryan. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, it still returns as 0 here 😕