mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add string messages to returned result codes to display to user
* Most of the main entry points that can fail with relevant reasons now has a way of specifying a message to return with it. This message can be displayed to the user to give more information or context about an error.
This commit is contained in:
@@ -63,7 +63,7 @@ Before doing anything, we must initialise the replay API. We do that by calling
|
||||
|
||||
To begin with, we use :py:meth:`~renderdoc.OpenCaptureFile` to obtain a :py:class:`~renderdoc.CaptureFile` instance. This gives us access to control over a capture file at a meta level. For more information see the :py:class:`CaptureFile` reference - the interface can also be used to create.
|
||||
|
||||
To open a file, use :py:meth:`~renderdoc.CaptureFile.OpenFile` on the :py:class:`~renderdoc.CaptureFile` instance. This function allows conversion from other formats via an importer, but here we'll use it just for opening a regular ``rdc`` file. It returns a :py:class:`~renderdoc.ReplayStatus` which can be used to determine what went wrong in the event that there was a problem. We then check that the capture uses an API which can be replayed locally - for example not every platform supports ``D3D11``, so on linux this would return no local replay support.
|
||||
To open a file, use :py:meth:`~renderdoc.CaptureFile.OpenFile` on the :py:class:`~renderdoc.CaptureFile` instance. This function allows conversion from other formats via an importer, but here we'll use it just for opening a regular ``rdc`` file. It returns a :py:class:`~renderdoc.ResultDetails` which can be used to determine what went wrong in the event that there was a problem. We then check that the capture uses an API which can be replayed locally - for example not every platform supports ``D3D11``, so on linux this would return no local replay support.
|
||||
|
||||
.. highlight:: python
|
||||
.. code:: python
|
||||
@@ -72,11 +72,11 @@ To open a file, use :py:meth:`~renderdoc.CaptureFile.OpenFile` on the :py:class:
|
||||
cap = rd.OpenCaptureFile()
|
||||
|
||||
# Open a particular file - see also OpenBuffer to load from memory
|
||||
status = cap.OpenFile('test.rdc', '', None)
|
||||
result = cap.OpenFile('test.rdc', '', None)
|
||||
|
||||
# Make sure the file opened successfully
|
||||
if status != rd.ReplayStatus.Succeeded:
|
||||
raise RuntimeError("Couldn't open file: " + str(status))
|
||||
if result != rd.ResultCode.Succeeded:
|
||||
raise RuntimeError("Couldn't open file: " + str(result))
|
||||
|
||||
# Make sure we can replay
|
||||
if not cap.LocalReplaySupport():
|
||||
@@ -85,7 +85,7 @@ To open a file, use :py:meth:`~renderdoc.CaptureFile.OpenFile` on the :py:class:
|
||||
Accessing Capture Analysis
|
||||
--------------------------
|
||||
|
||||
Once the capture has been loaded, we can now begin the replay analysis. To do that we use :py:meth:`~renderdoc.CaptureFile.OpenCapture` which returns a tuple of :py:class:`~renderdoc.ReplayStatus` and :py:class:`~renderdoc.ReplayController`.
|
||||
Once the capture has been loaded, we can now begin the replay analysis. To do that we use :py:meth:`~renderdoc.CaptureFile.OpenCapture` which returns a tuple of :py:class:`~renderdoc.ResultDetails` and :py:class:`~renderdoc.ReplayController`.
|
||||
|
||||
This function call will open the capture and begin to replay it, and initialise the analysis. The :py:class:`~renderdoc.ReplayController` returned is the interface to the majority of RenderDoc's replaying functionality.
|
||||
|
||||
@@ -93,10 +93,10 @@ This function call will open the capture and begin to replay it, and initialise
|
||||
.. code:: python
|
||||
|
||||
# Initialise the replay
|
||||
status,controller = cap.OpenCapture(rd.ReplayOptions(), None)
|
||||
result,controller = cap.OpenCapture(rd.ReplayOptions(), None)
|
||||
|
||||
if status != rd.ReplayStatus.Succeeded:
|
||||
raise RuntimeError("Couldn't initialise replay: " + str(status))
|
||||
if result != rd.ResultCode.Succeeded:
|
||||
raise RuntimeError("Couldn't initialise replay: " + str(result))
|
||||
|
||||
# Now we can use the controller!
|
||||
print("%d top-level actions" % len(controller.GetRootActions()))
|
||||
|
||||
Reference in New Issue
Block a user