-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDevice.h
74 lines (65 loc) · 2.11 KB
/
Device.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
// Author : Jihong Shin (snowapril)
#if !defined(VULKAN_FRAMEWORK_DEVICE_H)
#define VULKAN_FRAMEWORK_DEVICE_H
#include <VulkanFramework/pch.h>
#include <memory>
namespace vfs
{
class Window;
class Device : NonCopyable
{
public:
explicit Device() = default;
explicit Device(const char* appTitle);
~Device();
public:
void destroyDevice ();
bool initialize (const char* appTitle);
bool initializeLogicalDevice (const std::vector<uint32_t>& queueFamilyIndices);
bool initializeMemoryAllocator (void);
void getQueueFamilyProperties (std::vector<VkQueueFamilyProperties>* properties);
inline VmaAllocator getMemoryAllocator(void) const
{
return _memoryAllocator;
}
inline VkInstance getVulkanInstance(void) const
{
return _instance;
}
inline VkPhysicalDevice getPhysicalDeviceHandle(void) const
{
return _physicalDevice;
}
inline VkDevice getDeviceHandle(void) const
{
return _device;
}
inline const VkPhysicalDeviceProperties& getDeviceProperty(void) const
{
return _physicalDeviceProperties;
}
inline const VkPhysicalDeviceFeatures& getDeviceFeature(void) const
{
return _physicalDeviceFeatures;
}
private:
bool initializeInstance (const char* appTitle);
bool pickPhysicalDevice (void);
bool checkExtensionSupport (void) const;
bool checkDeviceExtensionSupport(VkPhysicalDevice device) const;
bool checkDeviceSuitable (VkPhysicalDevice device) const;
void queryDebugUtilsCreateInfo (VkDebugUtilsMessengerCreateInfoEXT* desc) const;
std::vector<const char*> getRequiredExtensions(void) const;
private:
VkPhysicalDeviceProperties _physicalDeviceProperties { 0, };
VkPhysicalDeviceFeatures _physicalDeviceFeatures { 0, };
VkInstance _instance { VK_NULL_HANDLE };
VkPhysicalDevice _physicalDevice { VK_NULL_HANDLE };
VkDevice _device { VK_NULL_HANDLE };
VkDebugUtilsMessengerEXT _debugMessenger { VK_NULL_HANDLE };
VkSurfaceKHR _surface { VK_NULL_HANDLE };
VmaAllocator _memoryAllocator { nullptr };
bool _enableValidationLayer { false };
};
}
#endif