Added pick device support

This commit is contained in:
Pasha Bibko
2025-11-15 19:19:43 +00:00
parent 2eb357b2ed
commit 12cdd4e515
4 changed files with 166 additions and 13 deletions

View File

@@ -4,16 +4,35 @@
namespace PB::Renderer
{
struct QueueFamilyIndices
{
std::optional<uint32_t> graphicsFamily = std::nullopt;
std::optional<uint32_t> presentFamily = std::nullopt;
[[nodiscard]] bool Complete() const
{
return graphicsFamily && presentFamily;
}
};
class VulkanManager
{
private:
static std::optional<VkInstance> s_Instance;
static std::optional<VkSurfaceKHR> s_Surface;
public:
static std::optional<VkInstance> Init();
static bool Cleanup();
static std::optional<VkSurfaceKHR> CreateSurface(GLFWwindow* window);
static bool PickPhysicalDevice();
private:
static bool IsDeviceSuitable(VkPhysicalDevice device, VkSurfaceKHR surface);
static QueueFamilyIndices FindQueueFamilies(VkPhysicalDevice device, VkSurfaceKHR surface);
static bool CheckDeviceExtensionSupport(VkPhysicalDevice device);
static std::optional<VkInstance> s_Instance;
static std::optional<VkSurfaceKHR> s_Surface;
static VkPhysicalDevice s_PhysicalDevice;
static QueueFamilyIndices s_QueueIndices;
};
}