Blender V5.3
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.hh"
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
21namespace blender::gpu::debug {
22
23extern CLG_LogRef LOG;
24
25/* Initialize debugging. */
26void mtl_debug_init();
27
28/* Using Macro's instead of variadic template due to non-string-literal
29 * warning for CLG_logf when indirectly passing format string. */
30#define EXPAND_ARGS(...) , ##__VA_ARGS__
31#define MTL_LOG_ERROR(info, ...) \
32 { \
33 if (G.debug & G_DEBUG_GPU) { \
34 CLOG_ERROR(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
35 BLI_system_backtrace(stderr); \
36 } \
37 }
38
39#define MTL_LOG_WARNING(info, ...) \
40 { \
41 if (G.debug & G_DEBUG_GPU) { \
42 CLOG_WARN(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
43 } \
44 }
45
46#define MTL_LOG_DEBUG(info, ...) \
47 { \
48 if (G.debug & G_DEBUG_GPU) { \
49 CLOG_DEBUG(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
50 } \
51 }
52
53} // namespace blender::gpu::debug
#define LOG(level)
Definition log.h:97