Skip to content

Conversation

@mattyjams
Copy link
Contributor

@mattyjams mattyjams commented Feb 23, 2023

Hello!

Description of Change(s)

These changes allow building USD and the hdEmbree plugin against the recently released 4.0.0 version of Embree. The upgrade from 3.x to 4.x of Embree involves a filename change of headers and libraries (embree3 -> embree4), the renaming of the header file that contains the version information from rtcore_version.h to rtcore_config.h, and for the usage in hdEmbree, no longer providing an (unused) context to the rtcIntersect1() and rtcOccluded1() functions. See the notes for more detail on upgrading from Embree 4 to Embree 4 here:
https://github.com/RenderKit/embree/tree/v4.0.0?tab=readme-ov-file#upgrading-from-embree-3-to-embree-4

The last change in mattyjams@98b171a isn't strictly necessary and may be overkill since there isn't really a precedent for being able to choose versions of dependencies from the command-line, so I wouldn't mind if that change needed to be culled. It does provide an easy way to select Embree 4 rather than Embree 3 though, so I included it in case it might be useful for others.

Many of the imaging tests still appear to be disabled by default on Windows which is the platform I'm currently on, so I have not been able to verify them, though the rest of the test suite passes. Manual testing in usdview has been successful so far as well.

  • [ X ] I have verified that all unit tests pass with the proposed changes
  • [ X ] I have submitted a signed Contributor License Agreement

@tallytalwar
Copy link
Contributor

Filed as internal issue #USD-8057

@mattyjams
Copy link
Contributor Author

Just noticing that @musicinmybrain covered roughly the same ground in #2266, so apologies for the duplicate! The changes here though allow building against either embree3 or embree4 as well as the ability to choose the version when using build_usd.py, in case that's of interest.

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 98b171a to e6e707f Compare May 11, 2023 16:19
@mattyjams
Copy link
Contributor Author

Mostly just a rebase on the current dev branch with this most recent push, but I also bumped the version of Embree in the build_usd.py script to 4.0.1 rather than 4.0.0 when major version 4 is requested. But again, happy to have the build_usd.py script changes culled if that's not wanted.

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from e6e707f to 28cc1fc Compare January 16, 2024 21:29
@mattyjams
Copy link
Contributor Author

Rebased to resolve merge conflicts.

While I was at it, I also bumped Embree 4.x to the current release (4.3.0) when the new --embree-major-version 4 option is used.

johnhaddon pushed a commit to boberfly/dependencies that referenced this pull request Feb 2, 2024
This also means disabling the Embree Hydra delegate, since that doesn't support Embree 4 yet - see PixarAnimationStudios/OpenUSD#2313 for work in progress. We put higher value in matching the Embree version to Cycles 4 than we do in having the Embree delegate in `usdview`.
@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 28cc1fc to 9050557 Compare February 25, 2024 21:22
@mattyjams
Copy link
Contributor Author

Updated again to bump the Embree 4 version to the new 4.3.1 release.

@nim65s nim65s mentioned this pull request Mar 25, 2024
13 tasks
@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 9050557 to 6a0360a Compare May 20, 2024 20:55
@mattyjams
Copy link
Contributor Author

Freshening with a rebase on the current dev branch (35dbce1).

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 6a0360a to 90dc0f2 Compare June 4, 2024 18:30
@mattyjams
Copy link
Contributor Author

Rebased to resolve merge conflict following precompiler header updates in 5000b45.

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 90dc0f2 to 04f899e Compare June 14, 2024 14:20
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (9562005), and bumped Embree to the new latest version (4.3.2).

@jesschimein
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 04f899e to 0ec76f5 Compare July 24, 2024 15:48
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (559b77a), and bumped Embree to the new latest version (4.3.3).

I also accounted for 9010646 where building with oneTBB through build_usd.py was added. Commit 0ec76f5 adjusts the restriction to allow building with oneTBB and Embree if a 4.x version of Embree is selected (using --embree-major-version 4).

@jesschimein
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 0ec76f5 to 90ef24e Compare October 3, 2024 14:40
@mattyjams
Copy link
Contributor Author

mattyjams commented Oct 3, 2024

Rebased to resolve merge conflict following precompiled header updates in 9bf2e14.

@jesschimein
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 90ef24e to 079ac9f Compare January 6, 2025 14:46
@mattyjams
Copy link
Contributor Author

Freshening with a rebase on the current dev branch (b787c84).

@jesschimein
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 6d8345e to b4bdb95 Compare March 14, 2025 12:46
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (e9bbc1b), and resolved merge conflict following precompiled header updates in d67846f.

I made one other minor adjustment here to make the C++ definition to control the Embree version PXR_EMBREE_MAJOR_VERSION rather than just EMBREE_MAJOR_VERSION to clarify that the definition is introduced by USD and does not come from the Embree installation.

@jesschimein
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from b4bdb95 to eea6b32 Compare April 3, 2025 15:29
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (823057d), and bumped Embree to the new latest version (4.4.0).

@jesschimein
Copy link
Collaborator

/AzurePipelines run

@musicinmybrain musicinmybrain mentioned this pull request May 6, 2025
2 tasks
@mattyjams mattyjams mentioned this pull request May 16, 2025
5 tasks
@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from eea6b32 to 560c88f Compare May 27, 2025 19:13
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (b9282cb), and resolved merge conflict following the addition of an Embree line item in the build_usd.py script in 0f3ec7d/#3234.

@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from 560c88f to d97bbb5 Compare June 13, 2025 00:57
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (99749e2), and addressed an issue introduced by 5615302 where the tbb_stddef.h header which is only present in TBB but not oneTBB was being #include'd, causing compilation issues with oneTBB.

… building Embree

This ensures that slash characters are properly escaped on Windows.
This supports upgrading Embree to a major version 4 release, so it includes
handling for the change in file paths between "embree3" and "embree4" and also
accounts for a small change in API in version 4. RTCIntersectContext was
renamed to RTCRayQueryContext, but it was also made part of the optional
RTCIntersectArguments parameter to rtcIntersect and rtcOccluded functions.
Since the context is not used by hdEmbree, it no longer needs to be provided.
The new --embree-major-version option can be given to build_usd.py to select
between Embree 3 or Embree 4. By default, Embree 3 is still used, preserving
the existing behavior.
…ound

The TBB header that provides version definitions moved between TBB
(tbb_stddef.h) and oneTBB (version.h), so we use the lowest level
header that is available at the same path in both and let it bring in
the definitions. This allows the hdEmbree plugin to be built with
oneTBB when used in combination with Embree 4.
@mattyjams mattyjams force-pushed the pr/add_support_for_building_with_embree4 branch from d97bbb5 to a464dc5 Compare June 23, 2025 12:52
@mattyjams
Copy link
Contributor Author

Rebased on the current dev branch (ceab7e6), and resolved pch.h merge conflict following the TBB CMake update in 0ca6d5f/#3207.

@tcauchois
Copy link
Contributor

Merged and should make it out in 25.11. Thanks so much for keeping this updated and being patient; for a pretty trivial code change this one was super tricky to land :D.

@mattyjams
Copy link
Contributor Author

Merged and should make it out in 25.11. Thanks so much for keeping this updated and being patient; for a pretty trivial code change this one was super tricky to land :D.

That's awesome, thanks so much @tcauchois! Hope this ended up being more helpful than headache. :)

@tcauchois
Copy link
Contributor

Yeah, for sure! Turns out Embree 3 is incompatible with OneTBB, which is a compelling argument for finally upgrading.

@pixar-oss pixar-oss closed this in 4b564a2 Aug 6, 2025
@mattyjams mattyjams deleted the pr/add_support_for_building_with_embree4 branch August 8, 2025 04:34
meshula pushed a commit to meshula/USD that referenced this pull request Sep 11, 2025
These changes allow building USD and the `hdEmbree` plugin against the [4.0.0 version of Embree](https://github.com/embree/embree/releases/tag/v4.0.0). The upgrade from 3.x to 4.x of Embree involves a filename change of headers and libraries (`embree3` -> `embree4`), the renaming of the header file that contains the version information from `rtcore_version.h` to `rtcore_config.h`, and for the usage in `hdEmbree`, no longer providing an (unused) context to the `rtcIntersect1()` and `rtcOccluded1()` functions. See the notes for more detail on upgrading from Embree 4 to Embree 4 here:
https://github.com/RenderKit/embree/tree/v4.0.0?tab=readme-ov-file#upgrading-from-embree-3-to-embree-4

Closes PixarAnimationStudios#2266
Closes PixarAnimationStudios#2313

(Internal change: 2373054)
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.

4 participants