// // Created by rick on 08-05-20. // #ifndef VULKANTEST_HELLOTRIANGLEAPPLICATION_H #define VULKANTEST_HELLOTRIANGLEAPPLICATION_H #include "MyVkInstance.h" #include #define GLFW_INCLUDE_VULKAN #include const int MAX_FRAMES_IN_FLIGHT = 2; class HelloTriangleApplication { public: void run(); bool frameBufferResized = false; private: MyVkInstance *myVkInstance; VkSwapchainKHR swapChain; std::vector swapChainImages; std::vector swapChainImageViews; VkFormat swapChainImageFormat; VkExtent2D swapChainExtent; VkRenderPass renderPass; VkPipelineLayout pipelineLayout; VkPipeline graphicsPipeline; std::vector swapChainFrameBuffers; VkCommandPool commandPool; std::vector commandBuffers; std::vector imageAvailableSemaphores; std::vector renderFinishedSemaphores; std::vector inFlightFences; std::vector imagesInFlight; int currentFrame = 0; // Vulkan initialisation void createSwapChain(); void createImageViews(); void createRenderPass(); void createGraphicsPipeline(); void createFrameBuffers(); void createCommandPool(); void createCommandBuffers(); void createSyncObjects(); void initVulkan(); void recreateSwapChain(); void cleanupSwapChain(); // main loop void mainLoop(); void drawFrame(); // clean up void cleanup(); // utility functions VkShaderModule createShaderModule(const std::vector &code); static void frameBufferResizeCallback(void *thisptr, int width, int height); }; #endif //VULKANTEST_HELLOTRIANGLEAPPLICATION_H