Ui, project: the screenshot through CaptureNextFrame; the libraries pinned

Crafter.Graphics 079b6b0 replaced SaveFrame with CaptureNextFrame, and
the app no longer built against its master. The copy is now recorded
into the next frame before it is presented, where SaveFrame read back
an image already handed to the display (validation reported both the
layout transition and the missing acquire). The capture is armed first,
so the Update that follows draws the frame and writes the file; a file
the library cannot write (it throws from the Update) is logged and ends
the run with exit 1.

project.cpp pins Crafter.Graphics at 079b6b0 and Crafter.DB at bfd0cc2:
a commit of either library must not change a build without a commit
here. --local builds both from the sibling checkouts, now that the input
branch is merged.
This commit is contained in:
Jorijn van der Graaf 2026-10-20 23:15:25 +02:00
commit e413632668
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
3 changed files with 24 additions and 12 deletions

View file

@ -91,10 +91,18 @@ export namespace ImsdMessages::Ui {
static gboolean OnScreenshot(gpointer data) {
App& self = *static_cast<App*>(data);
if (self.canvas) {
self.canvas->Window().Update();
self.canvas->Window().SaveFrame(self.screenshotPath);
self.Log(std::format("screenshot written to {} ({}x{} px)", self.screenshotPath.string(), self.canvas->Window().width, self.canvas->Window().height));
self.exitCode = 0; // a failure until written (main)
try {
self.canvas->Window().CaptureNextFrame(self.screenshotPath);
self.canvas->Window().Update();
self.Log(std::format("screenshot written to {} ({}x{} px)", self.screenshotPath.string(), self.canvas->Window().width, self.canvas->Window().height));
self.exitCode = 0; // a failure until written (main)
} catch (const std::exception& e) {
// The library throws when the capture fails (a Vulkan call,
// the PNG's write): the bench learns it from the log and the
// exit status.
self.Log(std::format("screenshot not written to {}: {}", self.screenshotPath.string(), e.what()));
self.exitCode = 1;
}
} else {
// No window to render it — none could be made, or it went
// between the request and the capture: logged, and the run