Blender  V3.3
mtl_debug.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include "BKE_global.h"
10 #include "CLG_log.h"
11 
12 namespace blender {
13 namespace gpu {
14 namespace debug {
15 
16 extern CLG_LogRef LOG;
17 
18 /* Initialize debugging. */
19 void mtl_debug_init();
20 
21 /* Using Macro's instead of variadic template due to non-string-literal
22  * warning for CLG_logf when indirectly passing format string. */
23 #define EXPAND_ARGS(...) , ##__VA_ARGS__
24 #define MTL_LOG_ERROR(info, ...) \
25  { \
26  if (G.debug & G_DEBUG_GPU) { \
27  CLG_logf(debug::LOG.type, \
28  CLG_SEVERITY_ERROR, \
29  "[Metal Viewport Error]", \
30  "", \
31  info EXPAND_ARGS(__VA_ARGS__)); \
32  } \
33  BLI_assert(false); \
34  }
35 
36 #define MTL_LOG_WARNING(info, ...) \
37  { \
38  if (G.debug & G_DEBUG_GPU) { \
39  CLG_logf(debug::LOG.type, \
40  CLG_SEVERITY_WARN, \
41  "[Metal Viewport Warning]", \
42  "", \
43  info EXPAND_ARGS(__VA_ARGS__)); \
44  } \
45  }
46 
47 #define MTL_LOG_INFO(info, ...) \
48  { \
49  if (G.debug & G_DEBUG_GPU) { \
50  CLG_logf(debug::LOG.type, \
51  CLG_SEVERITY_INFO, \
52  "[Metal Viewport Info]", \
53  "", \
54  info EXPAND_ARGS(__VA_ARGS__)); \
55  } \
56  }
57 
58 } // namespace debug
59 } // namespace gpu
60 } // namespace blender
CLG_LogRef LOG
Definition: mtl_debug.mm:28