2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2022-05-04 13:58:53 +10:00
|
|
|
|
2022-04-27 12:34:57 +02:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup gpu
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2024-02-10 19:49:12 +01:00
|
|
|
#include "BKE_global.hh"
|
2024-05-11 12:46:12 +02:00
|
|
|
#include "BLI_system.h"
|
2022-04-27 12:34:57 +02:00
|
|
|
#include "CLG_log.h"
|
|
|
|
|
|
2023-06-02 10:16:16 +10:00
|
|
|
/** Options for organizing Metal GPU debug captures. */
|
2023-05-27 18:27:17 +02:00
|
|
|
/* Maximum nested debug group depth. Groups beyond this will still have the pass name pulled into
|
|
|
|
|
* the RenderCommandEncoder, but will not display in the trace.
|
|
|
|
|
* Use -1 for unlimited. */
|
|
|
|
|
#define METAL_DEBUG_CAPTURE_MAX_NESTED_GROUPS -1
|
|
|
|
|
|
|
|
|
|
/* Whether empty debug groups should be hidden. */
|
|
|
|
|
#define METAL_DEBUG_CAPTURE_HIDE_EMPTY 0
|
|
|
|
|
|
2024-11-01 20:23:18 +01:00
|
|
|
namespace blender::gpu::debug {
|
2022-04-27 12:34:57 +02:00
|
|
|
|
|
|
|
|
extern CLG_LogRef LOG;
|
|
|
|
|
|
2022-04-28 14:03:49 +10:00
|
|
|
/* Initialize debugging. */
|
2022-04-27 12:34:57 +02:00
|
|
|
void mtl_debug_init();
|
|
|
|
|
|
|
|
|
|
/* Using Macro's instead of variadic template due to non-string-literal
|
|
|
|
|
* warning for CLG_logf when indirectly passing format string. */
|
|
|
|
|
#define EXPAND_ARGS(...) , ##__VA_ARGS__
|
|
|
|
|
#define MTL_LOG_ERROR(info, ...) \
|
|
|
|
|
{ \
|
|
|
|
|
if (G.debug & G_DEBUG_GPU) { \
|
2023-06-06 18:06:45 +02:00
|
|
|
CLOG_ERROR(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
|
2024-05-11 12:46:12 +02:00
|
|
|
BLI_system_backtrace(stderr); \
|
2022-04-27 12:34:57 +02:00
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MTL_LOG_WARNING(info, ...) \
|
|
|
|
|
{ \
|
|
|
|
|
if (G.debug & G_DEBUG_GPU) { \
|
2023-06-06 18:06:45 +02:00
|
|
|
CLOG_WARN(&debug::LOG, info EXPAND_ARGS(__VA_ARGS__)); \
|
2022-04-27 12:34:57 +02:00
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MTL_LOG_INFO(info, ...) \
|
|
|
|
|
{ \
|
|
|
|
|
if (G.debug & G_DEBUG_GPU) { \
|
2023-06-06 18:06:45 +02:00
|
|
|
CLOG_INFO(&debug::LOG, 2, info EXPAND_ARGS(__VA_ARGS__)); \
|
2022-04-27 12:34:57 +02:00
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-01 20:23:18 +01:00
|
|
|
} // namespace blender::gpu::debug
|