Section arena in pages; graphics docs and benchmark comparison

At render distance 32 the single section arena grew past the 4 GiB buffer
limit and the renderer panicked. Sections now live in pages of at most
256 MiB (or the device's buffer limit); draws keep their order and bind each
page once per run of consecutive draws in it, so translucent sections stay
back to front. docs/graphics.md describes the settings, the benchmark and
what changed; graphics_bench.py --compare prints a before/after table and
keeps each game's log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-13 17:10:07 +02:00
parent ad9cd6c67e
commit 7f1e197428
19 changed files with 366 additions and 130 deletions
+29
View File
@@ -116,9 +116,33 @@ def run_distance(args, ctl, env, cwd, distance):
if not socket.exists():
break
time.sleep(0.2)
# Keep each game's log (a crash or a slow-frame report) per run.
log = socket.with_suffix(".log")
if log.exists():
shutil.copy(log, cwd / f"{args.label}-rd{distance}.log")
return results
def compare(before, after):
"""A markdown table of two saved runs (labels under benchmarks/graphics)."""
load = lambda label: json.loads((ROOT / "benchmarks/graphics" / f"{label}.json").read_text())
a, b = load(before), load(after)
print(f"| RD | scene | avg FPS | 1% low FPS | p99 ms | CPU ms/frame | GPU ms/frame |")
print("| --- | --- | --- | --- | --- | --- | --- |")
cell = lambda x, y, f: f"{f(x)} → {f(y)}"
for rd, scenes in a["distances"].items():
for name, old in scenes.items():
new = b["distances"].get(rd, {}).get(name)
if name == "renderer" or not new:
continue
ms = lambda v, k: (v.get(k) or {}).get("avg_ms") or 0
print(f"| {rd} | {name} | {cell(old['avg_fps'], new['avg_fps'], lambda v: f'{v:.0f}')} "
f"| {cell(old['low_1pct_fps'], new['low_1pct_fps'], lambda v: f'{v:.1f}')} "
f"| {cell(old['p99_ms'], new['p99_ms'], lambda v: f'{v:.0f}')} "
f"| {cell(ms(old, 'cpu'), ms(new, 'cpu'), lambda v: f'{v:.1f}')} "
f"| {cell(ms(old, 'gpu'), ms(new, 'gpu'), lambda v: f'{v:.2f}')} |")
def main():
p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
p.add_argument("--label", default="run")
@@ -130,7 +154,12 @@ def main():
p.add_argument("--resources", default=str(ROOT / ".local/horizon-client/26.3"))
p.add_argument("--build", default=str(ROOT / "target/release"))
p.add_argument("--out", help="JSON file (default benchmarks/graphics/<label>.json)")
p.add_argument("--compare", nargs=2, metavar=("BEFORE", "AFTER"),
help="print a markdown table comparing two saved runs, and exit")
args = p.parse_args()
if args.compare:
compare(*args.compare)
return
ctl = Path(args.build).resolve() / "horizon-ctl"
if not ctl.exists():
sys.exit(f"{ctl} missing: cargo build --release -p horizon-client --bins")