-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvkc_instance.h
79 lines (62 loc) · 1.81 KB
/
vkc_instance.h
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
#ifndef VKC_INSTANCE_H
#define VKC_INSTANCE_H
#include "stable.h"
#include "vkc_context.h"
#include "vkc_device.h"
#include "mgcamera.h"
#include "mgbuffer.h"
#include "vkc_entity.h"
#include "mgtexture2d.h"
#define PROC(NAME) PFN_vk##NAME pf##NAME = nullptr
#define GET_IPROC(INSTANCE, NAME) pf##NAME = (PFN_vk##NAME)vkGetInstanceProcAddr(INSTANCE, "vk" #NAME)
#define GET_DPROC(INSTANCE, NAME) pf##NAME = (PFN_vk##NAME)vkGetDeviceProcAddr(INSTANCE, "vk" #NAME)
/**
* Class used as the Vulkan instance.
*
* Classes named "Vkc[class]" stand for "Vulkan custom class".
*/
class VkcInstance : public QObject
{
Q_OBJECT
// Objects:
private:
VkInstance instance;
QVector<VkcDevice*> devices;
VkcContext *context;
MgBuffer uniformBuffer;
MgBuffer presentBuffer;
void *pPresentBuffer;
MgCamera *camera;
uint32_t width;
uint32_t height;
VkSemaphore sphAcquire;
VkSemaphore sphRender;
VkFence fence;
VkcEntity* square;
MgTexture2D tux;
VkDebugReportCallbackEXT debugReport;
#ifdef QT_DEBUG
PROC(CreateDebugReportCallbackEXT);
PROC(DestroyDebugReportCallbackEXT);
#endif
// Functions:
public:
VkcInstance(QWidget *parent = 0);
~VkcInstance();
private:
void createInstance();
void getDevices();
public:
void render();
void resize();
void printDevices(
QFile *file
);
void setupRender(
const VkcDevice *device
);
void unsetupRender(
const VkcDevice *device
);
};
#endif // VKC_INSTANCE_H