The adapter records everything the client draws (state, transforms, lights, fog, textures and buffers) as a command stream, sent in chunks through the shared memory channel, while IMVU's Direct3D renderer still draws the whole view. The renderer process draws it with Diligent, with shaders reproducing IMVU's Direct3D 9 fixed-function setup, over the right half of the 3D view to compare. It skips to the newest frame when it falls behind, and logs its errors and frame times. Co-Authored-By: Claude Opus 5.5 <[email protected]>
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#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 <windows.h>
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
#include <span>
|
|
|
|
#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<RendererProcess> 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<const std::byte> 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
|