rd_actions.py 1.1 KB

12345678910111213141516171819202122
  1. import os, renderdoc as rd
  2. out=open(os.environ['OUT'],'w')
  3. cap=rd.OpenCaptureFile(); cap.OpenFile(os.environ['CAP'],'',None)
  4. st,ctl=cap.OpenCapture(rd.ReplayOptions(),None)
  5. texs={t.resourceId:t for t in ctl.GetTextures()}
  6. names={r.resourceId:r.name for r in ctl.GetResources()}
  7. out.write('TEXTURES mips>1:\n')
  8. for t in texs.values():
  9. if t.mips>1 and t.width>=256: out.write(' %s %s %dx%d mips=%d fmt=%s\n'%(t.resourceId,names.get(t.resourceId),t.width,t.height,t.mips,t.format.Name()))
  10. def walk(a,d=0):
  11. for c in a:
  12. flags=c.flags
  13. outs=[str(o) for o in c.outputs if o!=rd.ResourceId.Null()]
  14. nm=c.GetName(ctl.GetStructuredFile())
  15. if not (flags & rd.ActionFlags.Drawcall) or os.environ.get('ALL'):
  16. out.write('%s%d %s outs=%s copySrc=%s copyDst=%s\n'%(' '*d,c.eventId,nm,outs,c.copySource,c.copyDestination))
  17. else:
  18. out.write('%s%d DRAW %s n=%d outs=%s\n'%(' '*d,c.eventId,nm,c.numIndices,outs))
  19. walk(c.children,d+1)
  20. walk(ctl.GetRootActions())
  21. ctl.Shutdown(); cap.Shutdown()
  22. out.close(); os._exit(0)