Build: patch USD to avoid using rdtscp instruction not available on older CPUs

Disable the new more accurate timing code, this is not needed for Blender.
In USD itself this code is disabled on macOS anyway, so it should operate fine
without it.

Ref T97950, T95206

Differential Revision: https://developer.blender.org/D14928
This commit is contained in:
Brecht Van Lommel 2022-05-11 23:56:06 +02:00
parent 2c784f44cf
commit 018acc5688
Notes: blender-bot 2023-02-14 10:14:07 +01:00
Referenced by issue #97950, Crash on startup on older CPUs, due to unsupported instruction in USD libraries
Referenced by issue #95206, Libraries Changes for Blender 3.2
1 changed files with 49 additions and 0 deletions

View File

@ -51,3 +51,52 @@ diff --git a/pxr/usd/sdr/shaderMetadataHelpers.h b/pxr/usd/sdr/shaderMetadataHel
/// \namespace ShaderMetadataHelpers
diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h
index 517561f..fda5a1f 100644
--- a/pxr/base/arch/timing.h
+++ b/pxr/base/arch/timing.h
@@ -91,6 +91,10 @@ ArchGetTickTime()
inline uint64_t
ArchGetStartTickTime()
{
+ // BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
+ return ArchGetTickTime();
+
+#if 0
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
@@ -123,6 +127,7 @@ ArchGetStartTickTime()
#error "Unsupported architecture."
#endif
return t;
+#endif
}
/// Get a "stop" tick time for measuring an interval of time. See
@@ -132,6 +137,10 @@ ArchGetStartTickTime()
inline uint64_t
ArchGetStopTickTime()
{
+ // BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
+ return ArchGetTickTime();
+
+#if 0
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
@@ -162,11 +171,11 @@ ArchGetStopTickTime()
#error "Unsupported architecture."
#endif
return t;
+#endif
}
-#if defined (doxygen) || \
- (!defined(ARCH_OS_DARWIN) && defined(ARCH_CPU_INTEL) && \
- (defined(ARCH_COMPILER_CLANG) || defined(ARCH_COMPILER_GCC)))
+// BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
+#if 0
/// A simple timer class for measuring an interval of time using the
/// ArchTickTimer facilities.