Polyphase Game Engine
Loading...
Searching...
No Matches
EditorScreenshot.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include <cstdint>
6#include <future>
7#include <memory>
8#include <string>
9#include <vector>
10
11// One-shot capture of the entire editor swapchain image (Game Preview viewport
12// plus all imgui chrome — inspector, hierarchy, debug log, etc.). Vulkan-only.
13//
14// Threading: RequestEditorScreenshot can be called from any thread (the REST
15// route handler runs on Crow's I/O thread). ProcessPendingEditorScreenshots
16// must be called from the render thread, after the editor frame is rendered
17// to the swapchain but before vkQueuePresent.
18
19struct EditorScreenshotData
20{
21 bool mOk = false;
22 std::vector<uint8_t> mRgba; // tightly packed RGBA, top-to-bottom
23 uint32_t mWidth = 0;
24 uint32_t mHeight = 0;
25 std::string mError;
26};
27
28void RequestEditorScreenshot(std::shared_ptr<std::promise<EditorScreenshotData>> promise);
29
30void ProcessPendingEditorScreenshots();
31
32#endif