summaryrefslogtreecommitdiff
path: root/src/renderer.h
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-06-30 22:23:08 +0200
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-06-30 22:29:30 +0200
commit87c8428df0bf1b2f6932bb16390f69be57e21f6b (patch)
tree0cc0f7cab79a0373ef366898df8f5773391bae17 /src/renderer.h
libvlkn: inital commit, basic prototype api in placeHEADmain
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src/renderer.h')
-rw-r--r--src/renderer.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/renderer.h b/src/renderer.h
new file mode 100644
index 0000000..fcaa5af
--- /dev/null
+++ b/src/renderer.h
@@ -0,0 +1,97 @@
+#ifndef _RENDERER_H_
+#define _RENDERER_H_
+
+#include <vlkn.h>
+#include <vulkan/vulkan.h>
+#include <vulkan/vulkan_wayland.h>
+
+#include "buffer.h"
+#include "utils.h"
+
+#define MAX_FRAMES 3
+
+struct vlkn_renderer {
+ struct vlkn_window *win;
+ VkInstance instance;
+ VkSurfaceKHR surface;
+
+ struct {
+ uint32_t cap, len;
+ struct phy_gpu {
+ VkPhysicalDevice gpu;
+ size_t graphics_queue;
+ size_t present_queue;
+ struct surface_caps {
+ VkSurfaceCapabilitiesKHR caps;
+ struct {
+ uint32_t len;
+ VkSurfaceFormatKHR *data;
+ } formats;
+ struct {
+ uint32_t len;
+ VkPresentModeKHR *data;
+ } present_modes;
+ } surface_caps;
+ } *gpus;
+ struct phy_gpu *chosen;
+ } phy_gpus;
+
+ struct {
+ VkDevice device;
+ VkQueue gfx_queue;
+ VkQueue present_queue;
+ } gpu;
+
+ struct {
+ VkSwapchainKHR swapchain;
+ VkFormat format;
+ VkExtent2D extent;
+ struct {
+ uint32_t len;
+ struct {
+ VkImage image;
+ VkImageView view;
+ VkFramebuffer framebuffer;
+ } *data;
+ } images;
+ } swapchain;
+
+ struct {
+ VkCommandPool pool;
+ VkCommandBuffer buffers[MAX_FRAMES];
+ } command;
+
+ struct {
+ VkPipelineLayout layout;
+ VkPipeline gfx;
+ VkPipeline transp;
+ VkPipeline blend;
+ } pipeline;
+
+ struct {
+ VkSemaphore image_available[MAX_FRAMES];
+ VkSemaphore render_finished[MAX_FRAMES];
+ VkFence in_flight[MAX_FRAMES];
+ } locks;
+
+ struct vlkn_images depth;
+/*
+ struct {
+ VkDescriptorSetLayout layout;
+ VkDescriptorPool pool;
+ struct descriptor_allocator allocator;
+ VkDescriptorSet sets[MAX_FRAMES];
+ } descriptor;
+
+ struct {
+ struct buffer buffer;
+ void *data;
+ } uniform[MAX_FRAMES];
+*/
+
+ VkRenderPass render_pass;
+
+ uint32_t current_frame;
+};
+
+#endif