Created
February 28, 2016 12:15
-
-
Save cheery/eaadc94051ad05379d1c to your computer and use it in GitHub Desktop.
Here's how to create instance quickly in Vulkan
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <vulkan/vulkan.h> | |
static void check_impl(VkResult result, long line); | |
#define CHECK(x) (check_impl((x), __LINE__)); | |
int main() { | |
VkInstance instance; | |
const char* instanceExtensions[] = { "VK_KHR_surface" }; | |
VkInstanceCreateInfo instanceCreateInfo = { | |
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, | |
.enabledExtensionCount = 1, | |
.ppEnabledExtensionNames = instanceExtensions, | |
}; | |
CHECK(vkCreateInstance(&instanceCreateInfo, NULL, &instance)); | |
printf("Instance obtained\n"); | |
return 0; | |
} | |
static void check_impl(VkResult result, long line) { | |
if (result != 0) { | |
printf("line %ld: VkResult %d\n", line, result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you need to have Vulkan statically linked to do this?