[Bf-blender-cvs] [47844ccad68] cycles-x: Cleanup: Remove redundant Cycles attributes
Sergey Sharybin
noreply at git.blender.org
Tue May 4 16:08:09 CEST 2021
Commit: 47844ccad682a7bf05701a1a9fad17e258fe005b
Author: Sergey Sharybin
Date: Tue May 4 15:57:08 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB47844ccad682a7bf05701a1a9fad17e258fe005b
Cleanup: Remove redundant Cycles attributes
- Remove `ccl_maybe_unused` which was only defined for CPU, use more
portable `ccl_attr_maybe_unused` instead.
- Assume C++11 is always available, so use `constexpr` directly in the
kernel code.
Differential Revision: https://developer.blender.org/D11161
===================================================================
M intern/cycles/kernel/device/cuda/compat.h
M intern/cycles/kernel/device/opencl/compat.h
M intern/cycles/kernel/device/optix/compat.h
M intern/cycles/kernel/integrator/integrator_intersect_shadow.h
M intern/cycles/util/util_defines.h
M intern/cycles/util/util_simd.h
===================================================================
diff --git a/intern/cycles/kernel/device/cuda/compat.h b/intern/cycles/kernel/device/cuda/compat.h
index 36db74e1899..9a8f4e9ec29 100644
--- a/intern/cycles/kernel/device/cuda/compat.h
+++ b/intern/cycles/kernel/device/cuda/compat.h
@@ -84,7 +84,6 @@ __device__ half __float2half(const float f)
#define ccl_optional_struct_init
#define ccl_attr_maybe_unused [[maybe_unused]]
-#define ccl_constexpr constexpr
#define ATTR_FALLTHROUGH
diff --git a/intern/cycles/kernel/device/opencl/compat.h b/intern/cycles/kernel/device/opencl/compat.h
index 3dafe0c7fde..5b372085987 100644
--- a/intern/cycles/kernel/device/opencl/compat.h
+++ b/intern/cycles/kernel/device/opencl/compat.h
@@ -46,7 +46,6 @@
#define ccl_ref
#define ccl_align(n) __attribute__((aligned(n)))
#define ccl_optional_struct_init
-#define ccl_constexpr
#define ccl_attr_maybe_unused
#if __OPENCL_VERSION__ >= 200 && !defined(__NV_CL_C_VERSION)
diff --git a/intern/cycles/kernel/device/optix/compat.h b/intern/cycles/kernel/device/optix/compat.h
index 121ede1ce05..3f70293bf3f 100644
--- a/intern/cycles/kernel/device/optix/compat.h
+++ b/intern/cycles/kernel/device/optix/compat.h
@@ -80,7 +80,6 @@ __device__ half __float2half(const float f)
#define ccl_align(n) __align__(n)
#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 = {}
diff --git a/intern/cycles/kernel/integrator/integrator_intersect_shadow.h b/intern/cycles/kernel/integrator/integrator_intersect_shadow.h
index 7572d96da47..5280aada446 100644
--- a/intern/cycles/kernel/integrator/integrator_intersect_shadow.h
+++ b/intern/cycles/kernel/integrator/integrator_intersect_shadow.h
@@ -41,8 +41,8 @@ ccl_device bool integrate_intersect_shadow_opaque(INTEGRATOR_STATE_ARGS,
* Calculate the mask at compile time: the visibility will either be a high bits for the shadow
* catcher objects, or lower bits for the regular objects (there is no need to check the path
* state here again). */
- ccl_constexpr const uint opaque_mask = SHADOW_CATCHER_VISIBILITY_SHIFT(PATH_RAY_SHADOW_OPAQUE) |
- PATH_RAY_SHADOW_OPAQUE;
+ constexpr const uint opaque_mask = SHADOW_CATCHER_VISIBILITY_SHIFT(PATH_RAY_SHADOW_OPAQUE) |
+ PATH_RAY_SHADOW_OPAQUE;
Intersection isect;
const bool opaque_hit = scene_intersect(kg, ray, visibility & opaque_mask, &isect);
diff --git a/intern/cycles/util/util_defines.h b/intern/cycles/util/util_defines.h
index 255b3db3d0a..e67036b16fa 100644
--- a/intern/cycles/util/util_defines.h
+++ b/intern/cycles/util/util_defines.h
@@ -45,7 +45,6 @@
# define ccl_restrict __restrict
# define ccl_ref &
# define ccl_optional_struct_init
-# define ccl_constexpr constexpr
# define ccl_loop_no_unroll
# define ccl_attr_maybe_unused [[maybe_unused]]
# define __KERNEL_WITH_SSE_ALIGN__
@@ -64,7 +63,6 @@
# define ccl_may_alias
# define ccl_always_inline __forceinline
# define ccl_never_inline __declspec(noinline)
-# define ccl_maybe_unused
# else /* _WIN32 && !FREE_WINDOWS */
# define ccl_device_inline static inline __attribute__((always_inline))
# define ccl_device_forceinline static inline __attribute__((always_inline))
@@ -76,7 +74,6 @@
# define ccl_may_alias __attribute__((__may_alias__))
# define ccl_always_inline __attribute__((always_inline))
# define ccl_never_inline __attribute__((noinline))
-# define ccl_maybe_unused __attribute__((used))
# endif /* _WIN32 && !FREE_WINDOWS */
/* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */
diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h
index 8e8caa98a1b..b4a153c329f 100644
--- a/intern/cycles/util/util_simd.h
+++ b/intern/cycles/util/util_simd.h
@@ -61,14 +61,14 @@ static struct TrueTy {
{
return true;
}
-} True ccl_maybe_unused;
+} True ccl_attr_maybe_unused;
static struct FalseTy {
__forceinline operator bool() const
{
return false;
}
-} False ccl_maybe_unused;
+} False ccl_attr_maybe_unused;
static struct ZeroTy {
__forceinline operator float() const
@@ -79,7 +79,7 @@ static struct ZeroTy {
{
return 0;
}
-} zero ccl_maybe_unused;
+} zero ccl_attr_maybe_unused;
static struct OneTy {
__forceinline operator float() const
@@ -90,7 +90,7 @@ static struct OneTy {
{
return 1;
}
-} one ccl_maybe_unused;
+} one ccl_attr_maybe_unused;
static struct NegInfTy {
__forceinline operator float() const
@@ -101,7 +101,7 @@ static struct NegInfTy {
{
return std::numeric_limits<int>::min();
}
-} neg_inf ccl_maybe_unused;
+} neg_inf ccl_attr_maybe_unused;
static struct PosInfTy {
__forceinline operator float() const
@@ -112,10 +112,10 @@ static struct PosInfTy {
{
return std::numeric_limits<int>::max();
}
-} inf ccl_maybe_unused, pos_inf ccl_maybe_unused;
+} inf ccl_attr_maybe_unused, pos_inf ccl_attr_maybe_unused;
static struct StepTy {
-} step ccl_maybe_unused;
+} step ccl_attr_maybe_unused;
#endif
More information about the Bf-blender-cvs
mailing list