Fixed macOS build

main
noah metz 2024-01-07 03:13:49 -07:00
parent 675480af21
commit b97b377397
1 changed files with 11 additions and 11 deletions

@ -44,21 +44,19 @@ VkInstance create_instance() {
glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount); glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
uint32_t extensionCount = 0; const char** requested_extensions = malloc(sizeof(char*)*(glfwExtensionCount+1));
vkEnumerateInstanceExtensionProperties(0, &extensionCount, 0); for (uint32_t i = 0; i < glfwExtensionCount; i++) {
requested_extensions[i] = glfwExtensions[i];
VkExtensionProperties* extensions = (VkExtensionProperties*)(malloc(sizeof(VkExtensionProperties)*extensionCount));
vkEnumerateInstanceExtensionProperties(0, &extensionCount, extensions);
for(uint32_t i = 0; i < extensionCount; i++) {
fprintf(stderr, "Supported Extension: %s\n", extensions[i].extensionName);
} }
free(extensions); requested_extensions[glfwExtensionCount] = VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME;
instance_info.enabledExtensionCount = glfwExtensionCount + 1;
instance_info.ppEnabledExtensionNames = requested_extensions;
instance_info.enabledExtensionCount = glfwExtensionCount;
instance_info.ppEnabledExtensionNames = glfwExtensions;
instance_info.enabledLayerCount = 0; instance_info.enabledLayerCount = 0;
instance_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
VkResult result = vkCreateInstance(&instance_info, 0, &instance); VkResult result = vkCreateInstance(&instance_info, 0, &instance);
if(result != VK_SUCCESS) { if(result != VK_SUCCESS) {
@ -66,6 +64,8 @@ VkInstance create_instance() {
return 0; return 0;
} }
free(requested_extensions);
return instance; return instance;
} }