From fa3b64f3af621fed36effa4bf1bbe749db464afc Mon Sep 17 00:00:00 2001 From: Frederique Hsu Date: Sat, 22 Mar 2025 20:00:20 +0800 Subject: [PATCH] Fix the Context::getCompatibleDevices() method, to skip the CPU device type for calling getDeviceExtensions() Signed-off-by: Frederique Hsu --- nvvk/context_vk.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nvvk/context_vk.cpp b/nvvk/context_vk.cpp index 4465312f..20f3e406 100644 --- a/nvvk/context_vk.cpp +++ b/nvvk/context_vk.cpp @@ -1061,6 +1061,18 @@ std::vector Context::getCompatibleDevices(const ContextCreateInfo& inf if(info.verboseCompatibleDevices) LOGI("%d: %s\n", elemId, props.deviceName); + /*! + * \bug Since the getDeviceExtensions() will return all extensions, when passing an argument of CPU device. + * Hence we have to skip the CPU-type device. + * Especially, when user wants to enable the "VK_KHR_ray_tracing_pipeline" extension, it will return a + * wrong compatible device to user, provided that not skip the CPU type. + */ + if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_OTHER || props.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU) + { + LOGI(" - this device is of CPU type\n"); + continue; + } + // Check if the device has all the requested extensions const std::vector extensionProperties = getDeviceExtensions(physicalDevice); const std::vector missingExtensions = checkEntryArray(extensionProperties, info.deviceExtensions);