Repository navigation
Expand file tree
/
Copy pathVulkanConfig.hpp
More file actions
46 lines (37 loc) · 1.61 KB
/
Copy pathVulkanConfig.hpp
File metadata and controls
46 lines (37 loc) · 1.61 KB
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
#ifndef VULKAN_CONFIG_HPP
#define VULKAN_CONFIG_HPP
#define CONFIG_NULL_HANDLE nullptr
#include <vulkan/vulkan.h>
#include <cstdint>
struct SharedVulkanConfig {
const VkInstance *instance = nullptr;
const VkPhysicalDevice *physicalDevice = nullptr;
const VkDevice *device = nullptr;
const VkSurfaceKHR *surface = nullptr;
const VkQueue *graphicsQueue = nullptr;
const VkQueue *presentQueue = nullptr;
const VkSwapchainKHR *swapChain = nullptr;
const VkFormat *swapChainFormat = nullptr;
const VkExtent2D *swapChainExtent = nullptr;
const VkRenderPass *renderPass = nullptr;
const VkPipelineLayout *pipelineLayout = nullptr;
const VkPipeline *graphicsPipeline = nullptr;
const VkCommandPool *commandPool = nullptr;
bool isValid() const {
if (!instance || !physicalDevice || !device || !surface || !graphicsQueue ||
!presentQueue || !swapChain || !swapChainFormat || !swapChainExtent ||
!renderPass || !pipelineLayout || !graphicsPipeline || !commandPool) {
return false;
}
return *instance != VK_NULL_HANDLE && *physicalDevice != VK_NULL_HANDLE &&
*device != VK_NULL_HANDLE && *surface != VK_NULL_HANDLE &&
*graphicsQueue != VK_NULL_HANDLE &&
*presentQueue != VK_NULL_HANDLE && *swapChain != VK_NULL_HANDLE &&
*renderPass != VK_NULL_HANDLE && *pipelineLayout != VK_NULL_HANDLE &&
*graphicsPipeline != VK_NULL_HANDLE &&
*commandPool != VK_NULL_HANDLE &&
*swapChainFormat != VK_FORMAT_UNDEFINED &&
swapChainExtent->width > 0 && swapChainExtent->height > 0;
}
};
#endif /* VULKAN_CONFIG_HPP */