From b450b3ff29066dcd099fef1aa9b13409ee13163e Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 10 Jan 2020 14:58:18 +0000 Subject: [PATCH] Fix qrenderdoc examples for latest API --- docs/python_api/examples/qrenderdoc/show_buffer.py | 11 ++++++----- docs/python_api/examples/qrenderdoc/show_buffer.rst | 4 ++-- docs/python_api/examples/qrenderdoc_intro.rst | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/python_api/examples/qrenderdoc/show_buffer.py b/docs/python_api/examples/qrenderdoc/show_buffer.py index 96fb6799b..0b0cfb4ee 100644 --- a/docs/python_api/examples/qrenderdoc/show_buffer.py +++ b/docs/python_api/examples/qrenderdoc/show_buffer.py @@ -1,7 +1,7 @@ filename = "test.rdc" formatter = "float3 pos; half norms[16]; uint flags;" -pyrenderdoc.LoadCapture(filename, filename, False, True) +pyrenderdoc.LoadCapture(filename, renderdoc.ReplayOptions(), filename, False, True) mybuf = renderdoc.ResourceId.Null() @@ -15,8 +15,9 @@ for buf in pyrenderdoc.GetBuffers(): print("selected %s" % pyrenderdoc.GetResourceName(mybuf)) -# Open a new buffer viewer for this buffer, with the given format -bufview = pyrenderdoc.ViewBuffer(0, 0, mybuf, formatter) +if mybuf != renderdoc.ResourceId.Null(): + # Open a new buffer viewer for this buffer, with the given format + bufview = pyrenderdoc.ViewBuffer(0, 0, mybuf, formatter) -# Show the buffer viewer on the main tool area -pyrenderdoc.AddDockWindow(bufview.Widget(), qrenderdoc.DockReference.MainToolArea, None) + # Show the buffer viewer on the main tool area + pyrenderdoc.AddDockWindow(bufview.Widget(), qrenderdoc.DockReference.MainToolArea, None) diff --git a/docs/python_api/examples/qrenderdoc/show_buffer.rst b/docs/python_api/examples/qrenderdoc/show_buffer.rst index 79931c524..af397bd60 100644 --- a/docs/python_api/examples/qrenderdoc/show_buffer.rst +++ b/docs/python_api/examples/qrenderdoc/show_buffer.rst @@ -10,7 +10,7 @@ First the code opens a specified file, although this step could be omitted if th filename = "test.rdc" - pyrenderdoc.LoadCapture(filename, filename, False, True) + pyrenderdoc.LoadCapture(filename, renderdoc.ReplayOptions(), filename, False, True) Next we iterate through the list of buffers to find the one we want. The selection criteria are up to you, in this case we look at the name provided and identify the buffer by that, however it could also be a particular size, or the buffer bound at a given event. @@ -47,4 +47,4 @@ Example Source :download:`Download the example script `. -.. literalinclude:: show_buffer.py \ No newline at end of file +.. literalinclude:: show_buffer.py diff --git a/docs/python_api/examples/qrenderdoc_intro.rst b/docs/python_api/examples/qrenderdoc_intro.rst index fb72c00fe..ced66f204 100644 --- a/docs/python_api/examples/qrenderdoc_intro.rst +++ b/docs/python_api/examples/qrenderdoc_intro.rst @@ -22,7 +22,7 @@ To load a capture programmatically, we can use the ``pyrenderdoc`` global variab filename = 'test.rdc' # Load a file, with the same 'original' name, that's not temporary, and is local - pyrenderdoc.LoadCapture(filename, filename, False, True) + pyrenderdoc.LoadCapture(filename, renderdoc.ReplayOptions(), filename, False, True) This will close any capture that is already loaded, but to just close an open capture you can use :py:meth:`~qrenderdoc.CaptureContext.CloseCapture`.