SDL: Actually pick the Vulkan device specified in the config.

This commit is contained in:
Henrik Rydgård 2023-08-17 22:06:17 +02:00
parent 13cfd9c3d6
commit 5cc85d1df7

View File

@ -69,7 +69,15 @@ bool SDLVulkanGraphicsContext::Init(SDL_Window *&window, int x, int y, int w, in
vulkan_ = nullptr;
return false;
}
vulkan_->ChooseDevice(vulkan_->GetBestPhysicalDevice());
int deviceNum = vulkan_->GetPhysicalDeviceByName(g_Config.sVulkanDevice);
if (deviceNum < 0) {
deviceNum = vulkan_->GetBestPhysicalDevice();
if (!g_Config.sVulkanDevice.empty())
g_Config.sVulkanDevice = vulkan_->GetPhysicalDeviceProperties(deviceNum).properties.deviceName;
}
vulkan_->ChooseDevice(deviceNum);
if (vulkan_->CreateDevice() != VK_SUCCESS) {
*error_message = vulkan_->InitError();
delete vulkan_;