Blender
V3.3
source
blender
gpu
intern
gpu_debug.cc
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later
2
* Copyright 2020 Blender Foundation. All rights reserved. */
3
10
#include "
BKE_global.h
"
11
12
#include "
BLI_string.h
"
13
14
#include "
gpu_context_private.hh
"
15
16
#include "
GPU_debug.h
"
17
18
using namespace
blender
;
19
using namespace
blender::gpu
;
20
21
void
GPU_debug_group_begin
(
const
char
*name)
22
{
23
if
(!(
G
.debug &
G_DEBUG_GPU
)) {
24
return
;
25
}
26
Context
*ctx =
Context::get
();
27
DebugStack
&stack = ctx->
debug_stack
;
28
stack.
append
(
StringRef
(name));
29
ctx->
debug_group_begin
(name, stack.
size
());
30
}
31
32
void
GPU_debug_group_end
()
33
{
34
if
(!(
G
.debug &
G_DEBUG_GPU
)) {
35
return
;
36
}
37
Context
*ctx =
Context::get
();
38
ctx->
debug_stack
.
pop_last
();
39
ctx->
debug_group_end
();
40
}
41
42
void
GPU_debug_get_groups_names
(
int
name_buf_len,
char
*r_name_buf)
43
{
44
Context
*ctx =
Context::get
();
45
if
(ctx ==
nullptr
) {
46
return
;
47
}
48
DebugStack
&stack = ctx->
debug_stack
;
49
if
(stack.
size
() == 0) {
50
r_name_buf[0] =
'\0'
;
51
return
;
52
}
53
size_t
len
= 0;
54
for
(
StringRef
&name : stack) {
55
len
+=
BLI_snprintf_rlen
(r_name_buf +
len
, name_buf_len -
len
,
"%s > "
, name.data());
56
}
57
r_name_buf[
len
- 3] =
'\0'
;
58
}
59
60
bool
GPU_debug_group_match
(
const
char
*ref)
61
{
62
/* Otherwise there will be no names. */
63
BLI_assert
(
G
.debug &
G_DEBUG_GPU
);
64
Context
*ctx =
Context::get
();
65
if
(ctx ==
nullptr
) {
66
return
false
;
67
}
68
const
DebugStack
&stack = ctx->
debug_stack
;
69
for
(
const
StringRef
&name : stack) {
70
if
(name == ref) {
71
return
true
;
72
}
73
}
74
return
false
;
75
}
BKE_global.h
G_DEBUG_GPU
@ G_DEBUG_GPU
Definition:
BKE_global.h:193
BLI_assert
#define BLI_assert(a)
Definition:
BLI_assert.h:46
BLI_string.h
BLI_snprintf_rlen
size_t BLI_snprintf_rlen(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
GPU_debug.h
blender::StringRef
Definition:
BLI_string_ref.hh:123
blender::Vector< StringRef >
blender::Vector::size
int64_t size() const
Definition:
BLI_vector.hh:694
blender::Vector::pop_last
T pop_last()
Definition:
BLI_vector.hh:729
blender::Vector::append
void append(const T &value)
Definition:
BLI_vector.hh:433
blender::gpu::Context
Definition:
gpu_context_private.hh:28
blender::gpu::Context::debug_stack
DebugStack debug_stack
Definition:
gpu_context_private.hh:49
blender::gpu::Context::debug_group_begin
virtual void debug_group_begin(const char *, int)
Definition:
gpu_context_private.hh:76
blender::gpu::Context::get
static Context * get()
Definition:
gpu_context.cc:82
blender::gpu::Context::debug_group_end
virtual void debug_group_end()
Definition:
gpu_context_private.hh:77
len
int len
Definition:
draw_manager.c:108
gpu_context_private.hh
GPU_debug_group_end
void GPU_debug_group_end()
Definition:
gpu_debug.cc:32
GPU_debug_group_match
bool GPU_debug_group_match(const char *ref)
Definition:
gpu_debug.cc:60
GPU_debug_group_begin
void GPU_debug_group_begin(const char *name)
Definition:
gpu_debug.cc:21
GPU_debug_get_groups_names
void GPU_debug_get_groups_names(int name_buf_len, char *r_name_buf)
Definition:
gpu_debug.cc:42
G
#define G(x, y, z)
blender::gpu
Definition:
gpu_backend.hh:15
blender
Definition:
BKE_action.hh:16
Generated on Sat Jul 27 2024 14:57:55 for Blender by
doxygen
1.9.1