Take output screenshots after the ImGui debugger has drawn

The screenshot readback ran in ScreenManager's post-render callback, and
on Vulkan it ends the backbuffer render step. renderImDebugger() draws
after that, so taking a screenshot with the debugger open made its first
SetViewport() write through a null render step (an assert in debug
builds, a Play crash report in release). Do the readback at the end of
the frame in NativeFrame instead, which also puts the debugger in the
screenshot, and remove the now unused callback.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-25 19:44:21 +01:00
1 parent 2ce1164725
commit 70f205f2ff
3 files changed
+2 -21

No files matched your search

+2 -6
View File
@@ -957,7 +957,6 @@ void NativeClearAchievementsHostOverride() {
});
}
void CallbackPostRender(UIContext *dc, void *userdata);
bool CreateGlobalPipelines();
// TODO: Add faster special case for channels == 2.
@@ -1009,7 +1008,6 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
}
g_screenManager->setUIContext(uiContext);
g_screenManager->setPostRenderCallback(&CallbackPostRender, nullptr);
// Live before the queue is processed: a removal that comes in while the outputs' swapchains are being
// recreated has to wait for the next frame, as its surface may be gone once it returns.
SetOutputsLive(true);
@@ -1188,10 +1186,6 @@ void NativeShutdownGraphics(GraphicsContext *graphicsContext) {
INFO_LOG(Log::System, "NativeShutdownGraphics end");
}
void CallbackPostRender(UIContext *dc, void *userdata) {
ScreenshotNotifyEndOfFrame(dc->GetDrawContext());
}
static void SendMouseDeltaAxis();
void NativeFrame(GraphicsContext *graphicsContext) {
@@ -1405,6 +1399,8 @@ void NativeFrame(GraphicsContext *graphicsContext) {
runImDebugger(g_draw);
});
renderImDebugger(g_draw);
// Last, since the readback ends the backbuffer pass. Nothing can draw after it.
ScreenshotNotifyEndOfFrame(g_draw);
if (g_screenManager->getUIContext()->Text()) {
g_screenManager->getUIContext()->Text()->OncePerFrame();
}