Skip to content

Commit

Permalink
Fix logic for finding suitable opencl device
Browse files Browse the repository at this point in the history
  • Loading branch information
Beanavil committed Oct 4, 2024
1 parent 56cdc27 commit 1c8c8db
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions samples/extensions/khr/externalmemory/vulkan_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1c8c8db

Please sign in to comment.