mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
app: analysis script to check for predeleted buffers
This commit is contained in:
47
bin/app/script/analyze.py
Executable file
47
bin/app/script/analyze.py
Executable file
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user