blender patches
This commit is contained in:
40
blender-patches/0006-fix_Cycles_compilation_on_ARM.patch
Normal file
40
blender-patches/0006-fix_Cycles_compilation_on_ARM.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From: Sergey Sharybin <sergey@blender.org>
|
||||
Date: Wed, 9 Feb 2022 23:15:50 +0100
|
||||
Subject: fix_Cycles_compilation_on_ARM
|
||||
|
||||
The rbit instruction is only available starting with ARMv6T2 and
|
||||
the register prefix is different from what AARCH64 uses.
|
||||
|
||||
Separate the 32 and 64 bit ARM branches, add missing ISA checks.
|
||||
|
||||
Made sure the code works as intended on macMini with Apple silicon,
|
||||
and on Raspberry Pi 4 B running 32bit Raspbian OS.
|
||||
|
||||
Differential Revision: https://developer.blender.org/D14056
|
||||
|
||||
Signed-off-by: Matteo F. Vescovi <mfv@debian.org>
|
||||
---
|
||||
intern/cycles/util/math.h | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
|
||||
index 4e0e97f..7fc829f 100644
|
||||
--- a/intern/cycles/util/math.h
|
||||
+++ b/intern/cycles/util/math.h
|
||||
@@ -849,9 +849,15 @@ ccl_device_inline uint prev_power_of_two(uint x)
|
||||
ccl_device_inline uint32_t reverse_integer_bits(uint32_t x)
|
||||
{
|
||||
/* Use a native instruction if it exists. */
|
||||
-#if defined(__arm__) || defined(__aarch64__)
|
||||
+#if defined(__aarch64__) || defined(_M_ARM64)
|
||||
+ /* Assume the rbit is always available on 64bit ARM architecture. */
|
||||
__asm__("rbit %w0, %w1" : "=r"(x) : "r"(x));
|
||||
return x;
|
||||
+#elif defined(__arm__) && ((__ARM_ARCH > 7) || __ARM_ARCH == 6 && __ARM_ARCH_ISA_THUMB >= 2)
|
||||
+ /* This ARM instruction is available in ARMv6T2 and above.
|
||||
+ * This 32-bit Thumb instruction is available in ARMv6T2 and above. */
|
||||
+ __asm__("rbit %0, %1" : "=r"(x) : "r"(x));
|
||||
+ return x;
|
||||
#elif defined(__KERNEL_CUDA__)
|
||||
return __brev(x);
|
||||
#elif __has_builtin(__builtin_bitreverse32)
|
||||
Reference in New Issue
Block a user