Draw render targets in the renderer process
CI / build (push) Successful in 48s

While the renderer process runs, the adapter makes the client's render targets
itself and the renderer process draws frames into them: texture targets are
drawn with like any texture, and a pixmap target's frame is read back through
the channel into its Pixmap (protocol version 4: BeginFrame names its target,
CreateRenderTarget, Channel::readSize and the -read event). Frames into render
targets are drawn even while the window is hidden.

The client uses pixmap targets for snapshots (outfit pictures, photos), checked
to look right. The render target interfaces are declared from IMVU's vtables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-28 19:09:48 -07:00
1 parent fa883892db
commit 6e4fe589e5
18 files changed
+523 -58

No files matched your search

+10 -2
View File
@@ -184,12 +184,13 @@ int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
HANDLE ready = OpenEventW(SYNCHRONIZE, FALSE, (arguments.channel + t5de::protocol::readyEventSuffix).c_str());
HANDLE consumed =
OpenEventW(EVENT_MODIFY_STATE, FALSE, (arguments.channel + t5de::protocol::consumedEventSuffix).c_str());
HANDLE read = OpenEventW(EVENT_MODIFY_STATE, FALSE, (arguments.channel + t5de::protocol::readEventSuffix).c_str());
HANDLE parent = OpenProcess(SYNCHRONIZE, FALSE, arguments.parent);
if (channel == nullptr || ready == nullptr || consumed == nullptr || parent == nullptr
if (channel == nullptr || ready == nullptr || consumed == nullptr || read == nullptr || parent == nullptr
|| channel->version != t5de::protocol::version) {
return 3;
}
const auto* data = reinterpret_cast<const std::byte*>(channel + 1);
auto* data = reinterpret_cast<std::byte*>(channel + 1);
const HWND clientWindow = reinterpret_cast<HWND>(static_cast<std::uintptr_t>(channel->window));
const HWND window = create_child_window(clientWindow);
@@ -227,6 +228,13 @@ int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
return 6;
}
t5de::Scene scene(device, context, swapChain);
// Frames read back: the adapter waits for them, sending nothing meanwhile, so the data area is free.
scene.setReadBack([&](std::span<const std::byte> pixels) {
const std::size_t size = pixels.size() <= channel->capacity ? pixels.size() : 0;
std::memcpy(data, pixels.data(), size);
channel->readSize = static_cast<std::uint32_t>(size);
SetEvent(read);
});
// Takes the chunk waiting in the channel (after "ready"), and lets the adapter send the next: appends it to
// frame, and returns whether it ends a frame.