rd_blend.py 1.3 KB

12345678910111213141516171819202122232425
  1. # every draw with its outputs, fragment textures and the first colour target's blend state
  2. # CAP=<rdc> OUT=<txt> QT_QPA_PLATFORM=xcb DISPLAY=:98 qrenderdoc --python rd_blend.py
  3. import os, renderdoc as rd
  4. out=open(os.environ['OUT'],'w')
  5. cap=rd.OpenCaptureFile(); cap.OpenFile(os.environ['CAP'],'',None)
  6. st,ctl=cap.OpenCapture(rd.ReplayOptions(),None)
  7. texs={t.resourceId:t for t in ctl.GetTextures()}
  8. def desc(r):
  9. t=texs.get(r)
  10. return '%d(%dx%d)'%(int(r),t.width,t.height) if t else str(int(r))
  11. def walk(a):
  12. for c in a:
  13. if c.flags & rd.ActionFlags.Drawcall:
  14. ctl.SetFrameEvent(c.eventId,True)
  15. s=ctl.GetPipelineState()
  16. b=s.GetColorBlends()
  17. bs=[]
  18. for x in b[:1]:
  19. bs.append('en=%d c=%s/%s/%s a=%s/%s/%s mask=%x'%(x.enabled,x.colorBlend.source,x.colorBlend.destination,x.colorBlend.operation,x.alphaBlend.source,x.alphaBlend.destination,x.alphaBlend.operation,x.writeMask))
  20. ro=[desc(x.descriptor.resource) for x in s.GetReadOnlyResources(rd.ShaderStage.Fragment)]
  21. outs=[desc(o) for o in c.outputs if o!=rd.ResourceId.Null()]
  22. out.write('%d n=%d outs=%s tex=%s %s\n'%(c.eventId,c.numIndices,outs,ro,bs))
  23. walk(c.children)
  24. walk(ctl.GetRootActions())
  25. ctl.Shutdown(); cap.Shutdown(); out.close(); os._exit(0)