Moved most everything to vulkan_wrapper

This commit is contained in:
Warwick New 2025-01-26 12:15:19 +00:00
parent 4da333d7f6
commit 5ce5da188a
3 changed files with 1183 additions and 1168 deletions

1169
src/main.c

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1 +1,42 @@
#pragma once
#include <vulkan/vulkan_core.h>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#define MAX_FRAMES_IN_FLIGHT 2
typedef struct {
GLFWwindow *window;
VkInstance instance;
VkDebugUtilsMessengerEXT debugMessenger;
VkSurfaceKHR surface;
VkPhysicalDevice physicalDevice;
VkDevice device;
VkQueue graphicsQueue;
VkQueue presentQueue;
VkSwapchainKHR swapChain;
VkImage *swapChainImages;
uint32_t swapChainImageCount;
VkFormat swapChainImageFormat;
VkExtent2D swapChainExtent;
VkImageView *swapChainImageViews;
uint32_t swapChainImageViewCount;
VkRenderPass renderPass;
VkPipelineLayout pipelineLayout;
VkPipeline graphicsPipeline;
VkFramebuffer *swapChainFramebuffers;
uint32_t swapChainFramebufferCount;
VkCommandPool commandPool;
VkCommandBuffer commandBuffers[MAX_FRAMES_IN_FLIGHT];
VkSemaphore imageAvailableSemaphores[MAX_FRAMES_IN_FLIGHT];
VkSemaphore renderFinishedSemaphore[MAX_FRAMES_IN_FLIGHT];
VkFence inFlightFences[MAX_FRAMES_IN_FLIGHT];
uint32_t currentFrame; // initialised to 0
} Application;
void initWindow(Application *app);
void initVulkan(Application *app);
void mainLoop(Application *app);
void cleanup(Application *app);