diff --git a/hw/xbox/nv2a/debug.h b/hw/xbox/nv2a/debug.h index 3873f94239..e32d0c886d 100644 --- a/hw/xbox/nv2a/debug.h +++ b/hw/xbox/nv2a/debug.h @@ -156,7 +156,9 @@ void nv2a_dbg_renderdoc_init(void); void *nv2a_dbg_renderdoc_get_api(void); bool nv2a_dbg_renderdoc_available(void); void nv2a_dbg_renderdoc_capture_frames(int num_frames); +void nv2a_dbg_renderdoc_trace_frames(int num_frames); extern int renderdoc_capture_frames; +extern int renderdoc_trace_frames; #endif #ifdef __cplusplus diff --git a/hw/xbox/nv2a/pgraph/debug_renderdoc.c b/hw/xbox/nv2a/pgraph/debug_renderdoc.c index 273e307973..30ecd33f10 100644 --- a/hw/xbox/nv2a/pgraph/debug_renderdoc.c +++ b/hw/xbox/nv2a/pgraph/debug_renderdoc.c @@ -36,6 +36,7 @@ static RENDERDOC_API_1_6_0 *rdoc_api = NULL; int renderdoc_capture_frames = 0; +int renderdoc_trace_frames = 0; void nv2a_dbg_renderdoc_init(void) { @@ -93,3 +94,8 @@ void nv2a_dbg_renderdoc_capture_frames(int num_frames) { renderdoc_capture_frames += num_frames; } + +void nv2a_dbg_renderdoc_trace_frames(int num_frames) { + renderdoc_capture_frames += num_frames; + renderdoc_trace_frames += num_frames; +} \ No newline at end of file diff --git a/hw/xbox/nv2a/pgraph/gl/debug.c b/hw/xbox/nv2a/pgraph/gl/debug.c index 43575b4e1d..083c3562c3 100644 --- a/hw/xbox/nv2a/pgraph/gl/debug.c +++ b/hw/xbox/nv2a/pgraph/gl/debug.c @@ -28,6 +28,8 @@ #include #include +#include "trace/control.h" + #ifdef CONFIG_RENDERDOC #pragma GCC diagnostic ignored "-Wstrict-prototypes" #include "thirdparty/renderdoc_app.h" @@ -257,6 +259,15 @@ void gl_debug_frame_terminator(void) "Renderdoc EndFrameCapture triggered GL error 0x%X - ignoring\n", error); } + + if (renderdoc_trace_frames > 0) { + if (--renderdoc_trace_frames == 0) { + trace_enable_events("-nv2a_pgraph_*"); + } + } + } + if (renderdoc_trace_frames > 0) { + trace_enable_events("nv2a_pgraph_*"); } if (renderdoc_capture_frames > 0) { rdoc_api->StartFrameCapture(NULL, NULL); diff --git a/ui/xui/menubar.cc b/ui/xui/menubar.cc index 3e6499a46e..e1ab5a480b 100644 --- a/ui/xui/menubar.cc +++ b/ui/xui/menubar.cc @@ -89,6 +89,10 @@ void ProcessKeyboardShortcuts(void) if (ImGui::IsKeyPressed(ImGuiKey_F10) && nv2a_dbg_renderdoc_available()) { nv2a_dbg_renderdoc_capture_frames(1); } + + if (ImGui::IsKeyPressed(ImGuiKey_F11) && nv2a_dbg_renderdoc_available()) { + nv2a_dbg_renderdoc_trace_frames(1); + } #endif }