[Bf-blender-cvs] [16b6116b9dc] master: Fix Cycles light tree render errors on Windows
Brecht Van Lommel
noreply at git.blender.org
Tue Dec 6 16:53:31 CET 2022
Commit: 16b6116b9dc0b4acf52997c2da0bcd62789f102d
Author: Brecht Van Lommel
Date: Tue Dec 6 16:50:26 2022 +0100
Branches: master
https://developer.blender.org/rB16b6116b9dc0b4acf52997c2da0bcd62789f102d
Fix Cycles light tree render errors on Windows
Due to mistake in popcount implementation. Thanks to Weizhen for help
figuring this out.
===================================================================
M intern/cycles/util/math.h
===================================================================
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index 0fbe7a67a4f..078ed5d8aab 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -796,11 +796,11 @@ ccl_device float bits_to_01(uint bits)
ccl_device_inline uint popcount(uint x)
{
/* TODO(Stefan): pop-count intrinsic for Windows with fallback for older CPUs. */
- uint i = x & 0xaaaaaaaa;
+ uint i = x;
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
i = (((i + (i >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
- return i & 1;
+ return i;
}
# endif
#elif defined(__KERNEL_ONEAPI__)
More information about the Bf-blender-cvs
mailing list