Added pick device support
This commit is contained in:
21
main.cpp
21
main.cpp
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace PB::Renderer
|
||||
{
|
||||
void CleanupAllAndExit()
|
||||
void CleanupAllAndExit(int code)
|
||||
{
|
||||
if (!GLFWManager::Cleanup())
|
||||
std::exit(EXIT_FAILURE);
|
||||
@@ -13,7 +13,7 @@ namespace PB::Renderer
|
||||
if (VulkanManager::Cleanup())
|
||||
std::exit(EXIT_FAILURE);
|
||||
|
||||
std::exit(EXIT_SUCCESS);
|
||||
std::exit(code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,17 +29,20 @@ int main()
|
||||
if (!window)
|
||||
return -1;
|
||||
|
||||
/* Creates the Vulkan instance and surface */
|
||||
if (std::optional<VkInstance> instance = VulkanManager::Init(); !instance)
|
||||
/* Runs Vulkan initialisation functions */
|
||||
if (const std::optional<VkInstance> instance = VulkanManager::Init(); !instance)
|
||||
{
|
||||
GLFWManager::Cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (std::optional<VkSurfaceKHR> surface = VulkanManager::CreateSurface(window); !surface)
|
||||
if (const std::optional<VkSurfaceKHR> surface = VulkanManager::CreateSurface(window); !surface)
|
||||
{
|
||||
CleanupAllAndExit();
|
||||
return -1;
|
||||
CleanupAllAndExit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!VulkanManager::PickPhysicalDevice())
|
||||
{
|
||||
CleanupAllAndExit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Polls window events whilst it is still open */
|
||||
@@ -49,5 +52,5 @@ int main()
|
||||
}
|
||||
|
||||
/* Cleans up GLFW and Vulkan */
|
||||
CleanupAllAndExit();
|
||||
CleanupAllAndExit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user