Draw particles, match the client's fog, and measure frame delay

Particles (point sprites) are drawn as instanced camera-facing squares sized like Direct3D 9's. Fog is by depth buffer value, as Direct3D 9 does with IMVU's projections. At most one frame is queued for display, frames carry the adapter's timestamp so the renderer process logs the delay to presenting, and the log's lines from several processes no longer mix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-28 06:11:51 -07:00
1 parent 42fc55cb91
commit a04dba18c1
12 files changed
+293 -90

No files matched your search

+17 -2
View File
@@ -1,5 +1,7 @@
#include "engine.hpp"
#include <windows.h>
#include <bit>
#include <cmath>
#include <cstring>
@@ -234,7 +236,9 @@ void Engine::beginRendering(imvu::PiRenderTarget* target)
void Engine::endRendering()
{
inner_->endRendering();
recorder_->add(Op::EndFrame, protocol::EndFrame{});
LARGE_INTEGER now;
QueryPerformanceCounter(&now);
recorder_->add(Op::EndFrame, protocol::EndFrame{static_cast<std::uint64_t>(now.QuadPart)});
recorder_->flush(true);
++frames_;
}
@@ -250,7 +254,18 @@ void Engine::drawTriangles(imvu::PiInternalIndexBuffer* indices, imvu::PiInterna
void Engine::drawLine(imvu::Vec3f from, imvu::Vec3f to, imvu::Color color) { inner_->drawLine(from, to, color); }
void Engine::drawPointSprites(const imvu::PointSpriteVector& sprites) { inner_->drawPointSprites(sprites); }
void Engine::drawPointSprites(const imvu::PointSpriteVector& sprites)
{
inner_->drawPointSprites(sprites);
if (sprites.first == nullptr || sprites.last <= sprites.first) {
return;
}
const auto count = static_cast<std::uint32_t>(sprites.last - sprites.first);
if (std::byte* payload = recorder_->add(Op::DrawPointSprites, protocol::DrawPointSprites{count},
std::size_t{count} * sizeof(imvu::PointSprite))) {
std::memcpy(payload, sprites.first, std::size_t{count} * sizeof(imvu::PointSprite));
}
}
void Engine::drawTrianglesFromMemory(std::uint32_t vertexCount, std::uint32_t indexCount,
const std::uint16_t* indices,