Fix unreported: Vulkan: Empty device list

The list of vulkan devices is empty. This regression was introduced by
91960b07db. Vulkan needs to initialize the
platform twice. Once when the backend starts, and the second time when
the device is selected. The device list is added when the backend
starts, but was cleared when the device was initialized, making the list
empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/130020
This commit is contained in:
Jeroen Bakker
2024-11-08 12:29:23 +01:00
parent b2e1677b36
commit b86ed45fcb

View File

@@ -282,6 +282,10 @@ void VKBackend::platform_init(const VKDevice &device)
std::string vendor_name = device.vendor_name();
std::string driver_version = device.driver_version();
/* GPG has already been initialized, but without a specific device. Calling init twice will
* clear the list of devices. Making a copy of the device list and set it after initialization to
* make sure the list isn't destroyed at this moment, but only when the backend is destroyed. */
Vector<GPUDevice> devices = GPG.devices;
GPG.init(device_type,
os,
driver,
@@ -291,6 +295,7 @@ void VKBackend::platform_init(const VKDevice &device)
properties.deviceName,
driver_version.c_str(),
GPU_ARCHITECTURE_IMR);
GPG.devices = devices;
CLOG_INFO(&LOG,
0,