GPU: Better integration with GPU debugging tools #105591

Open
opened 2023-03-09 10:09:10 +01:00 by Jeroen Bakker · 3 comments
Member

Frame capture debugging tools like renderdoc or Xcode can currently
used to capture a full frame. During initial debugging this is fine
but when the cause is found a developer might want to focus on a
specific part of the code.

This proposal would allow better integration with GPU capture tools
using available extensions.

GPU_debug_capture_begin() will start recording a capture.
GPU_debug_capture_end() will stop the recording.

void *GPU_debug_capture_scope_create(const char *name);
bool GPU_debug_capture_scope_begin(void *scope);
bool GPU_debug_capture_scope_end(void *scope);

Where capture scopes define a capturable range within an application
which can be exposed to external tools to define a particular range
within which commands may occur.

The difference being capture begin/end would trigger immediately and
result in capture. Whereas a scope would not trigger a capture, but
allow the user to capture a range within an external tool (e.g. Xcode),
and then the first scope to be hit of the selected type would trigger.

Scopes could be created around certain places e.g. Overlay engine,
EEVEE engine, Workbench engine etc;

Developers can add calls to the functions during debugging to
focus on a specific shader/pass or other area.

This feature should only work when --gpu-debug is enabled as it
requires backend specific features to be enabled.

Benefits

  • Debugging background rendering. (we might also add those calls in the draw
    manager when --gpu-debug is enabled so image rendering issues can also be
    researched by users.
  • Developer can limit the amount of information inside their GPU debugger
    allowing faster debugging.
Frame capture debugging tools like renderdoc or Xcode can currently used to capture a full frame. During initial debugging this is fine but when the cause is found a developer might want to focus on a specific part of the code. This proposal would allow better integration with GPU capture tools using available extensions. `GPU_debug_capture_begin()` will start recording a capture. `GPU_debug_capture_end()` will stop the recording. ``` void *GPU_debug_capture_scope_create(const char *name); bool GPU_debug_capture_scope_begin(void *scope); bool GPU_debug_capture_scope_end(void *scope); ``` Where capture scopes define a capturable range within an application which can be exposed to external tools to define a particular range within which commands may occur. The difference being capture begin/end would trigger immediately and result in capture. Whereas a scope would not trigger a capture, but allow the user to capture a range within an external tool (e.g. Xcode), and then the first scope to be hit of the selected type would trigger. Scopes could be created around certain places e.g. Overlay engine, EEVEE engine, Workbench engine etc; Developers can add calls to the functions during debugging to focus on a specific shader/pass or other area. This feature should only work when `--gpu-debug` is enabled as it requires backend specific features to be enabled. **Benefits** - Debugging background rendering. (we might also add those calls in the draw manager when `--gpu-debug` is enabled so image rendering issues can also be researched by users. - Developer can limit the amount of information inside their GPU debugger allowing faster debugging.
Jeroen Bakker added this to the 3.6 LTS milestone 2023-03-09 10:09:10 +01:00
Jeroen Bakker added the
Type
Design
label 2023-03-09 10:09:10 +01:00
Jeroen Bakker added this to the EEVEE & Viewport project 2023-03-09 10:09:11 +01:00
Jeroen Bakker changed title from GPU: Better integration with frame capture tools to GPU: Better integration with GPU debugging tools 2023-03-09 10:13:51 +01:00

Looks good, I can submit a PR with an initial implementation supporting capture in the Metal backend, with placeholders for other APIs.

I would also propose the following extension:

Capture Scopes
void *GPU_debug_capture_scope_create(const char *name);
bool GPU_debug_capture_scope_begin(void *scope);
bool GPU_debug_capture_scope_end(void *scope);

Where capture scopes define a capturable range within an application which can be exposed to external tools to define a particular range within which commands may occur.

The difference being capture begin/end would trigger immediately and result in capture. Whereas a scope would not trigger a capture, but allow the user to capture a range within an external tool (e.g. Xcode), and then the first scope to be hit of the selected type would trigger.

Scopes could be created around certain places e.g. Overlay engine, EEVEE engine, Workbench engine etc;

Looks good, I can submit a PR with an initial implementation supporting capture in the Metal backend, with placeholders for other APIs. I would also propose the following extension: ###### Capture Scopes ``` void *GPU_debug_capture_scope_create(const char *name); bool GPU_debug_capture_scope_begin(void *scope); bool GPU_debug_capture_scope_end(void *scope); ``` Where capture scopes define a capturable range within an application which can be exposed to external tools to define a particular range within which commands may occur. The difference being capture begin/end would trigger immediately and result in capture. Whereas a scope would not trigger a capture, but allow the user to capture a range within an external tool (e.g. Xcode), and then the first scope to be hit of the selected type would trigger. Scopes could be created around certain places e.g. Overlay engine, EEVEE engine, Workbench engine etc;
Author
Member

These might be similar to

void GPU_debug_group_begin(const char *name);
void GPU_debug_group_end(void);

This is used by the Blender in multiple places to organize the calls in a hierarchy.
image

I do like the naming of GPU_debug_capture_scope_*

These might be similar to ``` void GPU_debug_group_begin(const char *name); void GPU_debug_group_end(void); ``` This is used by the Blender in multiple places to organize the calls in a hierarchy. ![image](/attachments/77bd6d59-f558-492b-a1a2-c00d13fd9ad1) I do like the naming of `GPU_debug_capture_scope_*`

Debug groups are great for naming regions within a captured frame, a capture scope would likely be a temporary insertion similar to calling begin/end() Which do the same thing as capture begin/end but allow triggering and capturing of that region from the tools, rather than instantaneously in the code.

Which may be useful if for example you need to defer an EEVEE frame capture until you have loaded up a specific file, or configured the scene in a particular way for example.

Debug groups are great for naming regions within a captured frame, a capture scope would likely be a temporary insertion similar to calling begin/end() Which do the same thing as capture begin/end but allow triggering and capturing of that region from the tools, rather than instantaneously in the code. Which may be useful if for example you need to defer an EEVEE frame capture until you have loaded up a specific file, or configured the scene in a particular way for example.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105591
No description provided.