Now have a blue screen.
This commit is contained in:
parent
7298568818
commit
8a7ef61c78
11 changed files with 527 additions and 55 deletions
70
vk_engine.h
70
vk_engine.h
|
|
@ -5,25 +5,71 @@
|
|||
|
||||
#include <vk_types.h>
|
||||
|
||||
struct FrameData {
|
||||
VkCommandPool _commandPool;
|
||||
VkCommandBuffer _mainCommandBuffer;
|
||||
VkSemaphore _swapchainSemaphore;
|
||||
VkSemaphore _renderSemaphore;
|
||||
VkFence _renderFence;
|
||||
};
|
||||
|
||||
constexpr unsigned int FRAME_OVERLAP=2;
|
||||
|
||||
class VulkanEngine {
|
||||
public:
|
||||
// device selection
|
||||
VkInstance _instance;
|
||||
VkDebugUtilsMessengerEXT _debug_messenger;
|
||||
VkPhysicalDevice _chosenGPU;
|
||||
VkDevice _device;
|
||||
VkSurfaceKHR _surface;
|
||||
|
||||
bool _isInitialized{ false };
|
||||
int _frameNumber {0};
|
||||
// swapchain
|
||||
VkSwapchainKHR _swapchain;
|
||||
VkFormat _swapchainImageFormat;
|
||||
|
||||
VkExtent2D _windowExtent{ 1700 , 900 };
|
||||
std::vector<VkImage> _swapchainImages;
|
||||
std::vector<VkImageView> _swapchainImageViews;
|
||||
VkExtent2D _swapchainExtent;
|
||||
|
||||
struct SDL_Window* _window{ nullptr };
|
||||
// frames/command buffer
|
||||
int _frameNumber {0};
|
||||
FrameData _frames[FRAME_OVERLAP];
|
||||
|
||||
//initializes everything in the engine
|
||||
void init();
|
||||
FrameData& get_current_frame() {
|
||||
return _frames[_frameNumber % FRAME_OVERLAP];
|
||||
}
|
||||
|
||||
//shuts down the engine
|
||||
void cleanup();
|
||||
VkQueue _graphicsQueue;
|
||||
uint32_t _graphicsQueueFamily;
|
||||
|
||||
//draw loop
|
||||
void draw();
|
||||
// internal data
|
||||
bool _isInitialized{ false };
|
||||
|
||||
//run main loop
|
||||
void run();
|
||||
VkExtent2D _windowExtent{ 1700 , 900 };
|
||||
|
||||
struct SDL_Window* _window{ nullptr };
|
||||
|
||||
static VulkanEngine& Get();
|
||||
|
||||
//initializes everything in the engine
|
||||
void init();
|
||||
|
||||
//shuts down the engine
|
||||
void cleanup();
|
||||
|
||||
//draw loop
|
||||
void draw();
|
||||
|
||||
//run main loop
|
||||
void run();
|
||||
|
||||
private:
|
||||
void init_vulkan();
|
||||
void init_swapchain();
|
||||
void init_commands();
|
||||
void init_sync_structures();
|
||||
|
||||
void create_swapchain(uint32_t width, uint32_t height);
|
||||
void destroy_swapchain();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue