-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.h
84 lines (67 loc) · 2.66 KB
/
controller.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
80
81
82
83
84
/**
* Copyright (C) 2016 Nigel Williams
*
* Vulkan Free Surface Modeling Engine (VFSME) is free software:
* you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef controller_h
#define controller_h
#include <vulkan/vulkan.h>
#include "shared.h"
namespace vfsme
{
class Controller
{
public:
Controller();
~Controller();
///@note Only define copy and move contructors and assignment operators if they are actually required
Controller(const Controller&) = delete;
Controller(Controller&&) = delete;
Controller& operator=(const Controller&) = delete;
Controller& operator=(Controller &&) = delete;
void Init();
void SetupQueue();
void SetupDevice(const VkSurfaceKHR& surface);
void Destroy();
inline VkPhysicalDevice& GetPhysicalDevice() { return physicalDevice; }
inline VkDevice& GetDevice() { return device; }
inline VkInstance& GetInstance() { return instance; }
void Configure(const VkSurfaceKHR& surface);
bool PresentModeSupported(const VkSurfaceKHR& surface, VkPresentModeKHR presentMode);
bool SurfaceFormatSupported(const VkSurfaceKHR& surface, VkFormat surfaceFormat) const;
const VkPhysicalDeviceMemoryProperties& GetMemoryProperties() const { return memProperties; }
//inline VkSurfaceCapabilitiesKHR* GetCapabilities() { return &capabilities; }
inline uint32_t GetQueueFamilyId() const { return queueFamilyId; }
inline uint32_t GetGraphicsQueueIndex() const { return graphicsQueueIndex; }
inline uint32_t GetPresentQueueIndex() const { return presentQueueIndex; }
inline uint32_t GetComputeQueueIndex() const { return computeQueueIndex; }
void CheckFormatPropertyType(VkFormat format, VkFormatFeatureFlagBits flags) const;
private:
void PrintCapabilities() const;
VkDevice device;
VkPhysicalDevice physicalDevice;
VkPhysicalDeviceFeatures deviceFeatures;
VkInstance instance;
VkDebugReportCallbackEXT callback;
VkSurfaceCapabilitiesKHR capabilities;
VkPhysicalDeviceMemoryProperties memProperties;
float* queuePriorities;
const uint32_t queueCount = 3;
uint32_t queueFamilyId = InvalidIndex;
const uint32_t graphicsQueueIndex = 0;
const uint32_t presentQueueIndex = 1;
const uint32_t computeQueueIndex = 2;
};
};
#endif