The blend map reports a quad's SIZE, which identifies an element and says nothing about whether it is visible -- a parked quad is still a draw call. This prints the NDC x/y range and per-vertex colour of every additive draw, per frame, so movement between frames and overlap with the [-1,1] box are readable directly. Written because sylpheed-port flagged exactly that conflation in my blend page: the blend and the visibility arrived in the same artefact. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
53 lines
2.0 KiB
Python
Executable File
53 lines
2.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Where the two rotated sweep strips actually are, per frame, from a draw log.
|
|
|
|
sweep_positions.py <xenia_re_ui_draws_NN.log> [...]
|
|
|
|
The blend map reports a quad's SIZE. That identifies an element and says nothing
|
|
about whether it is on screen: a parked quad is still a draw call. This prints the
|
|
NDC x-range and the per-vertex colour of every 8-vertex ADDITIVE draw, per frame,
|
|
so "submitted" and "visible" stop being the same observation.
|
|
|
|
NDC x is in [-1, +1] across the surface, so a strip overlaps the screen iff
|
|
x_min < 1 and x_max > -1. Movement between frames is the loop running.
|
|
"""
|
|
import re
|
|
import sys
|
|
|
|
VIS_LO, VIS_HI = -1.0, 1.0
|
|
|
|
|
|
def quads(line):
|
|
vs = [(float(a), float(b), c) for a, b, c in
|
|
re.findall(r"\[(-?\d+\.\d+),(-?\d+\.\d+),z=[-\d.]+,col=([0-9A-F]{8})\]", line)]
|
|
return [vs[i:i + 4] for i in range(0, len(vs) - 3, 4)]
|
|
|
|
|
|
def main():
|
|
for path in sys.argv[1:]:
|
|
print("=== %s ===" % path)
|
|
lines = open(path).read().splitlines()
|
|
frame = 0
|
|
print("%-6s %-5s %-6s %-18s %-18s %-8s %s"
|
|
% ("frame", "draw", "quad", "NDC x range", "NDC y range", "col", "on screen?"))
|
|
for i, line in enumerate(lines):
|
|
m = re.match(r"--- frame (\d+) ---", line)
|
|
if m:
|
|
frame = int(m.group(1))
|
|
continue
|
|
m = re.search(r"^\s*(\d+) prim=\d+ indices=(\d+).* blend=0x01010101", line)
|
|
if not m or i + 1 >= len(lines):
|
|
continue
|
|
for k, q in enumerate(quads(lines[i + 1])):
|
|
xs = [p[0] for p in q]
|
|
ys = [p[1] for p in q]
|
|
on = min(xs) < VIS_HI and max(xs) > VIS_LO and min(ys) < VIS_HI and max(ys) > VIS_LO
|
|
print("%-6d %-5s %-6d %7.2f .. %7.2f %7.2f .. %7.2f %-8s %s"
|
|
% (frame, m.group(1), k, min(xs), max(xs), min(ys), max(ys),
|
|
q[0][2], "ON SCREEN" if on else "parked off screen"))
|
|
print()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|