[Bf-blender-cvs] [9b2a43ec428] cycles-x: Cycles: Enable constexpr and maybe_unused attributes for CUDA and OptiX
Sergey Sharybin
noreply at git.blender.org
Tue May 4 15:54:36 CEST 2021
Commit: 9b2a43ec428fdc41850031f129a2bc3fc9b76756
Author: Sergey Sharybin
Date: Tue May 4 14:26:51 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB9b2a43ec428fdc41850031f129a2bc3fc9b76756
Cycles: Enable constexpr and maybe_unused attributes for CUDA and OptiX
Tested on Linux with CUDA toolkit 11.3. Seems no additional compiler flags
are needed to have C++11/C++17 attributes available.
===================================================================
M intern/cycles/kernel/device/cuda/compat.h
M intern/cycles/kernel/device/optix/compat.h
===================================================================
diff --git a/intern/cycles/kernel/device/cuda/compat.h b/intern/cycles/kernel/device/cuda/compat.h
index c8c148d6ee5..36db74e1899 100644
--- a/intern/cycles/kernel/device/cuda/compat.h
+++ b/intern/cycles/kernel/device/cuda/compat.h
@@ -82,11 +82,9 @@ __device__ half __float2half(const float f)
#define ccl_ref
#define ccl_align(n) __align__(n)
#define ccl_optional_struct_init
-#define ccl_constexpr
-/* TODO(sergey): Should be able to use [[maybe_unused]] once the kernels are compiled with C++17
- * standard support, */
-#define ccl_attr_maybe_unused
+#define ccl_attr_maybe_unused [[maybe_unused]]
+#define ccl_constexpr constexpr
#define ATTR_FALLTHROUGH
diff --git a/intern/cycles/kernel/device/optix/compat.h b/intern/cycles/kernel/device/optix/compat.h
index 5afeabe4fd6..121ede1ce05 100644
--- a/intern/cycles/kernel/device/optix/compat.h
+++ b/intern/cycles/kernel/device/optix/compat.h
@@ -79,15 +79,12 @@ __device__ half __float2half(const float f)
#define ccl_ref
#define ccl_align(n) __align__(n)
-/* TODO(sergey): Should be able to use [[maybe_unused]] once the kernels are compiled with C++17
- * standard support, */
-#define ccl_attr_maybe_unused
+#define ccl_attr_maybe_unused [[maybe_unused]]
+#define ccl_constexpr constexpr
// Zero initialize structs to help the compiler figure out scoping
#define ccl_optional_struct_init = {}
-#define ccl_constexpr
-
#define kernel_data __params.data // See globals.h
#define kernel_tex_array(t) __params.t
#define kernel_tex_fetch(t, index) __params.t[(index)]
More information about the Bf-blender-cvs
mailing list