From 780296c72ef767393e1cefce128f725e0a706c65 Mon Sep 17 00:00:00 2001 From: Beatriz Navidad Vilches Date: Wed, 2 Oct 2024 20:35:31 +0200 Subject: [PATCH] Fix logic for finding suitable opencl device --- samples/extensions/khr/externalmemory/vulkan_utils.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/extensions/khr/externalmemory/vulkan_utils.h b/samples/extensions/khr/externalmemory/vulkan_utils.h index f2d82554..47277d43 100644 --- a/samples/extensions/khr/externalmemory/vulkan_utils.h +++ b/samples/extensions/khr/externalmemory/vulkan_utils.h @@ -241,10 +241,14 @@ find_suitable_device(VkInstance instance, ++platform_id) { cl_uint cl_platform_devices_count = 0; - OCLERROR_RET(clGetDeviceIDs(platforms[platform_id], - CL_DEVICE_TYPE_ALL, 0, NULL, - &cl_platform_devices_count), - error, platforms); + error = clGetDeviceIDs(platforms[platform_id], CL_DEVICE_TYPE_ALL, 0, + NULL, &cl_platform_devices_count); + // Some platforms may not have any suitable device. Allow the CL_DEVICE_NOT_FOUND + // error so that other platforms can be checked. + if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) + { + goto platforms; + } for (cl_uint device_id = 0; device_id < cl_platform_devices_count; ++device_id) {