Blender V4.3
GPU_debug.hh File Reference
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  blender::gpu::DebugScope
 
struct  blender::gpu::DebugScope::ScopedCapture
 

Namespaces

namespace  blender
 
namespace  blender::gpu
 

Macros

#define GPU_DEBUG_SHADER_COMPILATION_GROUP   "Shader Compilation"
 

Functions

void GPU_debug_group_begin (const char *name)
 
void GPU_debug_group_end ()
 
void GPU_debug_get_groups_names (int name_buf_len, char *r_name_buf)
 
bool GPU_debug_group_match (const char *ref)
 
void GPU_debug_capture_begin (const char *title)
 
void GPU_debug_capture_end ()
 
void * GPU_debug_capture_scope_create (const char *name)
 
bool GPU_debug_capture_scope_begin (void *scope)
 
void GPU_debug_capture_scope_end (void *scope)
 

Detailed Description

Helpers for GPU / drawing debugging.

GPU debug capture usage example:

Instant frame capture.

Will trigger a capture and load it inside RenderDoc or Xcode.

#include "GPU_debug.hh"
void render_function()
{
// Draw-call submission goes here.
}
void GPU_debug_capture_end()
Definition gpu_debug.cc:93
void GPU_debug_capture_begin(const char *title)
Definition gpu_debug.cc:78

Capture scopes.

Capture scope can be sprinkled around the codebase for easier selective capture.

They are listed from inside Xcode (on Mac) when doing a Metal capture.

OpenGL and Vulkan backend need to use the --debug-gpu-scope-capture launch argument to specify which scope to capture. Building with RenderDoc API support is required for this launch option to be available.

They can be nested but only one can be captured at a time.

#include "GPU_debug.hh"
void render_function()
{
static gpu::DebugScope capture_scope = {"UniqueName"};
// Manually triggered version, better for conditional capture.
capture_scope.begin();
// Draw-call submission goes here.
capture_scope.end();
{
// Scoped version, better for complex control flow.
static gpu::DebugScope capture_scope = {"AnotherUniqueName"};
capture_scope.scoped_capture();
// Draw-call submission goes here.
}
}

Definition in file GPU_debug.hh.

Macro Definition Documentation

◆ GPU_DEBUG_SHADER_COMPILATION_GROUP

#define GPU_DEBUG_SHADER_COMPILATION_GROUP   "Shader Compilation"

Function Documentation

◆ GPU_debug_capture_begin()

void GPU_debug_capture_begin ( const char * title)

GPU Frame capture support.

Allows instantaneous frame capture of GPU calls between begin/end.

Parameters
titleOptional title to set for the frame capture.

Definition at line 78 of file gpu_debug.cc.

References blender::gpu::Context::debug_capture_begin(), blender::gpu::Context::debug_is_capturing, G, G_DEBUG_GPU, blender::gpu::Context::get(), and GPU_finish().

Referenced by blender::ed::greasepencil::image_render::image_render_begin(), and blender::gpu::GPUTest::SetUp().

◆ GPU_debug_capture_end()

◆ GPU_debug_capture_scope_begin()

bool GPU_debug_capture_scope_begin ( void * scope)

Used to declare the region within which GPU calls are captured when the scope is triggered.

Parameters
scopePointer to capture scope object created with GPU_debug_capture_scope_create.
Returns
True if the capture tool is actively capturing this scope when function is executed. Otherwise, False.

Definition at line 123 of file gpu_debug.cc.

References blender::gpu::Context::debug_capture_scope_begin(), blender::gpu::Context::debug_is_capturing, G, G_DEBUG_GPU, blender::gpu::Context::get(), and GPU_finish().

Referenced by blender::gpu::DebugScope::begin_capture(), and blender::gpu::DebugScope::ScopedCapture::ScopedCapture().

◆ GPU_debug_capture_scope_create()

void * GPU_debug_capture_scope_create ( const char * name)

GPU debug frame capture scopes.

Allows creation of a GPU frame capture scope that define a region within which an external GPU Frame capture tool can perform a deferred capture of GPU API calls within the boundary upon user request.

Parameters
nameUnique name of capture scope displayed within capture tool.
Returns
pointer wrapping an API-specific capture scope object.
Note
a capture scope should be created a single time and only used within one begin/end pair.

Definition at line 109 of file gpu_debug.cc.

References blender::gpu::Context::debug_capture_scope_create(), G, G_DEBUG_GPU, and blender::gpu::Context::get().

Referenced by blender::gpu::DebugScope::DebugScope().

◆ GPU_debug_capture_scope_end()

◆ GPU_debug_get_groups_names()

void GPU_debug_get_groups_names ( int name_buf_len,
char * r_name_buf )

Return a formatted string showing the current group hierarchy in this format: "Group1 > Group 2 > Group3 > ... > GroupN : "

Definition at line 43 of file gpu_debug.cc.

References BLI_snprintf_rlen(), blender::gpu::Context::debug_stack, blender::gpu::Context::get(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), and len.

Referenced by blender::gpu::debug::debug_callback().

◆ GPU_debug_group_begin()

◆ GPU_debug_group_end()

◆ GPU_debug_group_match()

bool GPU_debug_group_match ( const char * ref)

Return true if inside a debug group with the same name.

Definition at line 61 of file gpu_debug.cc.

References BLI_assert, blender::gpu::Context::debug_stack, G, G_DEBUG_GPU, and blender::gpu::Context::get().

Referenced by blender::gpu::debug::debug_callback().