Fix particle sizes, and add tools for comparing renderers
Particles: Direct3D 9's size limit evidently isn't the documented 64 pixels; unclamped (up to 2048) they match the client's renderer. A compare view shows the left half's scene over the right half, both renderers side by side; %TEMP%\t5de-renderer-view.txt switches views and %TEMP%\t5de-renderer-shaders\fixed_function.hlsl replaces the shaders while the client runs. The renderer process runs from a copy, so the program can be replaced meanwhile. The adapter recognizes only the textures and buffers it made (others reach the client renderer unchanged) and logs the others and render targets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
1a45bf9a86
commit
299cd8c312
11 files changed
+239
-28
No files matched your search
@@ -1,14 +1,56 @@
|
||||
#include "resources.hpp"
|
||||
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace t5de {
|
||||
|
||||
namespace {
|
||||
|
||||
// Our live resources, by address.
|
||||
struct Registry {
|
||||
std::mutex mutex;
|
||||
std::unordered_set<const void*> objects;
|
||||
};
|
||||
|
||||
Registry& registry()
|
||||
{
|
||||
static Registry instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void add(const void* object)
|
||||
{
|
||||
const std::scoped_lock lock(registry().mutex);
|
||||
registry().objects.insert(object);
|
||||
}
|
||||
|
||||
void remove(const void* object)
|
||||
{
|
||||
const std::scoped_lock lock(registry().mutex);
|
||||
registry().objects.erase(object);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool ours(const void* object)
|
||||
{
|
||||
if (object == nullptr) {
|
||||
return false;
|
||||
}
|
||||
const std::scoped_lock lock(registry().mutex);
|
||||
return registry().objects.contains(object);
|
||||
}
|
||||
|
||||
Texture::Texture(imvu::PiRenderTexture* inner, std::shared_ptr<Recorder> recorder, std::uint32_t id)
|
||||
: inner_(inner), recorder_(std::move(recorder)), id_(id)
|
||||
{
|
||||
add(static_cast<imvu::PiRenderTexture*>(this));
|
||||
}
|
||||
|
||||
Texture::~Texture()
|
||||
{
|
||||
remove(static_cast<imvu::PiRenderTexture*>(this));
|
||||
delete inner_; // through its virtual destructor: IMVU's code frees it
|
||||
recorder_->destroyTexture(id_);
|
||||
}
|
||||
@@ -32,10 +74,12 @@ imvu::Pixmap* Texture::read(imvu::Pixmap* result) const { return inner_->read(re
|
||||
IndexBuffer::IndexBuffer(imvu::PiInternalIndexBuffer* inner, std::shared_ptr<Recorder> recorder, std::uint32_t id)
|
||||
: inner_(inner), recorder_(std::move(recorder)), id_(id)
|
||||
{
|
||||
add(static_cast<imvu::PiInternalIndexBuffer*>(this));
|
||||
}
|
||||
|
||||
IndexBuffer::~IndexBuffer()
|
||||
{
|
||||
remove(static_cast<imvu::PiInternalIndexBuffer*>(this));
|
||||
delete inner_;
|
||||
recorder_->destroyBuffer(id_);
|
||||
}
|
||||
@@ -43,10 +87,12 @@ IndexBuffer::~IndexBuffer()
|
||||
VertexBuffer::VertexBuffer(imvu::PiInternalVertexBuffer* inner, std::shared_ptr<Recorder> recorder, std::uint32_t id)
|
||||
: inner_(inner), recorder_(std::move(recorder)), id_(id)
|
||||
{
|
||||
add(static_cast<imvu::PiInternalVertexBuffer*>(this));
|
||||
}
|
||||
|
||||
VertexBuffer::~VertexBuffer()
|
||||
{
|
||||
remove(static_cast<imvu::PiInternalVertexBuffer*>(this));
|
||||
delete inner_;
|
||||
recorder_->destroyBuffer(id_);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user