diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /intern/cycles/util/util_debug.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/cycles/util/util_debug.h')
-rw-r--r-- | intern/cycles/util/util_debug.h | 285 |
1 files changed, 150 insertions, 135 deletions
diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h index e8c272cdb80..d668ddc6d6c 100644 --- a/intern/cycles/util/util_debug.h +++ b/intern/cycles/util/util_debug.h @@ -29,151 +29,166 @@ CCL_NAMESPACE_BEGIN * the interface. */ class DebugFlags { -public: - /* Use static BVH in viewport, to match final render exactly. */ - bool viewport_static_bvh; - - /* Descriptor of CPU feature-set to be used. */ - struct CPU { - CPU(); - - /* Reset flags to their defaults. */ - void reset(); - - /* Flags describing which instructions sets are allowed for use. */ - bool avx2; - bool avx; - bool sse41; - bool sse3; - bool sse2; - - /* Check functions to see whether instructions up to the given one - * are allowed for use. - */ - bool has_avx2() { return has_avx() && avx2; } - bool has_avx() { return has_sse41() && avx; } - bool has_sse41() { return has_sse3() && sse41; } - bool has_sse3() { return has_sse2() && sse3; } - bool has_sse2() { return sse2; } - - /* Requested BVH size. - * - * Rendering will use widest possible BVH which is below or equal - * this one. - */ - BVHLayout bvh_layout; - - /* Whether split kernel is used */ - bool split_kernel; - }; - - /* Descriptor of CUDA feature-set to be used. */ - struct CUDA { - CUDA(); - - /* Reset flags to their defaults. */ - void reset(); - - /* Whether adaptive feature based runtime compile is enabled or not. - * Requires the CUDA Toolkit and only works on Linux atm. */ - bool adaptive_compile; - - /* Whether split kernel is used */ - bool split_kernel; - }; - - /* Descriptor of OpenCL feature-set to be used. */ - struct OpenCL { - OpenCL(); - - /* Reset flags to their defaults. */ - void reset(); - - /* Available device types. - * Only gives a hint which devices to let user to choose from, does not - * try to use any sort of optimal device or so. - */ - enum DeviceType { - /* None of OpenCL devices will be used. */ - DEVICE_NONE, - /* All OpenCL devices will be used. */ - DEVICE_ALL, - /* Default system OpenCL device will be used. */ - DEVICE_DEFAULT, - /* Host processor will be used. */ - DEVICE_CPU, - /* GPU devices will be used. */ - DEVICE_GPU, - /* Dedicated OpenCL accelerator device will be used. */ - DEVICE_ACCELERATOR, - }; - - /* Available kernel types. */ - enum KernelType { - /* Do automated guess which kernel to use, based on the officially - * supported GPUs and such. - */ - KERNEL_DEFAULT, - /* Force mega kernel to be used. */ - KERNEL_MEGA, - /* Force split kernel to be used. */ - KERNEL_SPLIT, - }; - - /* Requested device type. */ - DeviceType device_type; - - /* Use debug version of the kernel. */ - bool debug; - - /* TODO(mai): Currently this is only for OpenCL, but we should have it implemented for all devices. */ - /* Artificial memory limit in bytes (0 if disabled). */ - size_t mem_limit; - }; - - /* Get instance of debug flags registry. */ - static DebugFlags& get() - { - static DebugFlags instance; - return instance; - } - - /* Reset flags to their defaults. */ - void reset(); - - /* Requested CPU flags. */ - CPU cpu; - - /* Requested CUDA flags. */ - CUDA cuda; - - /* Requested OpenCL flags. */ - OpenCL opencl; - -private: - DebugFlags(); + public: + /* Use static BVH in viewport, to match final render exactly. */ + bool viewport_static_bvh; + + /* Descriptor of CPU feature-set to be used. */ + struct CPU { + CPU(); + + /* Reset flags to their defaults. */ + void reset(); + + /* Flags describing which instructions sets are allowed for use. */ + bool avx2; + bool avx; + bool sse41; + bool sse3; + bool sse2; + + /* Check functions to see whether instructions up to the given one + * are allowed for use. + */ + bool has_avx2() + { + return has_avx() && avx2; + } + bool has_avx() + { + return has_sse41() && avx; + } + bool has_sse41() + { + return has_sse3() && sse41; + } + bool has_sse3() + { + return has_sse2() && sse3; + } + bool has_sse2() + { + return sse2; + } + + /* Requested BVH size. + * + * Rendering will use widest possible BVH which is below or equal + * this one. + */ + BVHLayout bvh_layout; + + /* Whether split kernel is used */ + bool split_kernel; + }; + + /* Descriptor of CUDA feature-set to be used. */ + struct CUDA { + CUDA(); + + /* Reset flags to their defaults. */ + void reset(); + + /* Whether adaptive feature based runtime compile is enabled or not. + * Requires the CUDA Toolkit and only works on Linux atm. */ + bool adaptive_compile; + + /* Whether split kernel is used */ + bool split_kernel; + }; + + /* Descriptor of OpenCL feature-set to be used. */ + struct OpenCL { + OpenCL(); + + /* Reset flags to their defaults. */ + void reset(); + + /* Available device types. + * Only gives a hint which devices to let user to choose from, does not + * try to use any sort of optimal device or so. + */ + enum DeviceType { + /* None of OpenCL devices will be used. */ + DEVICE_NONE, + /* All OpenCL devices will be used. */ + DEVICE_ALL, + /* Default system OpenCL device will be used. */ + DEVICE_DEFAULT, + /* Host processor will be used. */ + DEVICE_CPU, + /* GPU devices will be used. */ + DEVICE_GPU, + /* Dedicated OpenCL accelerator device will be used. */ + DEVICE_ACCELERATOR, + }; + + /* Available kernel types. */ + enum KernelType { + /* Do automated guess which kernel to use, based on the officially + * supported GPUs and such. + */ + KERNEL_DEFAULT, + /* Force mega kernel to be used. */ + KERNEL_MEGA, + /* Force split kernel to be used. */ + KERNEL_SPLIT, + }; + + /* Requested device type. */ + DeviceType device_type; + + /* Use debug version of the kernel. */ + bool debug; + + /* TODO(mai): Currently this is only for OpenCL, but we should have it implemented for all devices. */ + /* Artificial memory limit in bytes (0 if disabled). */ + size_t mem_limit; + }; + + /* Get instance of debug flags registry. */ + static DebugFlags &get() + { + static DebugFlags instance; + return instance; + } + + /* Reset flags to their defaults. */ + void reset(); + + /* Requested CPU flags. */ + CPU cpu; + + /* Requested CUDA flags. */ + CUDA cuda; + + /* Requested OpenCL flags. */ + OpenCL opencl; + + private: + DebugFlags(); #if (__cplusplus > 199711L) -public: - explicit DebugFlags(DebugFlags const& /*other*/) = delete; - void operator=(DebugFlags const& /*other*/) = delete; + public: + explicit DebugFlags(DebugFlags const & /*other*/) = delete; + void operator=(DebugFlags const & /*other*/) = delete; #else -private: - explicit DebugFlags(DebugFlags const& /*other*/); - void operator=(DebugFlags const& /*other*/); + private: + explicit DebugFlags(DebugFlags const & /*other*/); + void operator=(DebugFlags const & /*other*/); #endif }; -typedef DebugFlags& DebugFlagsRef; -typedef const DebugFlags& DebugFlagsConstRef; +typedef DebugFlags &DebugFlagsRef; +typedef const DebugFlags &DebugFlagsConstRef; -inline DebugFlags& DebugFlags() { +inline DebugFlags &DebugFlags() +{ return DebugFlags::get(); } -std::ostream& operator <<(std::ostream &os, - DebugFlagsConstRef debug_flags); +std::ostream &operator<<(std::ostream &os, DebugFlagsConstRef debug_flags); CCL_NAMESPACE_END -#endif /* __UTIL_DEBUG_H__ */ +#endif /* __UTIL_DEBUG_H__ */ |