Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade embree to v4.3.3 and fix fmt formatter for RTCError #6901

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

daizhirui
Copy link
Contributor

This pull request fixes the following build error:

Open3D/cpp/open3d/t/geometry/RaycastingScene.cpp:1184:9: error: enumeration value ‘RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING’ not handled in switch [-Werror=switch]
 1184 |         switch (c) {
      |         ^~~~~~
cc1plus: all warnings being treated as errors

Copy link

update-docs bot commented Jul 30, 2024

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@timohl
Copy link
Contributor

timohl commented Jul 31, 2024

Failed with:
/root/Open3D/cpp/open3d/t/geometry/RaycastingScene.cpp:1206:18: error: 'RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING' was not declared in this scope

Did you build with another version of embree?

enum RTCError does not contain that value in my Ubuntu build of main at home :
(build/embree/src/ext_embree/include/embree4/rtcore_device.h:L79-L88)

enum RTCError
{
  RTC_ERROR_NONE              = 0,
  RTC_ERROR_UNKNOWN           = 1,
  RTC_ERROR_INVALID_ARGUMENT  = 2,
  RTC_ERROR_INVALID_OPERATION = 3,
  RTC_ERROR_OUT_OF_MEMORY     = 4,
  RTC_ERROR_UNSUPPORTED_CPU   = 5,
  RTC_ERROR_CANCELLED         = 6,
};

@timohl
Copy link
Contributor

timohl commented Jul 31, 2024

Latest embree does contain the value though, so might be good when embree is upgraded:
https://github.com/RenderKit/embree/blob/3c9936cb6bfb21c572503438d7a10a432e885d2c/include/embree4/rtcore_device.h#L82-L92

enum RTCError
{
  RTC_ERROR_NONE                                  = 0,
  RTC_ERROR_UNKNOWN                               = 1,
  RTC_ERROR_INVALID_ARGUMENT                      = 2,
  RTC_ERROR_INVALID_OPERATION                     = 3,
  RTC_ERROR_OUT_OF_MEMORY                         = 4,
  RTC_ERROR_UNSUPPORTED_CPU                       = 5,
  RTC_ERROR_CANCELLED                             = 6,
  RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING = 7,
};

Edit:
Maybe this function would be better instead of switch case:
https://github.com/RenderKit/embree/blob/3c9936cb6bfb21c572503438d7a10a432e885d2c/include/embree4/rtcore_device.h#L94C1-L95C60

/* Returns the string representation for the error code. For example, for RTC_ERROR_UNKNOWN the string "RTC_ERROR_UNKNOWN" will be returned. */
RTC_API const char* rtcGetErrorString(enum RTCError error);

It also seems to be a new function.

Copy link
Contributor

@timohl timohl left a comment

Choose a reason for hiding this comment

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

This change requires an upgraded embree version

If embree is upgraded, I would prefer using this function instead of switch case, in order to be independent of the actual enum values if future changes might occure:
https://github.com/RenderKit/embree/blob/3c9936cb6bfb21c572503438d7a10a432e885d2c/include/embree4/rtcore_device.h#L94C1-L95C60

/* Returns the string representation for the error code. For example, for RTC_ERROR_UNKNOWN the string "RTC_ERROR_UNKNOWN" will be returned. */
RTC_API const char* rtcGetErrorString(enum RTCError error);

@daizhirui
Copy link
Contributor Author

daizhirui commented Jul 31, 2024

@timohl I test it with embree 4.3.3. A new commit is pushed according to your suggestion of using rtcGetErrorString. Now it is safe to merge if the current embree version being used has this function.

Copy link
Contributor

@timohl timohl left a comment

Choose a reason for hiding this comment

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

The additional enum value and rtcGetErrorString are actually new in v4.3.3 which was released last week.

The main branch of open3D is on v4.3.1:

URL https://github.com/embree/embree/archive/refs/tags/v4.3.1.tar.gz
URL_HASH SHA256=824edcbb7a8cd393c5bdb7a16738487b21ecc4e1d004ac9f761e934f97bb02a4

See #6665 for the last pull request updating embree.

Maybe you could change the URL and URL_HASH to embree v4.3.3 as well, then the checks can run on the correct version.

@daizhirui
Copy link
Contributor Author

Okay, another commit is added to upgrade embree.

Copy link
Contributor

@timohl timohl left a comment

Choose a reason for hiding this comment

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

:LGTM:
Maybe update the title of this pull request and lets see how the checks go. :)

@daizhirui daizhirui changed the title add missing case RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING for … upgrade embree to v4.3.3 and fix fmt formatter for RTCError Jul 31, 2024
@ssheorey
Copy link
Member

Thanks @daizhirui for the PR and thanks @timohl for reviewing!

@ssheorey ssheorey merged commit 7f9377d into isl-org:main Aug 14, 2024
36 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants