Blender V4.3
debug.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#ifndef __UTIL_DEBUG_H__
6#define __UTIL_DEBUG_H__
7
8#include <cassert>
9
10#include "bvh/params.h"
11
13
14/* Global storage for all sort of flags used to fine-tune behavior of particular
15 * areas for the development purposes, without officially exposing settings to
16 * the interface.
17 */
19 public:
20 /* Descriptor of CPU feature-set to be used. */
21 struct CPU {
22 CPU();
23
24 /* Reset flags to their defaults. */
25 void reset();
26
27 /* Flags describing which instructions sets are allowed for use. */
28 bool avx2 = true;
29 bool sse42 = true;
30
31 /* Check functions to see whether instructions up to the given one
32 * are allowed for use.
33 */
34 bool has_avx2()
35 {
36 return has_sse42() && avx2;
37 }
38 bool has_sse42()
39 {
40 return sse42;
41 }
42
43 /* Requested BVH layout.
44 *
45 * By default the fastest will be used. For debugging the BVH used by other
46 * CPUs and GPUs can be selected here instead.
47 */
49 };
50
51 /* Descriptor of CUDA feature-set to be used. */
52 struct CUDA {
53 CUDA();
54
55 /* Reset flags to their defaults. */
56 void reset();
57
58 /* Whether adaptive feature based runtime compile is enabled or not.
59 * Requires the CUDA Toolkit and only works on Linux at the moment. */
60 bool adaptive_compile = false;
61 };
62
63 /* Descriptor of HIP feature-set to be used. */
64 struct HIP {
65 HIP();
66
67 /* Reset flags to their defaults. */
68 void reset();
69
70 /* Whether adaptive feature based runtime compile is enabled or not. */
71 bool adaptive_compile = false;
72 };
73
74 /* Descriptor of OptiX feature-set to be used. */
75 struct OptiX {
76 OptiX();
77
78 /* Reset flags to their defaults. */
79 void reset();
80
81 /* Load OptiX module with debug capabilities. Will lower logging verbosity level, enable
82 * validations, and lower optimization level. */
83 bool use_debug = false;
84 };
85
86 /* Descriptor of Metal feature-set to be used. */
87 struct Metal {
88 Metal();
89
90 /* Reset flags to their defaults. */
91 void reset();
92
93 /* Whether adaptive feature based runtime compile is enabled or not. */
94 bool adaptive_compile = false;
95
96 /* Whether local atomic sorting is enabled or not. */
98
99 /* Whether nanovdb is enabled or not. */
100 bool use_nanovdb = true;
101
102 /* Whether async PSO creation is enabled or not. */
104 };
105
106 /* Get instance of debug flags registry. */
107 static DebugFlags &get()
108 {
109 static DebugFlags instance;
110 return instance;
111 }
112
113 /* Reset flags to their defaults. */
114 void reset();
115
116 /* Requested CPU flags. */
118
119 /* Requested CUDA flags. */
121
122 /* Requested OptiX flags. */
124
125 /* Requested HIP flags. */
127
128 /* Requested Metal flags. */
130
131 private:
132 DebugFlags();
133
134 public:
135 explicit DebugFlags(DebugFlags const & /*other*/) = delete;
136 void operator=(DebugFlags const & /*other*/) = delete;
137};
138
141
143{
144 return DebugFlags::get();
145}
146
148
149#endif /* __UTIL_DEBUG_H__ */
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
static DebugFlags & get()
Definition debug.h:107
CPU cpu
Definition debug.h:117
void reset()
Definition debug.cpp:104
OptiX optix
Definition debug.h:123
void operator=(DebugFlags const &)=delete
CUDA cuda
Definition debug.h:120
HIP hip
Definition debug.h:126
DebugFlags(DebugFlags const &)=delete
Metal metal
Definition debug.h:129
const DebugFlags & DebugFlagsConstRef
Definition debug.h:140
DebugFlags & DebugFlagsRef
Definition debug.h:139
DebugFlags & DebugFlags()
Definition debug.h:142
#define CCL_NAMESPACE_END
@ BVH_LAYOUT_AUTO
CCL_NAMESPACE_BEGIN typedef KernelBVHLayout BVHLayout
Definition params.h:23
bool has_avx2()
Definition debug.h:34
void reset()
Definition debug.cpp:21
BVHLayout bvh_layout
Definition debug.h:48
bool has_sse42()
Definition debug.h:38
bool adaptive_compile
Definition debug.h:60
bool adaptive_compile
Definition debug.h:71
void reset()
Definition debug.cpp:63
bool use_async_pso_creation
Definition debug.h:103
bool adaptive_compile
Definition debug.h:94
bool use_local_atomic_sort
Definition debug.h:97