#pragma once #include #include #include #include #include #include #include #include #include #include #include #include class Instance; class Swapchain; class Pipeline; class Buffer; class CommandPool; class Image; class ComputePipeline; class Timer { public: explicit Timer(){ start = std::chrono::system_clock::now(); } ~Timer(){ size_t nanoseconds = (std::chrono::system_clock::now() - start).count(); printf("Timer: %zu mus\n", nanoseconds / 1000); } private: std::chrono::time_point start; }; class Application { public: explicit Application(); void mainLoop(); ~Application(); private: Swapchain* swapchain = nullptr; Pipeline* graphicsPipeline = nullptr; Buffer* vertexBuffer = nullptr; Buffer* indexBuffer = nullptr; Buffer* uniformBuffer = nullptr; ComputePipeline* computePipeline = nullptr; void updateUniformBuffer(); void recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex); void recordComputeCommandBuffer(); VkSemaphore imageAvailableSemaphore = VK_NULL_HANDLE; VkSemaphore renderFinishedSemaphore = VK_NULL_HANDLE; VkSemaphore computeFinishedSemaphore = VK_NULL_HANDLE; VkFence renderInFlightFence = VK_NULL_HANDLE; VkFence computeInFlightFence = VK_NULL_HANDLE; void drawFrame(); void update(); void createSyncObjects(); };