Skip to content

Print CL status code on error in opengl interop functions#22855

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
kallaballa:print_cl_status_on_fail
Nov 25, 2022
Merged

Print CL status code on error in opengl interop functions#22855
asmorkalov merged 3 commits intoopencv:4.xfrom
kallaballa:print_cl_status_on_fail

Conversation

@kallaballa
Copy link
Copy Markdown
Contributor

Pertaining Issue: #22854

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov asmorkalov self-requested a review November 24, 2022 06:59
@asmorkalov asmorkalov added this to the 4.7.0 milestone Nov 24, 2022
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend you to use CV_Error_. It supports formatting strings like printf. See https://docs.opencv.org/4.x/db/de0/group__core__utils.html#ga1c0cd6e5bd9a5f915c6cab9c0632f969

@asmorkalov asmorkalov self-assigned this Nov 24, 2022
@kallaballa
Copy link
Copy Markdown
Contributor Author

Alright

@kallaballa
Copy link
Copy Markdown
Contributor Author

Done 39c9027

@asmorkalov asmorkalov merged commit 3f371fe into opencv:4.x Nov 25, 2022
cl_int status = clGetPlatformIDs(0, NULL, &numPlatforms);
if (status != CL_SUCCESS)
CV_Error(cv::Error::OpenCLInitError, "OpenCL: Can't get number of platforms");
CV_Error_(cv::Error::OpenCLInitError, "OpenCL: Can't get number of platforms: %d ", status);
Copy link
Copy Markdown
Member

@alalek alalek Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it tested anywhere on CI?

Used syntax is following:

CV_Error_(code, (format, args...))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got your point and fix it asap.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am testing at the moment. Why did this work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A merge gone bad🤦‍♂️
Still testing.

@kallaballa
Copy link
Copy Markdown
Contributor Author

Fixed: kallaballa@8a36966

@asmorkalov asmorkalov mentioned this pull request Nov 25, 2022
6 tasks
@alalek alalek mentioned this pull request Jan 8, 2023
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
Print CL status code on error in opengl interop functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants