blob: fcaa5afed6b44e1b14a89f4ac92362f3d4057e5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
|