OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

hdEmbree: add support for building against embree4

Open mattyjams opened this issue 3 years ago • 22 comments

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 https://github.com/mattyjams/USD/commit/98b171aa83f27fa4cdb6ab74d241c1d1727e27ea 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

mattyjams avatar Feb 23 '23 22:02 mattyjams

Filed as internal issue #USD-8057

tallytalwar avatar Feb 24 '23 00:02 tallytalwar

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 avatar Mar 10 '23 01:03 mattyjams

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 avatar May 11 '23 16:05 mattyjams

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.

mattyjams avatar Jan 16 '24 21:01 mattyjams

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

mattyjams avatar Feb 25 '24 21:02 mattyjams

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

mattyjams avatar May 20 '24 20:05 mattyjams

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

mattyjams avatar Jun 04 '24 18:06 mattyjams

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

mattyjams avatar Jun 14 '24 14:06 mattyjams

/AzurePipelines run

jesschimein avatar Jun 14 '24 17:06 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Jun 14 '24 17:06 azure-pipelines[bot]

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

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

mattyjams avatar Jul 24 '24 15:07 mattyjams

/AzurePipelines run

jesschimein avatar Jul 24 '24 17:07 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Jul 24 '24 17:07 azure-pipelines[bot]

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

mattyjams avatar Oct 03 '24 14:10 mattyjams

/AzurePipelines run

jesschimein avatar Oct 03 '24 16:10 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Oct 03 '24 16:10 azure-pipelines[bot]

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

mattyjams avatar Jan 06 '25 14:01 mattyjams

/AzurePipelines run

jesschimein avatar Jan 06 '25 20:01 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Jan 06 '25 20:01 azure-pipelines[bot]

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

I also reworded the description for this PR and one of the commits to clarify that RTCIntersectContext was not actually removed in Embree 4, but rather renamed to RTCRayQueryContext. However, it was also bundled into the optional RTCIntersectArguments parameter to the rtcIntersect*() and rtcOccluded*() functions. Since hdEmbree made no use of the context, we no longer need to provide one.

mattyjams avatar Feb 17 '25 17:02 mattyjams

/AzurePipelines run

jesschimein avatar Feb 17 '25 18:02 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Feb 17 '25 18:02 azure-pipelines[bot]

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

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.

mattyjams avatar Mar 14 '25 12:03 mattyjams

/AzurePipelines run

jesschimein avatar Mar 17 '25 23:03 jesschimein

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

azure-pipelines[bot] avatar Mar 17 '25 23:03 azure-pipelines[bot]

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

mattyjams avatar Apr 03 '25 15:04 mattyjams

/AzurePipelines run

jesschimein avatar Apr 03 '25 17:04 jesschimein

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

mattyjams avatar May 27 '25 19:05 mattyjams

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

mattyjams avatar Jun 13 '25 01:06 mattyjams

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

mattyjams avatar Jun 23 '25 12:06 mattyjams