Draw the client's scene in the renderer process

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]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-28 05:52:15 -07:00
1 parent 5c35c8b63a
commit 42fc55cb91
23 files changed
+2121 -472

No files matched your search

+15 -8
View File
@@ -1,11 +1,12 @@
#pragma once
// The renderer process (t5de-renderer.exe, 64-bit) an engine draws through: started with the engine, told about
// each frame through a shared memory channel (include/t5de/protocol/channel.hpp), and told to exit with it.
// 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 <cstdint>
#include <cstddef>
#include <memory>
#include <span>
#include "t5de/protocol/channel.hpp"
@@ -13,23 +14,29 @@ namespace t5de {
class RendererProcess {
public:
// Starts t5de-renderer.exe from this DLL's folder, drawing into window; null if it can't.
static std::unique_ptr<RendererProcess> start(HWND window);
// 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();
// The client drew a frame.
void frameDrawn();
// 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 frameEvent_ = nullptr;
HANDLE ready_ = nullptr;
HANDLE consumed_ = nullptr;
HANDLE process_ = nullptr;
protocol::Channel* channel_ = nullptr;
std::byte* data_ = nullptr;
bool alive_ = true;
};
} // namespace t5de