Adds F11 handler to capture RenderDoc frame and nv2a trace output at once.

This commit is contained in:
Erik Abair 2025-04-04 10:32:49 -07:00
parent 43916294ed
commit f8baeb9197
4 changed files with 23 additions and 0 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -28,6 +28,8 @@
#include <stdarg.h>
#include <assert.h>
#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);

View File

@ -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
}