feature/imgui-sdl
points-test
Last change
on this file since 90a424f was 90a424f, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
In vulkangame, add code to create a Vulkan surface and pick a physical device
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | #ifndef _VULKAN_UTILS_H
|
---|
2 | #define _VULKAN_UTILS_H
|
---|
3 |
|
---|
4 | #include <optional>
|
---|
5 | #include <vector>
|
---|
6 |
|
---|
7 | #include <vulkan/vulkan.h>
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | struct QueueFamilyIndices {
|
---|
12 | optional<uint32_t> graphicsFamily;
|
---|
13 | optional<uint32_t> presentFamily;
|
---|
14 |
|
---|
15 | bool isComplete() {
|
---|
16 | return graphicsFamily.has_value() && presentFamily.has_value();
|
---|
17 | }
|
---|
18 | };
|
---|
19 |
|
---|
20 | struct SwapChainSupportDetails {
|
---|
21 | VkSurfaceCapabilitiesKHR capabilities;
|
---|
22 | vector<VkSurfaceFormatKHR> formats;
|
---|
23 | vector<VkPresentModeKHR> presentModes;
|
---|
24 | };
|
---|
25 |
|
---|
26 | class VulkanUtils {
|
---|
27 | public:
|
---|
28 | static bool checkValidationLayerSupport(const vector<const char*> &validationLayers);
|
---|
29 |
|
---|
30 | static VkResult createDebugUtilsMessengerEXT(VkInstance instance,
|
---|
31 | const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
|
---|
32 | const VkAllocationCallbacks* pAllocator,
|
---|
33 | VkDebugUtilsMessengerEXT* pDebugMessenger);
|
---|
34 |
|
---|
35 | static void destroyDebugUtilsMessengerEXT(VkInstance instance,
|
---|
36 | VkDebugUtilsMessengerEXT debugMessenger,
|
---|
37 | const VkAllocationCallbacks* pAllocator);
|
---|
38 |
|
---|
39 | static QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device, VkSurfaceKHR surface);
|
---|
40 | static bool checkDeviceExtensionSupport(VkPhysicalDevice device, const vector<const char*>& deviceExtensions);
|
---|
41 | static SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device, VkSurfaceKHR surface);
|
---|
42 | };
|
---|
43 |
|
---|
44 | #endif // _VULKAN_UTILS_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.