analyze.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/python
  2. from traxator import *
  3. import sys
  4. if len(sys.argv) != 2:
  5. print("wrong args", file=sys.stderr)
  6. sys.exit(-1)
  7. fname = sys.argv[1]
  8. epoch = 1
  9. sections = read_trax(fname)
  10. def check(id, i):
  11. for j, sect in enumerate(sections):
  12. if j >= i:
  13. break
  14. match sect:
  15. case DelBuf(epoch, buf, tag, buftype, stat):
  16. assert buf != id
  17. def checktex(id, i):
  18. for j, sect in enumerate(sections):
  19. if j >= i:
  20. break
  21. match sect:
  22. case DelTex(epoch, buf, tag, stat):
  23. assert buf != id
  24. for i, sect in enumerate(sections):
  25. match sect:
  26. case PutDrawCall(_, _, dcs, stats):
  27. for dc in dcs:
  28. #print(f"DrawCall {dc.dc_id}")
  29. for (i, instr) in enumerate(dc.instrs):
  30. match instr:
  31. case Draw(vert_id, ve, _, _, idx_id, ie, _, _, tex, _):
  32. assert ve == ie
  33. if ve != epoch:
  34. continue
  35. if tex:
  36. (tex_id, _, _) = tex
  37. checktex(tex_id, i)
  38. check(vert_id, i)
  39. check(idx_id, i)