Files
AyeZeeBB 164fdffbd0 Descriptor heaps: dense custom maps no longer overflow the GPU's descriptor heap and crash it
The renderer gives each frame 131,072 shader-visible descriptors past a persistent 120,000, in
heaps of 333,333. Dense custom maps (the Los Santos City sublevels, San Andreas) draw more than
that in a frame, and the renderer wrote past the end of the heap: shaders read garbage
descriptors, which faulted or hung the GPU (page faults at nonsense addresses, in draws, texture
fetches and ray tracing alike). ReSkate now patches the device setup at boot so each heap is
D3D12's 1,000,000 and a frame may use 524,288; heaps are 644,288 descriptors. LS-B2, LS-B3 and
San Andreas (210,000 a frame at its peak) now hold.

Also in this change:
- Memory: perf memory owners/heap/gpu/report, a ledger of who commits the game's RAM; the
  render-resource pool no longer allocates its 115 MB twice; the EadpErrorsData arena is
  capped at 32 MiB (EA's error reporting is blocked anyway).
- Crash reports: tagged with the map, destination, graphics card and driver version (protocol
  v3), so Sentry can group GPU hangs by map and card.
- GPU diagnostics (--gpu-diagnostics): a fuller DRED report, the device-removal and video
  memory watches, a large-draw watch, a record of which game code made and freed each GPU heap
  and resource, checks of every GPU address bound, and a meter of each descriptor heap's use.
- World pools: peak use of entity pages, render instances and spatial blocks in the log.
- dingosdk_mod_mesh_check: checks every MeshSet a mod ships against its geometry; the MeshSet
  reader now knows static meshes' layout.
2026-10-15 13:57:11 -05:00

42 lines
2.1 KiB
C++

#pragma once
#include <cstdint>
#include <filesystem>
#include <functional>
#include <string>
// Who owns the memory the process holds, and how much of it is used (`perf memory owners`).
// While it is on, every reservation of memory from Windows is noted with the code that asked
// for it, and forgotten when it is given back; a report then joins what the process holds now
// with who made it: what is committed, what of that is in RAM, and what is in RAM but all zero.
// A minute at a time it also looks for an owner whose memory only grows, and says so in the log.
// It is a research aid and off until asked for: every allocation in the process passes it.
namespace dingosdk::memory_ledger {
using Line = std::function<void(const std::string&)>;
// Starts noting reservations. What was made before is reported as not seen being made.
bool start(std::string& error);
bool on() noexcept;
// `perf memory trace`: also counts what is asked for (commits too) of sizes in [least, most]
// by who asked, from now on. Starts the ledger if it is off.
bool start_asking(std::uint64_t least, std::uint64_t most, std::string& error);
void stop_asking() noexcept;
bool asking() noexcept;
void asked_report(const Line& out);
// What the process holds by owner and by caller (the ledger is started if it is off).
// `most` callers are listed, each with its stack.
void owners_report(const Line& out, std::size_t most = 12);
// The process's heaps: what each holds and has free inside it, and its blocks by size; with
// `mark`, the sizes are remembered and the next report says what was added since.
void heap_report(const Line& out, bool mark, std::size_t most = 20);
// Video memory and the system memory the GPU uses for this process, one line per adapter.
void gpu_report(const Line& out);
// Everything above at length, into memory-<time>.txt beside ReSkate.log.
std::filesystem::path write_report();
// For the periodic "Memory:" log line: the largest owners, as the leak watcher last saw them
// (empty while the ledger is off), and the GPU's use.
std::string owners_line();
std::string gpu_line();
}