Merge pull request #256 from SHADE-DP/Fix-NoGPUClarity

Added explicit error check for when no supported GPUs are available to use
This commit is contained in:
XiaoQiDigipen 2022-11-23 13:48:37 +08:00 committed by GitHub
commit 6161d81c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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