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]>
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
#include "resources.hpp"
|
|
|
|
namespace t5de {
|
|
|
|
Texture::Texture(imvu::PiRenderTexture* inner, std::shared_ptr<Recorder> recorder, std::uint32_t id)
|
|
: inner_(inner), recorder_(std::move(recorder)), id_(id)
|
|
{
|
|
}
|
|
|
|
Texture::~Texture()
|
|
{
|
|
delete inner_; // through its virtual destructor: IMVU's code frees it
|
|
recorder_->destroyTexture(id_);
|
|
}
|
|
|
|
imvu::Vec2i Texture::size() const { return inner_->size(); }
|
|
|
|
void Texture::updateRegions(const imvu::Pixmap& pixmap, const imvu::CompoundRegion& regions)
|
|
{
|
|
inner_->updateRegions(pixmap, regions);
|
|
recorder_->updateTexture(id_, pixmap); // all of it: the regions' layout isn't known
|
|
}
|
|
|
|
void Texture::update(const imvu::Pixmap& pixmap)
|
|
{
|
|
inner_->update(pixmap);
|
|
recorder_->updateTexture(id_, pixmap);
|
|
}
|
|
|
|
imvu::Pixmap* Texture::read(imvu::Pixmap* result) const { return inner_->read(result); }
|
|
|
|
IndexBuffer::IndexBuffer(imvu::PiInternalIndexBuffer* inner, std::shared_ptr<Recorder> recorder, std::uint32_t id)
|
|
: inner_(inner), recorder_(std::move(recorder)), id_(id)
|
|
{
|
|
}
|
|
|
|
IndexBuffer::~IndexBuffer()
|
|
{
|
|
delete inner_;
|
|
recorder_->destroyBuffer(id_);
|
|
}
|
|
|
|
VertexBuffer::VertexBuffer(imvu::PiInternalVertexBuffer* inner, std::shared_ptr<Recorder> recorder, std::uint32_t id)
|
|
: inner_(inner), recorder_(std::move(recorder)), id_(id)
|
|
{
|
|
}
|
|
|
|
VertexBuffer::~VertexBuffer()
|
|
{
|
|
delete inner_;
|
|
recorder_->destroyBuffer(id_);
|
|
}
|
|
|
|
void VertexBuffer::update(const void* data, std::uint32_t stride, std::uint32_t elementSize, std::uint32_t elementCount)
|
|
{
|
|
inner_->update(data, stride, elementSize, elementCount);
|
|
recorder_->updateBuffer(id_, data, stride, elementSize, elementCount);
|
|
}
|
|
|
|
void VertexBuffer::unknown2() { inner_->unknown2(); }
|
|
|
|
} // namespace t5de
|