Fix crash in GPU devices init when system has no valid GPU driver installed

This commit is contained in:
Wojtek Figat
2023-03-13 10:25:08 +01:00
parent e00bf92f05
commit 2930b0ad67
3 changed files with 15 additions and 0 deletions

View File

@@ -145,6 +145,11 @@ GPUDevice* GPUDeviceDX11::Create()
}
// Select the adapter to use
if (adapters.Count() == 0)
{
LOG(Error, "Failed to find valid DirectX adapter!");
return nullptr;
}
GPUAdapterDX selectedAdapter = adapters[0];
uint32 vendorId = 0;
if (CommandLine::Options.NVIDIA)

View File

@@ -119,6 +119,11 @@ GPUDevice* GPUDeviceDX12::Create()
}
// Select the adapter to use
if (adapters.Count() == 0)
{
LOG(Error, "Failed to find valid DirectX adapter!");
return nullptr;
}
GPUAdapterDX selectedAdapter = adapters[0];
uint32 vendorId = 0;
if (CommandLine::Options.NVIDIA)

View File

@@ -1202,6 +1202,11 @@ GPUDevice* GPUDeviceVulkan::Create()
}
// Select the adapter to use
if (adapters.Count() == 0)
{
LOG(Error, "Failed to find valid Vulkan adapter!");
return nullptr;
}
int32 selectedAdapter = 0;
uint32 vendorId = 0;
if (CommandLine::Options.NVIDIA)