diff --git a/bin/app/script/analyze.py b/bin/app/script/analyze.py new file mode 100755 index 000000000..32b0bd7d8 --- /dev/null +++ b/bin/app/script/analyze.py @@ -0,0 +1,47 @@ +#!/usr/bin/python +from traxator import * +import sys + +if len(sys.argv) != 2: + print("wrong args", file=sys.stderr) + sys.exit(-1) +fname = sys.argv[1] + +epoch = 1 + +sections = read_trax(fname) + +def check(id, i): + for j, sect in enumerate(sections): + if j >= i: + break + match sect: + case DelBuf(epoch, buf, tag, buftype, stat): + assert buf != id + +def checktex(id, i): + for j, sect in enumerate(sections): + if j >= i: + break + match sect: + case DelTex(epoch, buf, tag, stat): + assert buf != id + + +for i, sect in enumerate(sections): + match sect: + case PutDrawCall(_, _, dcs, stats): + for dc in dcs: + #print(f"DrawCall {dc.dc_id}") + for (i, instr) in enumerate(dc.instrs): + match instr: + case Draw(vert_id, ve, _, _, idx_id, ie, _, _, tex, _): + assert ve == ie + if ve != epoch: + continue + if tex: + (tex_id, _, _) = tex + checktex(tex_id, i) + check(vert_id, i) + check(idx_id, i) + diff --git a/bin/app/script/traxator.py b/bin/app/script/traxator.py index 18bac2bd2..8ec083bc5 100755 --- a/bin/app/script/traxator.py +++ b/bin/app/script/traxator.py @@ -3,6 +3,7 @@ from pydrk import serial from collections import namedtuple from dataclasses import dataclass from typing import Union +import sys @dataclass class SetScale: @@ -280,8 +281,8 @@ def read_section(f): return sect -def read_trax(): - f = open("trax.dat", "rb") +def read_trax(fname): + f = open(fname, "rb") sections = [] while True: if (sect := read_section(f)) is None: @@ -290,7 +291,11 @@ def read_trax(): return sections if __name__ == "__main__": - sections = read_trax() + if len(sys.argv) != 2: + print("wrong args", file=sys.stderr) + sys.exit(-1) + fname = sys.argv[1] + sections = read_trax(fname) for sect in sections: print(sect) diff --git a/bin/app/script/view.py b/bin/app/script/view.py index 8d97c3a16..e56bc3b27 100755 --- a/bin/app/script/view.py +++ b/bin/app/script/view.py @@ -6,7 +6,7 @@ dc_id = 2767617242841734550 vert_id = 39568 idx_id = 39569 -sections = read_trax() +sections = read_trax("trax.dat") for sect in sections: match sect: case PutDrawCall(_, _, dcs, stats):