[Bf-blender-cvs] [cf7343a3555] master: Fix Cycles kernel compile error with NanoVDB because of type redefinition

Patrick Mours noreply at git.blender.org
Mon Nov 2 18:00:24 CET 2020


Commit: cf7343a35559c7fec2047c3e5d7ef4dd7c1e64a5
Author: Patrick Mours
Date:   Mon Nov 2 18:00:13 2020 +0100
Branches: master
https://developer.blender.org/rBcf7343a35559c7fec2047c3e5d7ef4dd7c1e64a5

Fix Cycles kernel compile error with NanoVDB because of type redefinition

Cycles defines some basic integer types since it cannot use the standard headers when
compiling with NVRTC. NanoVDB however only does this when the "__CUDACC_RTC__" define
is set and otherwise includes the standard "stdint.h" header which clashes with those typedefs.
So for compatibility do the same thing in the Cycles kernel headers. See also T81454.

===================================================================

M	intern/cycles/kernel/kernel_compat_cuda.h
M	intern/cycles/kernel/kernel_compat_optix.h

===================================================================

diff --git a/intern/cycles/kernel/kernel_compat_cuda.h b/intern/cycles/kernel/kernel_compat_cuda.h
index 4094e173da9..ea3b78b7cef 100644
--- a/intern/cycles/kernel/kernel_compat_cuda.h
+++ b/intern/cycles/kernel/kernel_compat_cuda.h
@@ -32,8 +32,12 @@
 
 /* Manual definitions so we can compile without CUDA toolkit. */
 
+#ifdef __CUDACC_RTC__
 typedef unsigned int uint32_t;
 typedef unsigned long long uint64_t;
+#else
+#  include <stdint.h>
+#endif
 typedef unsigned short half;
 typedef unsigned long long CUtexObject;
 
diff --git a/intern/cycles/kernel/kernel_compat_optix.h b/intern/cycles/kernel/kernel_compat_optix.h
index e58d8b2aa63..064c99ca100 100644
--- a/intern/cycles/kernel/kernel_compat_optix.h
+++ b/intern/cycles/kernel/kernel_compat_optix.h
@@ -31,8 +31,12 @@
 #  define ATTR_FALLTHROUGH
 #endif
 
+#ifdef __CUDACC_RTC__
 typedef unsigned int uint32_t;
 typedef unsigned long long uint64_t;
+#else
+#  include <stdint.h>
+#endif
 typedef unsigned short half;
 typedef unsigned long long CUtexObject;



More information about the Bf-blender-cvs mailing list