MCPcopy Create free account
hub / github.com/baldurk/renderdoc / sampleCode

Function sampleCode

docs/python_api/examples/renderdoc/iter_actions.py:19–59  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

17 iterAction(d, indent + ' ')
18
19def sampleCode(controller):
20 # Iterate over all of the root actions
21 for d in controller.GetRootActions():
22 iterAction(d)
23
24 # Start iterating from the first real action as a child of markers
25 action = controller.GetRootActions()[0]
26
27 while len(action.children) > 0:
28 action = action.children[0]
29
30 # Counter for which pass we're in
31 passnum = 0
32 # Counter for how many actions are in the pass
33 passcontents = 0
34 # Whether we've started seeing actions in the pass - i.e. we're past any
35 # starting clear calls that may be batched together
36 inpass = False
37
38 print("Pass #0 starts with %d: %s" % (action.eventId, action.GetName(controller.GetStructuredFile())))
39
40 while action != None:
41 # When we encounter a clear
42 if action.flags & rd.ActionFlags.Clear:
43 if inpass:
44 print("Pass #%d contained %d actions" % (passnum, passcontents))
45 passnum += 1
46 print("Pass #%d starts with %d: %s" % (passnum, action.eventId, action.GetName(controller.GetStructuredFile())))
47 passcontents = 0
48 inpass = False
49 else:
50 passcontents += 1
51 inpass = True
52
53 # Advance to the next action
54 action = action.next
55 if action is None:
56 break
57
58 if inpass:
59 print("Pass #%d contained %d actions" % (passnum, passcontents))
60
61def loadCapture(filename):
62 # Open a capture file handle

Callers 1

iter_actions.pyFile · 0.70

Calls 4

iterActionFunction · 0.85
printFunction · 0.85
GetNameMethod · 0.45
GetStructuredFileMethod · 0.45

Tested by

no test coverage detected