usd/2313.patch
2025-08-01 08:51:51 -04:00

510 lines
21 KiB
Diff

From 97de29467ef3ee2e9f9952b7158f9cbad51dac2a Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Thu, 23 Feb 2023 14:17:02 -0700
Subject: [PATCH 1/7] build_usd.py: wrap the TBB_ROOT parameter value in double
quotes when building Embree
This ensures that slash characters are properly escaped on Windows.
---
build_scripts/build_usd.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py
index 40f6c3296c..ec1a268d78 100644
--- a/build_scripts/build_usd.py
+++ b/build_scripts/build_usd.py
@@ -1587,7 +1587,7 @@ def InstallMaterialX(context, force, buildArgs):
def InstallEmbree(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
extraArgs = [
- '-DTBB_ROOT={instDir}'.format(instDir=context.instDir),
+ '-DTBB_ROOT="{instDir}"'.format(instDir=context.instDir),
'-DEMBREE_TUTORIALS=OFF',
'-DEMBREE_ISPC_SUPPORT=OFF'
]
From 2679ca564baca476ff7beee448b6d6a85b91a339 Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Thu, 23 Feb 2023 12:20:39 -0700
Subject: [PATCH 2/7] FindEmbree.cmake: add support for finding Embree versions
3 or 4
---
cmake/modules/FindEmbree.cmake | 41 +++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/cmake/modules/FindEmbree.cmake b/cmake/modules/FindEmbree.cmake
index cd52f6b7f5..4c4ff1cdb2 100644
--- a/cmake/modules/FindEmbree.cmake
+++ b/cmake/modules/FindEmbree.cmake
@@ -19,12 +19,30 @@
#
#=============================================================================
+find_path(EMBREE_INCLUDE_DIR
+ embree4/rtcore.h
+ embree3/rtcore.h
+HINTS
+ "${EMBREE_LOCATION}/include"
+ "$ENV{EMBREE_LOCATION}/include"
+DOC
+ "Embree headers path"
+)
+
+if (EMBREE_INCLUDE_DIR AND EXISTS "${EMBREE_INCLUDE_DIR}/embree4/rtcore.h")
+ set(EMBREE_VERSIONED_LIBRARY_NAME "embree4")
+ set(EMBREE_VERSION_HEADER_FILE_NAME "rtcore_config.h")
+else()
+ set(EMBREE_VERSIONED_LIBRARY_NAME "embree3")
+ set(EMBREE_VERSION_HEADER_FILE_NAME "rtcore_version.h")
+endif()
+
if (APPLE)
- set (EMBREE_LIB_NAME libembree3.dylib)
+ set (EMBREE_LIB_NAME "lib${EMBREE_VERSIONED_LIBRARY_NAME}.dylib")
elseif (UNIX)
- set (EMBREE_LIB_NAME libembree3.so)
+ set (EMBREE_LIB_NAME "lib${EMBREE_VERSIONED_LIBRARY_NAME}.so")
elseif (WIN32)
- set (EMBREE_LIB_NAME embree3.lib)
+ set (EMBREE_LIB_NAME "${EMBREE_VERSIONED_LIBRARY_NAME}.lib")
endif()
find_library(EMBREE_LIBRARY
@@ -38,21 +56,14 @@ find_library(EMBREE_LIBRARY
"Embree library path"
)
-find_path(EMBREE_INCLUDE_DIR
- embree3/rtcore.h
-HINTS
- "${EMBREE_LOCATION}/include"
- "$ENV{EMBREE_LOCATION}/include"
-DOC
- "Embree headers path"
-)
+set(EMBREE_VERSION_HEADER_FILE_PATH "${EMBREE_INCLUDE_DIR}/${EMBREE_VERSIONED_LIBRARY_NAME}/${EMBREE_VERSION_HEADER_FILE_NAME}")
-if (EMBREE_INCLUDE_DIR AND EXISTS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" )
- file(STRINGS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_MAJOR.*$")
+if (EMBREE_INCLUDE_DIR AND EXISTS "${EMBREE_VERSION_HEADER_FILE_PATH}")
+ file(STRINGS "${EMBREE_VERSION_HEADER_FILE_PATH}" TMP REGEX "^#define RTC_VERSION_MAJOR.*$")
string(REGEX MATCHALL "[0-9]+" MAJOR ${TMP})
- file(STRINGS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_MINOR.*$")
+ file(STRINGS "${EMBREE_VERSION_HEADER_FILE_PATH}" TMP REGEX "^#define RTC_VERSION_MINOR.*$")
string(REGEX MATCHALL "[0-9]+" MINOR ${TMP})
- file(STRINGS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_PATCH.*$")
+ file(STRINGS "${EMBREE_VERSION_HEADER_FILE_PATH}" TMP REGEX "^#define RTC_VERSION_PATCH.*$")
string(REGEX MATCHALL "[0-9]+" PATCH ${TMP})
set (EMBREE_VERSION ${MAJOR}.${MINOR}.${PATCH})
From c3db8a5d3c7040433f845a99b5c1ff57e5003f31 Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Thu, 16 Feb 2023 16:37:11 -0700
Subject: [PATCH 3/7] hdEmbree: add support for building against Embree
versions 3 or 4
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.
---
pxr/imaging/plugin/hdEmbree/CMakeLists.txt | 6 ++++++
pxr/imaging/plugin/hdEmbree/context.h | 6 +++++-
pxr/imaging/plugin/hdEmbree/mesh.h | 9 +++++++--
pxr/imaging/plugin/hdEmbree/meshSamplers.h | 9 +++++++--
pxr/imaging/plugin/hdEmbree/pch.h | 6 ++++++
pxr/imaging/plugin/hdEmbree/renderDelegate.h | 7 ++++++-
pxr/imaging/plugin/hdEmbree/renderParam.h | 6 +++++-
pxr/imaging/plugin/hdEmbree/renderer.cpp | 8 ++++++++
pxr/imaging/plugin/hdEmbree/renderer.h | 9 +++++++--
pxr/imaging/plugin/hdEmbree/testenv/testHdEmbree.cpp | 7 ++++++-
10 files changed, 63 insertions(+), 10 deletions(-)
diff --git a/pxr/imaging/plugin/hdEmbree/CMakeLists.txt b/pxr/imaging/plugin/hdEmbree/CMakeLists.txt
index 96ac989d6c..d843804a15 100644
--- a/pxr/imaging/plugin/hdEmbree/CMakeLists.txt
+++ b/pxr/imaging/plugin/hdEmbree/CMakeLists.txt
@@ -11,6 +11,12 @@ if (NOT ${PXR_BUILD_GPU_SUPPORT})
return()
endif()
+if (EMBREE_VERSION VERSION_GREATER_EQUAL 4.0.0)
+ add_definitions(-DPXR_EMBREE_MAJOR_VERSION=4)
+else()
+ add_definitions(-DPXR_EMBREE_MAJOR_VERSION=3)
+endif()
+
pxr_plugin(hdEmbree
LIBRARIES
plug
diff --git a/pxr/imaging/plugin/hdEmbree/context.h b/pxr/imaging/plugin/hdEmbree/context.h
index 4165adb1e6..7e5c099b74 100644
--- a/pxr/imaging/plugin/hdEmbree/context.h
+++ b/pxr/imaging/plugin/hdEmbree/context.h
@@ -14,7 +14,11 @@
#include "pxr/base/gf/matrix4f.h"
#include "pxr/base/vt/array.h"
-#include <embree3/rtcore.h>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+#else
+ #include <embree3/rtcore.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
PXR_NAMESPACE_OPEN_SCOPE
diff --git a/pxr/imaging/plugin/hdEmbree/mesh.h b/pxr/imaging/plugin/hdEmbree/mesh.h
index bbb006302f..a6f71f110f 100644
--- a/pxr/imaging/plugin/hdEmbree/mesh.h
+++ b/pxr/imaging/plugin/hdEmbree/mesh.h
@@ -15,8 +15,13 @@
#include "pxr/imaging/plugin/hdEmbree/meshSamplers.h"
-#include <embree3/rtcore.h>
-#include <embree3/rtcore_ray.h>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+ #include <embree4/rtcore_ray.h>
+#else
+ #include <embree3/rtcore.h>
+ #include <embree3/rtcore_ray.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
PXR_NAMESPACE_OPEN_SCOPE
diff --git a/pxr/imaging/plugin/hdEmbree/meshSamplers.h b/pxr/imaging/plugin/hdEmbree/meshSamplers.h
index c32c35fffa..51459a2ed4 100644
--- a/pxr/imaging/plugin/hdEmbree/meshSamplers.h
+++ b/pxr/imaging/plugin/hdEmbree/meshSamplers.h
@@ -12,8 +12,13 @@
#include "pxr/imaging/hd/meshUtil.h"
#include "pxr/base/vt/types.h"
-#include <embree3/rtcore.h>
-#include <embree3/rtcore_geometry.h>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+ #include <embree4/rtcore_geometry.h>
+#else
+ #include <embree3/rtcore.h>
+ #include <embree3/rtcore_geometry.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
#include <bitset>
diff --git a/pxr/imaging/plugin/hdEmbree/pch.h b/pxr/imaging/plugin/hdEmbree/pch.h
index 4e16a844d7..901e93859f 100644
--- a/pxr/imaging/plugin/hdEmbree/pch.h
+++ b/pxr/imaging/plugin/hdEmbree/pch.h
@@ -76,9 +76,15 @@
#include <unordered_set>
#include <utility>
#include <vector>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+#include <embree4/rtcore.h>
+#include <embree4/rtcore_geometry.h>
+#include <embree4/rtcore_ray.h>
+#else
#include <embree3/rtcore.h>
#include <embree3/rtcore_geometry.h>
#include <embree3/rtcore_ray.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
#ifdef PXR_PYTHON_SUPPORT_ENABLED
#include "pxr/base/tf/pySafePython.h"
#endif // PXR_PYTHON_SUPPORT_ENABLED
diff --git a/pxr/imaging/plugin/hdEmbree/renderDelegate.h b/pxr/imaging/plugin/hdEmbree/renderDelegate.h
index 1d8694daa6..826d020e04 100644
--- a/pxr/imaging/plugin/hdEmbree/renderDelegate.h
+++ b/pxr/imaging/plugin/hdEmbree/renderDelegate.h
@@ -13,8 +13,13 @@
#include "pxr/imaging/plugin/hdEmbree/renderer.h"
#include "pxr/base/tf/staticTokens.h"
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+#else
+ #include <embree3/rtcore.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+
#include <mutex>
-#include <embree3/rtcore.h>
PXR_NAMESPACE_OPEN_SCOPE
diff --git a/pxr/imaging/plugin/hdEmbree/renderParam.h b/pxr/imaging/plugin/hdEmbree/renderParam.h
index 206a7458bc..af94ef10a4 100644
--- a/pxr/imaging/plugin/hdEmbree/renderParam.h
+++ b/pxr/imaging/plugin/hdEmbree/renderParam.h
@@ -11,7 +11,11 @@
#include "pxr/imaging/hd/renderDelegate.h"
#include "pxr/imaging/hd/renderThread.h"
-#include <embree3/rtcore.h>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+#else
+ #include <embree3/rtcore.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
PXR_NAMESPACE_OPEN_SCOPE
diff --git a/pxr/imaging/plugin/hdEmbree/renderer.cpp b/pxr/imaging/plugin/hdEmbree/renderer.cpp
index cc8ddb0270..8cbf8d4959 100644
--- a/pxr/imaging/plugin/hdEmbree/renderer.cpp
+++ b/pxr/imaging/plugin/hdEmbree/renderer.cpp
@@ -709,9 +709,13 @@ HdEmbreeRenderer::_TraceRay(unsigned int x, unsigned int y,
rayHit.ray.flags = 0;
_PopulateRayHit(&rayHit, origin, dir, 0.0f);
{
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ rtcIntersect1(_scene, &rayHit);
+#else
RTCIntersectContext context;
rtcInitIntersectContext(&context);
rtcIntersect1(_scene, &context, &rayHit);
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
//
// there is something odd about how this is used in Embree. Is it reversed
// here and then when it it used in
@@ -1047,9 +1051,13 @@ HdEmbreeRenderer::_ComputeAmbientOcclusion(GfVec3f const& position,
shadow.flags = 0;
_PopulateRay(&shadow, position, shadowDir, 0.001f);
{
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ rtcOccluded1(_scene, &shadow);
+#else
RTCIntersectContext context;
rtcInitIntersectContext(&context);
rtcOccluded1(_scene,&context,&shadow);
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
}
// Record this AO ray's contribution to the occlusion factor: a
diff --git a/pxr/imaging/plugin/hdEmbree/renderer.h b/pxr/imaging/plugin/hdEmbree/renderer.h
index 2da9880848..913b83eccc 100644
--- a/pxr/imaging/plugin/hdEmbree/renderer.h
+++ b/pxr/imaging/plugin/hdEmbree/renderer.h
@@ -15,8 +15,13 @@
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/gf/rect2i.h"
-#include <embree3/rtcore.h>
-#include <embree3/rtcore_ray.h>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+ #include <embree4/rtcore_ray.h>
+#else
+ #include <embree3/rtcore.h>
+ #include <embree3/rtcore_ray.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
#include <random>
#include <atomic>
diff --git a/pxr/imaging/plugin/hdEmbree/testenv/testHdEmbree.cpp b/pxr/imaging/plugin/hdEmbree/testenv/testHdEmbree.cpp
index 02c2ca69f8..45370dfed0 100644
--- a/pxr/imaging/plugin/hdEmbree/testenv/testHdEmbree.cpp
+++ b/pxr/imaging/plugin/hdEmbree/testenv/testHdEmbree.cpp
@@ -23,7 +23,12 @@
#include "pxr/base/tf/errorMark.h"
-#include <embree3/rtcore.h>
+#if defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+ #include <embree4/rtcore.h>
+#else
+ #include <embree3/rtcore.h>
+#endif // defined(PXR_EMBREE_MAJOR_VERSION) && PXR_EMBREE_MAJOR_VERSION >= 4
+
#include <iostream>
PXR_NAMESPACE_USING_DIRECTIVE
From 9c67986d0a7e76babead0d1fdf5190f264c1a8b9 Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Wed, 24 Jul 2024 10:07:44 -0400
Subject: [PATCH 4/7] build_usd.py: update Embree URLs to reflect new home in
the RenderKit GitHub organization
---
build_scripts/build_usd.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py
index ec1a268d78..afa4763c8d 100644
--- a/build_scripts/build_usd.py
+++ b/build_scripts/build_usd.py
@@ -1580,9 +1580,9 @@ def InstallMaterialX(context, force, buildArgs):
# For MacOS we use version 3.13.3 to include a fix from Intel
# to build on Apple Silicon.
if MacOS():
- EMBREE_URL = "https://github.com/embree/embree/archive/v3.13.3.zip"
+ EMBREE_URL = "https://github.com/RenderKit/embree/archive/v3.13.3.zip"
else:
- EMBREE_URL = "https://github.com/embree/embree/archive/v3.2.2.zip"
+ EMBREE_URL = "https://github.com/RenderKit/embree/archive/v3.2.2.zip"
def InstallEmbree(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
From 0e3f0e8b595e74312c7fbd1b378a96d3b5e85723 Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Thu, 23 Feb 2023 12:25:24 -0700
Subject: [PATCH 5/7] build_usd.py: add an option to choose Embree 3 or Embree
4
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.
---
build_scripts/build_usd.py | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py
index afa4763c8d..f932c85b5d 100644
--- a/build_scripts/build_usd.py
+++ b/build_scripts/build_usd.py
@@ -1577,14 +1577,19 @@ def InstallMaterialX(context, force, buildArgs):
############################################################
# Embree
-# For MacOS we use version 3.13.3 to include a fix from Intel
-# to build on Apple Silicon.
-if MacOS():
- EMBREE_URL = "https://github.com/RenderKit/embree/archive/v3.13.3.zip"
-else:
- EMBREE_URL = "https://github.com/RenderKit/embree/archive/v3.2.2.zip"
+
+EMBREE_DEFAULT_MAJOR_VERSION = 3
def InstallEmbree(context, force, buildArgs):
+ if context.embreeMajorVersion >= 4:
+ EMBREE_URL = "https://github.com/RenderKit/embree/archive/refs/tags/v4.4.0.zip"
+ elif MacOS():
+ # For MacOS we use version 3.13.3 to include a fix from Intel
+ # to build on Apple Silicon.
+ EMBREE_URL = "https://github.com/RenderKit/embree/archive/refs/tags/v3.13.3.zip"
+ else:
+ EMBREE_URL = "https://github.com/RenderKit/embree/archive/refs/tags/v3.2.2.zip"
+
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
extraArgs = [
'-DTBB_ROOT="{instDir}"'.format(instDir=context.instDir),
@@ -1601,7 +1606,9 @@ def InstallEmbree(context, force, buildArgs):
RunCMake(context, force, extraArgs)
-EMBREE = Dependency("Embree", InstallEmbree, "include/embree3/rtcore.h")
+EMBREE = Dependency("Embree", InstallEmbree,
+ "include/embree3/rtcore.h",
+ "include/embree4/rtcore.h")
############################################################
# AnimX
@@ -2121,6 +2128,12 @@ def InstallUSD(context, force, buildArgs):
help="Build Embree sample imaging plugin")
subgroup.add_argument("--no-embree", dest="build_embree", action="store_false",
help="Do not build Embree sample imaging plugin (default)")
+group.add_argument("--embree-major-version",
+ default=EMBREE_DEFAULT_MAJOR_VERSION, type=int,
+ choices=[3, 4],
+ help=(
+ "The major version of Embree to build "
+ "(default: {})").format(EMBREE_DEFAULT_MAJOR_VERSION))
subgroup = group.add_mutually_exclusive_group()
subgroup.add_argument("--prman", dest="build_prman", action="store_true",
default=False,
@@ -2342,6 +2355,7 @@ def __init__(self, args):
# - Imaging plugins
self.buildEmbree = self.buildImaging and args.build_embree
+ self.embreeMajorVersion = args.embree_major_version
self.buildPrman = self.buildImaging and args.build_prman
self.prmanLocation = (os.path.abspath(args.prman_location)
if args.prman_location else None)
@@ -2656,6 +2670,7 @@ def _JoinVersion(v):
OpenImageIO support: {buildOIIO}
OpenColorIO support: {buildOCIO}
Embree support: {buildEmbree}
+ Embree major version: {embreeMajorVersion}
PRMan support: {buildPrman}
Vulkan support: {enableVulkan}
UsdImaging {buildUsdImaging}
@@ -2738,6 +2753,8 @@ def FormatBuildArguments(buildArgs):
buildOIIO=("On" if context.buildOIIO else "Off"),
buildOCIO=("On" if context.buildOCIO else "Off"),
buildEmbree=("On" if context.buildEmbree else "Off"),
+ embreeMajorVersion=(context.embreeMajorVersion if context.buildEmbree
+ else "N/A"),
buildPrman=("On" if context.buildPrman else "Off"),
buildUsdImaging=("On" if context.buildUsdImaging else "Off"),
buildUsdview=("On" if context.buildUsdview else "Off"),
From c96c972bc116e46bef477493b86b535f9b115545 Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Thu, 12 Jun 2025 17:46:43 -0400
Subject: [PATCH 6/7] hdEmbree: use a header common between TBB and oneTBB in
limits workaround
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.
---
pxr/imaging/plugin/hdEmbree/renderer.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pxr/imaging/plugin/hdEmbree/renderer.cpp b/pxr/imaging/plugin/hdEmbree/renderer.cpp
index 8cbf8d4959..381bed73e5 100644
--- a/pxr/imaging/plugin/hdEmbree/renderer.cpp
+++ b/pxr/imaging/plugin/hdEmbree/renderer.cpp
@@ -28,8 +28,13 @@
// oneTBB as a min spec. This applies the "Work" thread limit to the
// render thread if "Work" is using old TBB, but won't affect other "Work"
// implementations. Note that it may affect Embree TBB usage as well.
+//
+// The 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.
// -------------------------------------------------------------------------
-#include <tbb/tbb_stddef.h>
+#include <tbb/blocked_range.h>
#if TBB_INTERFACE_VERSION_MAJOR < 12
From a464dc5dcc9a26f552a3ece42dab949ae03d35df Mon Sep 17 00:00:00 2001
From: Matt Johnson <matt.johnson@epicgames.com>
Date: Wed, 24 Jul 2024 10:17:27 -0400
Subject: [PATCH 7/7] build_usd.py: allow oneTBB and Embree to be used together
when Embree 4.x or later is selected
---
build_scripts/build_usd.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py
index f932c85b5d..949acadb42 100644
--- a/build_scripts/build_usd.py
+++ b/build_scripts/build_usd.py
@@ -2473,9 +2473,10 @@ def ForceBuildDependency(self, dep):
PrintError("Draco plugin can not be enabled for monolithic build on Windows")
sys.exit(1)
-# The versions of Embree we currently support do not support oneTBB.
-if context.buildOneTBB and context.buildEmbree:
- PrintError("Embree support cannot be enabled when building against oneTBB")
+# When building with both oneTBB and Embree, a 4.x version of Embree must be
+# used.
+if context.buildOneTBB and (context.buildEmbree and context.embreeMajorVersion < 4):
+ PrintError("Embree 4.x or later must be selected when building against oneTBB")
sys.exit(1)
# Windows ARM64 requires oneTBB. Since oneTBB is a non-standard option for the