You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4 KiB

#pragma once
#include <GLFW/glfw3.h>
#include <iostream>
#include <vector>
#include <cstring>
#include <optional>
#include <set>
#include <fstream>
#include <numeric>
#include <chrono>
#include <array>
#include <memory>
#include <vulkan/vulkan_core.h>
class Instance;
class Swapchain;
class Pipeline;
class Buffer;
class CommandPool;
2 weeks ago
class Image;
2 weeks ago
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<std::chrono::system_clock> start;
};
class Application {
public:
explicit Application();
void mainLoop();
~Application();
private:
Swapchain* swapchain = nullptr;
2 weeks ago
Pipeline* graphicsPipeline = nullptr;
2 weeks ago
Buffer* vertexBuffer = nullptr;
2 weeks ago
Buffer* indexBuffer = nullptr;
Buffer* uniformBuffer = nullptr;
2 weeks ago
ComputePipeline* computePipeline = nullptr;
void updateUniformBuffer();
void recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex);
2 weeks ago
void recordComputeCommandBuffer();
VkSemaphore imageAvailableSemaphore = VK_NULL_HANDLE;
VkSemaphore renderFinishedSemaphore = VK_NULL_HANDLE;
2 weeks ago
VkSemaphore computeFinishedSemaphore = VK_NULL_HANDLE;
VkFence renderInFlightFence = VK_NULL_HANDLE;
VkFence computeInFlightFence = VK_NULL_HANDLE;
void drawFrame();
2 weeks ago
void update();
void createSyncObjects();
};