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]>
31 lines
1023 B
C++
31 lines
1023 B
C++
#include "log.hpp"
|
|
|
|
#include <windows.h>
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
|
|
namespace t5de::log {
|
|
|
|
// Each line is one appending write, so lines from several processes don't mix.
|
|
void write(std::string_view line)
|
|
{
|
|
static const HANDLE file = [] {
|
|
wchar_t temp[MAX_PATH + 1];
|
|
const DWORD length = GetTempPathW(MAX_PATH + 1, temp);
|
|
if (length == 0 || length > MAX_PATH) {
|
|
return INVALID_HANDLE_VALUE;
|
|
}
|
|
return CreateFileW((std::filesystem::path(temp) / L"t5de-renderer-process.log").c_str(), FILE_APPEND_DATA,
|
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_ALWAYS,
|
|
FILE_ATTRIBUTE_NORMAL, nullptr);
|
|
}();
|
|
if (file != INVALID_HANDLE_VALUE) {
|
|
const std::string text = std::format("{}: {}\n", GetCurrentProcessId(), line);
|
|
DWORD written = 0;
|
|
WriteFile(file, text.data(), static_cast<DWORD>(text.size()), &written, nullptr);
|
|
}
|
|
}
|
|
|
|
} // namespace t5de::log
|