[Bf-blender-cvs] [a3c40912153] master: Fix Cycles device kernels containing debug assertation code

Patrick Mours noreply at git.blender.org
Thu Dec 3 15:21:10 CET 2020


Commit: a3c40912153235508aaccbd310f247073029becb
Author: Patrick Mours
Date:   Thu Dec 3 15:20:50 2020 +0100
Branches: master
https://developer.blender.org/rBa3c40912153235508aaccbd310f247073029becb

Fix Cycles device kernels containing debug assertation code

NanoVDB includes "assert.h" and makes use of "assert" in several places and since the compile
pipeline for CUDA/OptiX kernels does not define "NDEBUG" for release builds, those debug
checks were always added. This is not intended, so this patch disables "assert" for CUDA/OptiX
by defining "NDEBUG" before including NanoVDB headers.
This also fixes a warning about unknown pragmas in NanoVDB thrown by the CUDA compiler.

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

M	intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
M	intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h

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

diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
index 44c658d4cab..59b96c86c50 100644
--- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
+++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
@@ -18,6 +18,7 @@
 #define __KERNEL_CPU_IMAGE_H__
 
 #ifdef WITH_NANOVDB
+#  define NANOVDB_USE_INTRINSICS
 #  include <nanovdb/NanoVDB.h>
 #  include <nanovdb/util/SampleFromVoxels.h>
 #endif
diff --git a/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h b/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h
index 001bc652810..82ad9225fc3 100644
--- a/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h
+++ b/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h
@@ -15,6 +15,8 @@
  */
 
 #ifdef WITH_NANOVDB
+#  define NDEBUG /* Disable "assert" in device code */
+#  define NANOVDB_USE_INTRINSICS
 #  include "nanovdb/NanoVDB.h"
 #  include "nanovdb/util/SampleFromVoxels.h"
 #endif



More information about the Bf-blender-cvs mailing list