Change previous/next/parent IDs in DrawcallDescription to pointers

* This is a legacy holdover from the C# interop not being able to preserve
  pointers easily.
This commit is contained in:
baldurk
2018-06-18 18:29:46 +01:00
parent f919ea81e2
commit 0dda96a045
25 changed files with 307 additions and 309 deletions
@@ -1,8 +1,5 @@
import renderdoc as rd
# Set up a hash for storing draw information by event
draws = {}
# Define a recursive function for iterating over draws
def iterDraw(d, indent = ''):
global draws
@@ -10,16 +7,11 @@ def iterDraw(d, indent = ''):
# Print this drawcall
print('%s%d: %s' % (indent, d.eventId, d.name))
# Save the draw by eventId for use later
draws[d.eventId] = d
# Iterate over the draw's children
for d in d.children:
iterDraw(d, indent + ' ')
def sampleCode(controller):
global draws
# Iterate over all of the root drawcalls
for d in controller.GetDrawcalls():
iterDraw(d)
@@ -54,9 +46,9 @@ def sampleCode(controller):
inpass = True
# Advance to the next drawcall
if not draw.next in draws:
draw = draw.next
if draw is None:
break
draw = draws[draw.next]
if inpass:
print("Pass #%d contained %d draws" % (passnum, passcontents))
@@ -82,7 +74,7 @@ def loadCapture(filename):
if status != rd.ReplayStatus.Succeeded:
raise RuntimeError("Couldn't initialise replay: " + str(status))
return controller
return cap,controller
if 'pyrenderdoc' in globals():
pyrenderdoc.Replay().BlockInvoke(sampleCode)
@@ -5,9 +5,9 @@ In this example we will show how to iterate over drawcalls.
The drawcalls returned from :py:meth:`~renderdoc.ReplayController.GetDrawcalls` are draws or marker regions at the root level - with no parent marker region. There are multiple ways to iterate through the list of draws.
The first way illustrated in this sample is to walk the tree using :py:attr:`~renderdoc.DrawcallDescription.children`, which contains the list of child draws at any point in the tree. There is also :py:attr:`~renderdoc.DrawcallDescription.parent` which contains the index of the parent drawcall.
The first way illustrated in this sample is to walk the tree using :py:attr:`~renderdoc.DrawcallDescription.children`, which contains the list of child draws at any point in the tree. There is also :py:attr:`~renderdoc.DrawcallDescription.parent` which points to the parent drawcall.
The second is to use :py:attr:`~renderdoc.DrawcallDescription.previous` and :py:attr:`~renderdoc.DrawcallDescription.next`, which contain the indices of the previous and next draw respectively in a linear fashion, regardless of nesting depth.
The second is to use :py:attr:`~renderdoc.DrawcallDescription.previous` and :py:attr:`~renderdoc.DrawcallDescription.next`, which point to the previous and next draw respectively in a linear fashion, regardless of nesting depth.
In the example we use this iteration to determine the number of passes, using the drawcall flags to denote the start of each pass by a starting clear call.