mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 03:30:34 +08:00
core(ocl): Don't query image formats when none exist
clGetSupportedImageFormats returns CL_INVALID_VALUE if called with num_entries 0 and a non-NULL image_formats pointer so let's not do that.
This commit is contained in:
parent
da6ad1c640
commit
ad16c243ca
@ -6445,6 +6445,8 @@ struct Image2D::Impl
|
||||
CL_MEM_OBJECT_IMAGE2D, numFormats,
|
||||
NULL, &numFormats);
|
||||
CV_OCL_DBG_CHECK_RESULT(err, "clGetSupportedImageFormats(CL_MEM_OBJECT_IMAGE2D, NULL)");
|
||||
if (numFormats > 0)
|
||||
{
|
||||
AutoBuffer<cl_image_format> formats(numFormats);
|
||||
err = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE,
|
||||
CL_MEM_OBJECT_IMAGE2D, numFormats,
|
||||
@ -6457,6 +6459,7 @@ struct Image2D::Impl
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user