basic rendering for both opengl and vulkan

This commit is contained in:
Lorenzo Torres 2026-01-07 02:43:00 +01:00
parent 4b18afa040
commit dadd2edaf1
29 changed files with 1140 additions and 38 deletions

View file

@ -4,12 +4,24 @@
#include <vulkan/vulkan.h>
#include "../../core/types.h"
#define RGFW_VULKAN
#define RGFW_IMPORT
#include "../../rgfw.h"
struct queue_family_indices {
u32 graphics, present;
};
struct swapchain_info {
VkSwapchainKHR handle;
VkFormat format;
VkExtent2D extent;
u32 image_count;
VkImage *images;
VkImageView *image_views;
VkFramebuffer *framebuffers;
};
struct renderer_context {
VkInstance instance;
VkPhysicalDevice physical_device;
@ -18,6 +30,24 @@ struct renderer_context {
VkSurfaceKHR surface;
struct queue_family_indices queue_indices;
RGFW_window *window;
struct swapchain_info swapchain;
VkRenderPass render_pass;
VkPipelineLayout pipeline_layout;
VkPipeline pipeline;
VkCommandPool command_pool;
VkCommandBuffer *command_buffers;
VkSemaphore *image_available;
VkSemaphore *render_finished;
VkFence *in_flight;
u32 current_frame;
VkBuffer vertex_buffer;
VkDeviceMemory vertex_buffer_memory;
VkBuffer index_buffer;
VkDeviceMemory index_buffer_memory;
};
#endif