adding swapchain support

This commit is contained in:
2023-03-02 16:21:50 +01:00
parent e299d56058
commit 23a123437b
2 changed files with 118 additions and 10 deletions

View File

@@ -15,16 +15,24 @@ int main(void)
SDL_Vulkan_GetInstanceExtensions(win, &ext_count, exts + 1);
VkInstance instance = kvfCreateInstance(exts, ext_count + 1);
VkSurfaceKHR surface = VK_NULL_HANDLE;
SDL_Vulkan_CreateSurface(win, instance, &surface);
VkPhysicalDevice ph_device = kvfPickGoodDefaultPhysicalDevice(instance, surface);
VkDevice device = kvfCreateDefaultDevice(ph_device);
VkQueue graphics_queue = kvfGetDeviceQueue(device, KVF_GRAPHICS_QUEUE);
VkQueue present_queue = kvfGetDeviceQueue(device, KVF_PRESENT_QUEUE);
VkSwapchainKHR swapchain = kvfCreateSwapchain(device, ph_device, surface);
int width, height;
SDL_Vulkan_GetDrawableSize(win, &width, &height);
VkExtent2D actualExtent = { width, height };
VkSwapchainKHR swapchain = kvfCreateSwapchainKHR(device, ph_device, surface, extend, true);
SDL_Delay(2000);
kvfDestroySwapchainKHR(device, swapchain);
vkDestroySurfaceKHR(instance, surface, NULL);
kvfDestroyDevice(device);
kvfDestroyInstance(instance);