Add the renderer process

The renderer becomes two programs: the adapter (t5deRenderEngine.dll, 32-bit, in IMVU's process) and a 64-bit renderer process (t5de-renderer.exe) drawing with Diligent Engine, fetched with FetchContent and pinned. For now a spike: the adapter starts the renderer process for each engine and signals each frame through a shared memory channel, and the renderer process draws a box into a child window in the client's 3D view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-28 05:17:03 -07:00
1 parent 0d126574bf
commit 9a7d7d2908
18 files changed
+491 -57

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
// The renderer plugin's entry points, which SceneWindow.dll's createDLLRenderer looks up by name (exported
// undecorated by plugin.def). For now the renderer is the pass-through: IMVU's Direct3D engine, wrapped.
#include <windows.h>
#include <exception>
#include "log.hpp"
#include "passthrough_engine.hpp"
#include "renderer_process.hpp"
#include "t5de/imvu/render_engine.hpp"
namespace {
using namespace t5de;
// IMVU's Direct3D 9 engine, made by SceneWindow.dll (already loaded: it's what loads this plugin). Direct3D
// rather than IMVU's OpenGL engine, which needs a real graphics driver: Direct3D also works on Windows' basic
// display driver (virtual machines), and it's what most players use.
imvu::SharedPtr<imvu::PiRenderEngine> create_imvu_engine(imvu::SharedPtr<imvu::INativeWindow> window)
{
HMODULE scene_window = GetModuleHandleW(L"SceneWindow.dll");
auto create = scene_window == nullptr
? nullptr
: reinterpret_cast<imvu::CreateRenderer>(GetProcAddress(scene_window, imvu::createRendererName));
if (create == nullptr) {
log::info("SceneWindow.dll's createRenderer not found");
return {};
}
return create(std::move(window), imvu::RendererType::Direct3D);
}
} // namespace
extern "C" int __cdecl isRenderEngineSupported() { return 1; }
// Returns a C++ object from a C-linkage function: fine here, the caller is C++ built for the same ABI.
#pragma warning(suppress : 4190)
extern "C" imvu::SharedPtr<imvu::PiRenderEngine> __cdecl createRenderEngine(imvu::SharedPtr<imvu::INativeWindow> window)
{
try {
log::info("createRenderEngine: window {}", static_cast<void*>(window.get()));
HWND hwnd = window ? window->getPlatformWindow() : nullptr;
auto inner = create_imvu_engine(std::move(window));
if (!inner) {
return {};
}
auto renderer = hwnd != nullptr ? RendererProcess::start(hwnd) : nullptr;
return imvu::SharedPtr<imvu::PiRenderEngine>(
std::make_unique<PassthroughEngine>(std::move(inner), std::move(renderer)));
} catch (const std::exception& e) {
// Exceptions mustn't cross into IMVU's code (a different C++ runtime).
log::info("createRenderEngine failed: {}", e.what());
return {};
} catch (...) {
log::info("createRenderEngine failed");
return {};
}
}