#pragma once // The renderer process (t5de-renderer.exe, 64-bit) an engine draws through: started with the engine, sent the // command stream through a shared memory channel (include/t5de/protocol/channel.hpp), and told to exit with it. #include #include #include #include #include "t5de/protocol/channel.hpp" namespace t5de { class RendererProcess { public: // Starts t5de-renderer.exe from this DLL's folder, drawing into part of window; null if it can't. static std::unique_ptr start(HWND window, protocol::View view); RendererProcess(const RendererProcess&) = delete; RendererProcess& operator=(const RendererProcess&) = delete; ~RendererProcess(); // Sends commands, in as many chunks as they take; endsFrame marks the end of a frame. False if the renderer // process is gone or stopped taking them (it's then given up on). bool send(std::span commands, bool endsFrame); [[nodiscard]] bool alive() const { return alive_; } private: RendererProcess() = default; HANDLE mapping_ = nullptr; HANDLE ready_ = nullptr; HANDLE consumed_ = nullptr; HANDLE process_ = nullptr; protocol::Channel* channel_ = nullptr; std::byte* data_ = nullptr; bool alive_ = true; }; } // namespace t5de