When no GPU is detected, a proper exception describing it is now thrown instead of failing silently

This commit is contained in:
Kah Wei 2022-11-23 09:57:55 +08:00
parent ae85c246ed
commit 1a26b0ac70
1 changed files with 6 additions and 1 deletions

View File

@ -61,8 +61,13 @@ namespace SHADE
SHVkInstance::Init(true, false, true); SHVkInstance::Init(true, false, true);
#endif #endif
// Get Physical Device and Construct Logical Device // Get Physical Device
physicalDevice = SHVkInstance::CreatePhysicalDevice(SH_PHYSICAL_DEVICE_TYPE::BEST); physicalDevice = SHVkInstance::CreatePhysicalDevice(SH_PHYSICAL_DEVICE_TYPE::BEST);
if (!physicalDevice->GetVkPhysicalDevice())
{
throw std::runtime_error("[Graphics System] No supported Vulkan 1.3 compatible GPU was detected!");
}
// Construct Logical Device
device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice); device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice);
// Construct surface // Construct surface