Blender V5.0
mtl_debug.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BKE_global.hh"
12#include "BLI_system.h"
13#include "CLG_log.h"
14
16/* Maximum nested debug group depth. Groups beyond this will still have the pass name pulled into
17 * the RenderCommandEncoder, but will not display in the trace.
18 * Use -1 for unlimited. */
19#define METAL_DEBUG_CAPTURE_MAX_NESTED_GROUPS -1
20
21/* Whether empty debug groups should be hidden. */
22#define METAL_DEBUG_CAPTURE_HIDE_EMPTY 0
23
24namespace blender::gpu::debug {
25
26extern CLG_LogRef LOG;
27
28/* Initialize debugging. */
29void mtl_debug_init();
30
31/* Using Macro's instead of variadic template due to non-string-literal
32 * warning for CLG_logf when indirectly passing format string. */
33#define EXPAND_ARGS(...) , ##__VA_ARGS__
34#define MTL_LOG_ERROR(info, ...) \
35 { \
36 if (G.debug & G_DEBUG_GPU) { \
37 CLOG_ERROR(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
38 BLI_system_backtrace(stderr); \
39 } \
40 }
41
42#define MTL_LOG_WARNING(info, ...) \
43 { \
44 if (G.debug & G_DEBUG_GPU) { \
45 CLOG_WARN(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
46 } \
47 }
48
49#define MTL_LOG_DEBUG(info, ...) \
50 { \
51 if (G.debug & G_DEBUG_GPU) { \
52 CLOG_DEBUG(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
53 } \
54 }
55
56} // namespace blender::gpu::debug
#define LOG(level)
Definition log.h:97