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

+38
View File
@@ -8,12 +8,20 @@ namespace {
using Getter = unsigned(__thiscall*)(const imvu::Pixmap*);
using PixelsGetter = std::uint32_t*(__thiscall*)(const imvu::Pixmap*);
using SizeConstructor = imvu::Pixmap*(__thiscall*)(void*, int, int);
using DefaultConstructor = imvu::Pixmap*(__thiscall*)(void*);
using CopyConstructor = imvu::Pixmap*(__thiscall*)(void*, const imvu::Pixmap*);
using Destructor = void(__thiscall*)(imvu::Pixmap*);
struct Methods {
Getter width = nullptr;
Getter height = nullptr;
Getter rowBytes = nullptr;
PixelsGetter pixels = nullptr;
SizeConstructor construct = nullptr;
DefaultConstructor constructEmpty = nullptr;
CopyConstructor copy = nullptr;
Destructor destroy = nullptr;
};
const Methods& methods()
@@ -25,6 +33,10 @@ const Methods& methods()
found.height = reinterpret_cast<Getter>(GetProcAddress(module, "?height@Pixmap@@QBEIXZ"));
found.rowBytes = reinterpret_cast<Getter>(GetProcAddress(module, "?rowBytes@Pixmap@@QBEIXZ"));
found.pixels = reinterpret_cast<PixelsGetter>(GetProcAddress(module, "?pixels@Pixmap@@QBEPAIXZ"));
found.construct = reinterpret_cast<SizeConstructor>(GetProcAddress(module, "??0Pixmap@@QAE@HH@Z"));
found.constructEmpty = reinterpret_cast<DefaultConstructor>(GetProcAddress(module, "??0Pixmap@@QAE@XZ"));
found.copy = reinterpret_cast<CopyConstructor>(GetProcAddress(module, "??0Pixmap@@QAE@ABV0@@Z"));
found.destroy = reinterpret_cast<Destructor>(GetProcAddress(module, "??1Pixmap@@QAE@XZ"));
}
return found;
}();
@@ -42,4 +54,30 @@ std::optional<PixmapPixels> pixmap_pixels(const imvu::Pixmap& pixmap)
return PixmapPixels{m.width(&pixmap), m.height(&pixmap), m.rowBytes(&pixmap), m.pixels(&pixmap)};
}
OwnedPixmap::OwnedPixmap(int width, int height)
{
const Methods& m = methods();
if (m.construct != nullptr && m.constructEmpty != nullptr && m.copy != nullptr && m.destroy != nullptr) {
m.construct(storage_, width, height);
valid_ = true;
}
}
OwnedPixmap::~OwnedPixmap()
{
if (valid_) {
methods().destroy(reinterpret_cast<imvu::Pixmap*>(storage_));
}
}
imvu::Pixmap* OwnedPixmap::copyTo(imvu::Pixmap* result) const
{
const Methods& m = methods();
if (valid_) {
return m.copy(result, &get());
}
// Without pixmap.dll's methods there's nothing to construct one with (IMVU's own code would have failed already).
return m.constructEmpty != nullptr ? m.constructEmpty(result) : result;
}
} // namespace t5de