SimpleGL  1.1.0
A framework for platform independent rendering
physical_device.hpp
Go to the documentation of this file.
1 
8 #ifndef PHYSICAL_DEVICE_HPP
9 #define PHYSICAL_DEVICE_HPP
10 
11 #include <SimpleGL_vk/SimpleGL_vk_Export.h>
12 
13 #include <vector>
14 
15 #include <vulkan/vulkan.h>
16 
17 #include "surface.hpp"
18 
19 namespace sgl {
20 
27 
29  int32_t graphics;
30 
32  int32_t presentation;
33 
39  bool isValid();
40  };
41 
48 
50  VkSurfaceCapabilitiesKHR surfaceCapabilities;
51 
53  std::vector<VkSurfaceFormatKHR> surfaceFormats;
54 
56  std::vector<VkPresentModeKHR> presentModes;
57  };
58 
64  class SIMPLEGL_VK_EXPORT PhysicalDevice {
65 
66  private:
68  VkPhysicalDevice handle;
69 
71  QueueFamilyIndices queueFamilyIndices;
72 
74  SwapchainSupportDetails swapchainSupportDetails;
75 
82  PhysicalDevice(VkPhysicalDevice handle, Surface* surface);
83 
85  void validate();
86 
87  public:
95  static std::vector<PhysicalDevice*> getAvailablePhysicalDevices(Surface* surface);
96 
104  static PhysicalDevice* getSuitablePhysicalDevice(std::vector<PhysicalDevice*> physicalDevices);
105 
107  ~PhysicalDevice(void);
108 
114  VkPhysicalDevice getHandle();
115 
121  QueueFamilyIndices getQueueFamilyIndices();
122 
128  SwapchainSupportDetails getSwapchainSupportDetails();
129 
135  VkPhysicalDeviceProperties getProperties();
136 
142  VkPhysicalDeviceFeatures getFeatures();
143 
149  std::vector<VkQueueFamilyProperties> getQueueFamilyProperties();
150  };
151 }
152 
153 #endif /* PHYSICAL_DEVICE_HPP */
This class wraps a Vulkan physical device and represents a graphics card.
int32_t presentation
The index of the presentation queue family.
This struct stores relevant queue family indices.
std::vector< VkSurfaceFormatKHR > surfaceFormats
The supported surface formats.
This struct stores necessary data for swapchain support.
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
VkSurfaceCapabilitiesKHR surfaceCapabilities
The basic capabilities of a surface.
bool isValid()
Checks if the queue family indices are valid.
std::vector< VkPresentModeKHR > presentModes
The supported present modes.
int32_t graphics
The index of the graphics queue family.
This class wraps a Vulkan surface.
Definition: surface.hpp:25