topaz/rendering/vk/vk.h

53 lines
1.1 KiB
C

/* SPDX-License-Identifier:BSD-3-Clause */
#ifndef VK_H
#define VK_H
#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;
VkDevice device;
VkQueue graphics_queue, present_queue;
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