diff options
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/src/render.c b/src/render.c index 4893d64..2558bd4 100644 --- a/src/render.c +++ b/src/render.c @@ -13,9 +13,9 @@ #include <vulkan/vulkan.h> -#define VMA_STATIC_VULKAN_FUNCTIONS 0 -#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 -#include "vk_mem_alloc.h" +/* #define VMA_STATIC_VULKAN_FUNCTIONS 0 */ +/* #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 */ +/* #include "vk_mem_alloc.h" */ #define STB_IMAGE_IMPLEMENTATION #include <stb_image.h> @@ -1626,7 +1626,6 @@ draw_frame() float dt = time - prev_time; - vkWaitForFences(s.vk.device, 1, &s.frames[currentFrame].in_flight_fence, VK_TRUE, UINT64_MAX); uint32_t imageIndex; @@ -1696,47 +1695,44 @@ main(int argc, char* argv[]) init_state(&s); if (!init()) { vk_log(VK_INFO, "Failed to initialize!\n"); + abort(); } - else { - init_vulkan(); - bool quit = false; + init_vulkan(); + bool quit = false; - /* VMA POC */ - VmaVulkanFunctions vulkanFunctions = {0}; - vulkanFunctions.vkGetInstanceProcAddr = &vkGetInstanceProcAddr; - vulkanFunctions.vkGetDeviceProcAddr = &vkGetDeviceProcAddr; - VmaAllocatorCreateInfo allocatorCreateInfo = {0}; - allocatorCreateInfo.flags = VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT; - allocatorCreateInfo.vulkanApiVersion = VK_API_VERSION_1_2; - allocatorCreateInfo.physicalDevice = s.vk.physical_device; - allocatorCreateInfo.device = s.vk.device; - allocatorCreateInfo.instance = s.vk.instance; - allocatorCreateInfo.pVulkanFunctions = &vulkanFunctions; + /* VMA POC */ + VmaVulkanFunctions vulkanFunctions = {0}; + vulkanFunctions.vkGetInstanceProcAddr = &vkGetInstanceProcAddr; + vulkanFunctions.vkGetDeviceProcAddr = &vkGetDeviceProcAddr; - VmaAllocator allocator; - vmaCreateAllocator(&allocatorCreateInfo, &allocator); + VmaAllocatorCreateInfo allocatorCreateInfo = {0}; + allocatorCreateInfo.flags = VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT; + allocatorCreateInfo.vulkanApiVersion = VK_API_VERSION_1_2; + allocatorCreateInfo.physicalDevice = s.vk.physical_device; + allocatorCreateInfo.device = s.vk.device; + allocatorCreateInfo.instance = s.vk.instance; + allocatorCreateInfo.pVulkanFunctions = &vulkanFunctions; - // Entire program... + vmaCreateAllocator(&allocatorCreateInfo, &s.vk.allocator); - // At the end, don't forget to: - vmaDestroyAllocator(allocator); + // At the end, don't forget to: - // Game loop - update_camera(0, 0); - while (!quit) { - handle_input(&quit); - imgui_new_frame(s.vk); - draw_frame(); - //SDL_Delay(16); - } + update_camera(0, 0); - close_vulkan(); + // Game loop + while (!quit) { + handle_input(&quit); + imgui_new_frame(s.vk); + draw_frame(); + //SDL_Delay(16); } - // Free resources and close SDL + vmaDestroyAllocator(s.vk.allocator); + + close_vulkan(); closeSDL(); return 0; |