Primary Interfaces

ReplayController

class renderdoc.ReplayController

The primary interface to access the information in a capture and the current state, as well as control the replay and analysis functionality available.

NoPreference

No preference for a particular value, see DebugPixel().

BuildCustomShader(entry, source, compileFlags, type)

Builds a shader suitable for running on the local replay instance as a custom shader.

The language used is native to the local renderer - HLSL for D3D based renderers, GLSL otherwise.

See TextureDisplay.CustomShader.

Parameters:
  • entry (str) – The entry point to use when compiling.
  • source (str) – The source file.
  • compileFlags (int) – API-specific compilation flags.
  • type (ShaderStage) – The stage that this shader will be executed at.
Returns:

A tuple with the id of the new shader if compilation was successful, ResourceId.Null() otherwise, and a str with any warnings/errors from compilation.

Return type:

tuple of ResourceId and str.

BuildTargetShader(entry, source, compileFlags, type)

Builds a shader suitable for running in the capture’s API as a replacement shader.

The language used is native to the API’s renderer - HLSL for D3D based renderers, GLSL otherwise.

Parameters:
  • entry (str) – The entry point to use when compiling.
  • source (str) – The source file.
  • compileFlags (int) – API-specific compilation flags.
  • type (ShaderStage) – The stage that this shader will be executed at.
Returns:

A tuple with the id of the new shader if compilation was successful, ResourceId.Null() otherwise, and a str with any warnings/errors from compilation.

Return type:

tuple of ResourceId and str.

CreateOutput(system, data, type)

Creates a replay output of the given type to the given native window

Parameters:
  • system (WindowingSystem) – The type of native window handle data being provided
  • data (opaque void * pointer) – The native window data, in a format defined by the system
  • type (ReplayOutputType) – What type of output to create
Returns:

A handle to the created output, or None on failure

Return type:

ReplayOutput

DebugPixel(x, y, sample, primitive)

Retrieve a debugging trace from running a pixel shader.

Parameters:
  • x (int) – The x co-ordinate.
  • y (int) – The y co-ordinate.
  • sample (int) – The multi-sampled sample. Ignored if non-multisampled texture.
  • primitive (int) – Debug the pixel from this primitive if there’s ambiguity. If set to NoPreference then a random fragment writing to the given co-ordinate is debugged.
Returns:

The resulting trace resulting from debugging.

Return type:

ShaderDebugTrace

DebugThread(groupid, threadid)

Retrieve a debugging trace from running a compute thread.

Parameters:
  • groupid – A list containing the 3D workgroup index.
  • threadid – A list containing the 3D thread index within the above workgroup.
Returns:

The resulting trace resulting from debugging.

Return type:

ShaderDebugTrace

DebugVertex(vertid, instid, idx, instOffset, vertOffset)

Retrieve a debugging trace from running a vertex shader.

Parameters:
  • vertid (int) – The vertex ID as a 0-based index up to the number of vertices in the draw.
  • instid (int) – The instance ID as a 0-based index up to the number of instances in the draw.
  • idx (int) – The actual index used to look up vertex inputs, either from the vertex ID for non- indexed draws or drawn from the index buffer. This must have all drawcall offsets applied.
  • instOffset (int) – The value from DrawcallDescription.instanceOffset.
  • vertOffset (int) – The value from DrawcallDescription.vertexOffset.
Returns:

The resulting trace resulting from debugging.

Return type:

ShaderDebugTrace

DescribeCounter(counterID)

Get information about what a counter actually represents, in terms of a human-readable understanding as well as the type and unit of the resulting information.

Parameters:counterID (GPUCounter) – The counter to query about.
Returns:The description of the counter.
Return type:CounterDescription
EnumerateCounters()

Retrieve a list of which counters are available in the current capture analysis implementation.

Returns:The list of counters available.
Return type:list of GPUCounter
FetchCounters(counters)

Retrieve the values of a specified set of counters.

Parameters:counters (list) – The list of GPUCounter to fetch results for.
Returns:The list of counter results generated.
Return type:list of CounterResult
FileChanged()

Notify the interface that the file it has open has been changed on disk.

FreeCustomShader(id)

Free a previously created custom shader.

See BuildCustomShader().

Parameters:id (ResourceId) – The id of the custom shader to free.
FreeTargetResource(id)

Free a previously created target shader.

See BuildTargetShader().

Parameters:id (ResourceId) – The id of the target shader to free.
GetAPIProperties()

Retrieve a APIProperties object describing the current capture.

Returns:The properties of the current capture.
Return type:APIProperties
GetBufferData(buff, offset, len)

Retrieve the contents of a range of a buffer as a bytes.

Parameters:
  • buff (ResourceId) – The id of the buffer to retrieve data from.
  • offset (int) – The byte offset to the start of the range.
  • len (int) – The length of the range, or 0 to retrieve the rest of the bytes in the buffer.
Returns:

The requested buffer contents.

Return type:

bytes

GetBuffers()

Retrieve the list of buffers alive in the capture.

Returns:The list of buffers in the capture.
Return type:list of BufferDescription
GetCBufferVariableContents(shader, entryPoint, cbufslot, buffer, offs)

Retrieve the contents of a constant block by reading from memory or their source otherwise.

Parameters:
  • shader (ResourceId) – The id of the shader to use for metadata.
  • entryPoint (str) – The entry point of the shader being used. In some APIs, this is ignored.
  • cbufslot (int) – The index in the ShaderReflection.ConstantBlocks list to look up.
  • buffer (ResourceId) – The id of the buffer to use for data. If ConstantBlock.bufferBacked is False this is ignored.
  • offs (int) – Retrieve buffer contents starting at this byte offset.
Returns:

The shader variables with their contents.

Return type:

list of ShaderVariable

GetD3D11PipelineState()

Retrieve the current D3D11_State pipeline state.

This pipeline state will be filled with default values if the capture is not using the D3D11 API. You should use GetAPIProperties() to determine the API of the capture.

Returns:The current D3D11 pipeline state.
Return type:D3D11_State
GetD3D12PipelineState()

Retrieve the current D3D12_State pipeline state.

This pipeline state will be filled with default values if the capture is not using the D3D12 API. You should use GetAPIProperties() to determine the API of the capture.

Returns:The current D3D12 pipeline state.
Return type:D3D12_State
GetDebugMessages()

Retrieve a list of any newly generated diagnostic messages.

Every time this function is called, any debug messages returned will not be returned again. Only newly generated messages will be returned after that.

Returns:The list of the DebugMessage messages.
Return type:list of DebugMessage
GetDrawcalls()

Retrieve the list of root-level drawcalls in the capture.

Returns:The list of root-level drawcalls in the capture.
Return type:list of DrawcallDescription
GetFrameInfo()

Retrieve the information about the frame contained in the capture.

Returns:The frame information.
Return type:FrameDescription
GetGLPipelineState()

Retrieve the current GL_State pipeline state.

This pipeline state will be filled with default values if the capture is not using the OpenGL API. You should use GetAPIProperties() to determine the API of the capture.

Returns:The current OpenGL pipeline state.
Return type:GL_State
GetPostVSData(instID, stage)

Retrieve the generated data from one of the geometry processing shader stages.

Parameters:
  • instID (int) – The index of the instance to retrieve data for.
  • stage (MeshDataStage) – The stage of the geometry processing pipeline to retrieve data from.
Returns:

The information describing where the post-transform data is stored.

Return type:

MeshFormat

GetResolve(callstack)

Retrieve the list of buffers alive in the capture.

Must only be called after InitResolver() has returned True.

Parameters:callstack (list) – The integer addresses in the original callstack.
Returns:The list of resolved callstack entries as strings.
Return type:list of str
GetSupportedWindowSystems()

Retrieves the supported WindowingSystem systems by the local system.

Returns:The list of supported systems.
Return type:list of WindowingSystem
GetTextureData(tex, arrayIdx, mip)

Retrieve the contents of one subresource of a texture as a bytes.

For multi-sampled images, they are treated as if they are an array that is Nx longer, with each array slice being expanded in-place so it would be slice 0: sample 0, slice 0: sample 1, slice 1: sample 0, etc.

Parameters:
  • tex (ResourceId) – The id of the texture to retrieve data from.
  • arrayIdx (int) – The slice of an array or 3D texture, or face of a cubemap texture.
  • mip (int) – The mip level to pick from.
Returns:

The requested texture contents.

Return type:

bytes

GetTextures()

Retrieve the list of textures alive in the capture.

Returns:The list of textures in the capture.
Return type:list of TextureDescription
GetUsage(id)

Retrieve a list of ways a given resource is used.

Parameters:id (ResourceId) – The id of the texture or buffer resource to be queried.
Returns:The list of usages of the resource.
Return type:list of EventUsage
GetVulkanPipelineState()

Retrieve the current VK_State pipeline state.

This pipeline state will be filled with default values if the capture is not using the Vulkan API. You should use GetAPIProperties() to determine the API of the capture.

Returns:The current Vulkan pipeline state.
Return type:VK_State
HasCallstacks()

Query if per-event or per-draw callstacks are available in this capture.

Returns:True if any callstacks are available, False otherwise.
Return type:bool
InitResolver()

Begin initialising a callstack resolver, looking up symbol files and caching as necessary.

This function will eventually return true if either the resolver successfully initialises, or if it comes to a point where a problem is encountered that the user cannot solve. That means this can be used to present a progress dialog and repeatedly queried to see when to allow the user to continue.

Returns:True if any callstacks are available, False otherwise.
Return type:bool
NoPreference = 4294967295
PixelHistory(texture, x, y, slice, mip, sampleIdx, typeHint)

Retrieve the history of modifications to the selected pixel on the selected texture.

Parameters:
  • texture (ResourceId) – The texture to search for modifications.
  • x (int) – The x co-ordinate.
  • y (int) – The y co-ordinate.
  • slice (int) – The slice of an array or 3D texture, or face of a cubemap texture.
  • mip (int) – The mip level to pick from.
  • sampleIdx (int) – The multi-sampled sample. Ignored if non-multisampled texture.
  • typeHint (CompType) – A hint on how to interpret textures that are typeless.
Returns:

The list of pixel history events.

Return type:

list of PixelModification

RemoveReplacement(id)

Remove any previously specified replacement for an object.

See ReplaceResource().

Parameters:id (ResourceId) – The id of the original resource that was previously being substituted.
ReplaceResource(original, replacement)

Replace one resource with another for subsequent replay and analysis work.

This is commonly used for modifying the capture by selectively replacing resources with newly created resources.

See BuildTargetShader(), RemoveReplacement().

Parameters:
  • original (ResourceId) – The id of the original resource that should be substituted.
  • replacement (ResourceId) – The id of the new resource that should be used instead.
SaveTexture(saveData, path)

Save a texture to a file on disk, with possible transformation to map a complex texture to something compatible with the target file format.

Parameters:
  • saveData (TextureSave) – The configuration settings of which texture to save, and how
  • path (str) – The path to save to on disk.
Returns:

True if the texture was saved successfully, False otherwise.

Return type:

bool

SetFrameEvent(eventID, force)

Move the replay to reflect the state immediately after the given EID.

Parameters:
  • eventID (int) – The EID to move to.
  • force (bool) – True if the internal replay should refresh even if the eventID is already current. This can be useful if external factors might cause the replay to vary.
Shutdown()

Shutdown and destroy the current interface and all outputs that have been created.

ShutdownOutput(output)

Shutdown a particular output.

Parameters:output (ReplayOutput) – The output to shut down.

ReplayOutput

class renderdoc.ReplayOutput

A stateful output handle that contains the current configuration for one particular view of the capture. This allows multiple outputs to run independently without interfering with each other.

The different types are enumerated in ReplayOutputType.

NoResult

No result was found in e.g. PickVertex().

AddThumbnail(system, data, texID, typeHint)

Sets up a thumbnail for displaying a particular texture with sensible defaults.

The window handle specified will be filled (in an aspect-ratio preserving way) with the texture.

If the window specified has been used for a thumbnail before, then the texture will be updated but otherwise nothing will be created and the existing internal data will be reused. This means that you can call this function multiple times to just change the texture.

Should only be called for texture outputs.

Parameters:
  • system (WindowingSystem) – The type of native window handle data being provided.
  • data (opaque void * pointer.) – The native window data, in a format defined by the system.
  • texID (ResourceId) – The texture ID to display in the thumbnail preview.
Returns:

A boolean indicating if the thumbnail was successfully created.

Return type:

bool

ClearThumbnails()

Clear and release all thumbnails associated with this output. See AddThumbnail().

DisablePixelContext()

Disable the pixel context view from rendering.

Display()

Render to the window handle specified when the output was created.

This will also render any thumbnails and the pixel context, if enabled.

GetCustomShaderTexID()

Retrieves the ResourceId containing the contents of the texture after being passed through a custom shader pass.

Should only be called for texture outputs.

Returns:The ResourceId assigned to the texture with the results of the custom shader.
Return type:ResourceId
GetHistogram(minval, maxval, channels)

Retrieve a list of values that can be used to show a histogram of values for the current texture.

The output list contains N buckets, and each bucket has the number of pixels that falls in each bucket when the pixel values are divided between minval and maxval.

Should only be called for texture outputs.

Parameters:
  • minval (float) – The lower end of the smallest bucket. If any values are below this, they are not added to any bucket.
  • maxval (float) – The upper end of the largest bucket. If any values are above this, they are not added to any bucket.
  • channels (list) – A list of four bool values indicating whether each of RGBA should be included in the count.
Returns:

A list of the unnormalised bucket values.

Return type:

list of int

GetMinMax()

Retrieves the minimum and maximum values in the current texture.

Should only be called for texture outputs.

Returns:A tuple with the minimum and maximum pixel values respectively.
Return type:tuple of PixelValue and PixelValue
NoResult = 4294967295
PickPixel(texID, customShader, x, y, sliceFace, mip, sample)

Retrieve the contents of a particular pixel in a texture.

Should only be called for texture outputs.

Parameters:
  • texID (ResourceId) – The texture to pick the pixel from.
  • customShader (bool) – Whether to apply the configured custom shader.
  • x (int) – The x co-ordinate to pick from.
  • y (int) – The y co-ordinate to pick from.
  • sliceFace (int) – The slice of an array or 3D texture, or face of a cubemap texture.
  • mip (int) – The mip level to pick from.
  • sample (int) – The multisample sample to pick from.
Returns:

The contents of the pixel.

Return type:

PixelValue

PickVertex(eventID, x, y)

Retrieves the vertex and instance that is under the cursor location, when viewed relative to the current window with the current mesh display configuration.

Should only be called for mesh outputs.

Parameters:
  • eventID (int) – The event ID to pick at.
  • x (int) – The x co-ordinate to pick from.
  • y (int) – The y co-ordinate to pick from.
Returns:

A tuple with the first value being the vertex index in the mesh, and the second value being the instance index. The values are set to NoResult if no vertex was found,

Return type:

tuple of int and int

SetMeshDisplay(o)

Sets the MeshDisplay configuration for a mesh output.

SetPixelContext(system, data)

Sets up a zoomed in pixel context view around a particular pixel selection.

The texture rendering uses the configuration specified in SetTextureDisplay() except with a fixed high zoom value and a fixed position, see SetPixelContextLocation().

Should only be called for texture outputs.

Parameters:
  • system (WindowingSystem) – The type of native window handle data being provided.
  • data (opaque void * pointer.) – The native window data, in a format defined by the system.
Returns:

A boolean indicating if the pixel context was successfully configured.

Return type:

bool

SetPixelContextLocation(x, y)

Sets the pixel that the pixel context should be centred on.

Should only be called for texture outputs.

SetTextureDisplay(o)

Sets the TextureDisplay configuration for a texture output.

TargetControl

class renderdoc.TargetControl

A connection to a running application with RenderDoc injected, which allows limited control over the capture process as well as querying the current status.

Connected()

Determines if the connection is still alive.

Returns:True if the connection still appears to be working, False if it has been closed.
Return type:bool
CopyCapture(remoteID, localpath)

Begin copying a given capture stored on a remote machine to the local machine over the target control connection.

Parameters:
  • remoteID (int) – The identifier of the remote capture.
  • localpath (str) – The absolute path on the local system where the file should be saved.
DeleteCapture(remoteID)

Delete a capture from the remote machine.

Parameters:remoteID (int) – The identifier of the remote capture.
GetAPI()

Retrieves the API currently in use by the target.

Returns:The API name, or empty if no API is initialised yet.
Return type:str
GetBusyClient()

If a busy message was received, determine the client keeping the target busy.

Returns:The name of the client currently connected to the target.
Return type:str
GetPID()

Retrieves the Process ID (PID) of the target on its local system.

Returns:The Process ID, or 0 if that’s not applicable on the target platform.
Return type:int
GetTarget()

Retrieves the target’s name or identifier - typically the name of the executable.

Returns:The target name.
Return type:str
QueueCapture(frameNumber)

Queue up a capture to happen on a particular frame number. When this frame is about to begin a capture is begun, and it ends when this frame number ends.

Parameters:frameNumber (int) – The number of the frame to capture on.
ReceiveMessage()

Query to see if a message has been received from the remote system.

The details of the types of messages that can be received are listed under TargetControlMessage.

Note

If no message has been received, this function will pump the connection. You are expected to continually call this function and process any messages to kee pthe connection alive.

This function will block but only to a limited degree. If no message is waiting after a small time it will return with a No-op message to allow further processing.

Returns:The message that was received.
Return type:TargetControlMessage
Shutdown()

Closes the connection without affecting the running application.

TriggerCapture(numFrames)

Trigger a capture on the target, with the same semantics as if the capture key had been pressed - from the next presentation call after this message is processed on the target to the next after that.

Parameters:numFrames (int) – How many frames to capture. These will be captured sequentially and independently to separate files.

RemoteServer

class renderdoc.RemoteServer

A connection to a running remote RenderDoc server on another machine. This allows the transfer of captures to and from the local machine, as well as remotely replaying a capture with a local proxy renderer, so that captures that are not supported locally can still be debugged with as much work as possible happening on the local machine.

NoPreference

No preference for a particular value, see DebugPixel().

CloseCapture(rend)

Close a capture analysis handle previously opened by OpenCapture().

Parameters:rend (ReplayController) – The ReplayController that is to be closed.
CopyCaptureFromRemote(remotepath, localpath, progress)

Copy a capture file that is stored on the remote system to the local system.

This function will block until the copy is fully complete, or an error has occurred.

Parameters:
  • remotepath (str) – The remote path where the file should be copied from.
  • localpath (str) – The local path where the file should be saved.
  • progress (float) – A reference to a float value that will be updated as the copy happens from 0.0 to 1.0. The parameter can be None if no progress update is desired.
CopyCaptureToRemote(filename, progress)

Copy a capture file that is stored on the local system to the remote system.

This function will block until the copy is fully complete, or an error has occurred.

This is primarily useful for when a capture is only stored locally and must be replayed remotely, as the capture must be available on the machine where the replay happens.

Parameters:
  • filename (str) – The path to the file on the local system.
  • progress (float) – A reference to a float value that will be updated as the copy happens from 0.0 to 1.0. The parameter can be None if no progress update is desired.
Returns:

The path on the remote system where the capture was saved temporarily.

Return type:

str

ExecuteAndInject(app, workingDir, cmdLine, env, opts)

Launch an application and inject into it to allow capturing.

This happens on the remote system, so all paths are relative to the remote filesystem.

Parameters:
  • app (str) – The path to the application to run.
  • workingDir (str) – The working directory to use when running the application. If blank, the directory containing the application is used.
  • cmdLine (str) – The command line to use when running the application, it will be processed in a platform specific way to generate arguments.
  • env (list) – Any EnvironmentModification that should be made when running the program.
  • opts (CaptureOptions) – The capture options to use when injecting into the program.
Returns:

The ident where the new application is listening for target control, or 0 if something went wrong.

Return type:

int

GetHomeFolder()

Retrieve the path on the remote system where browsing can begin.

Returns:The ‘home’ path where browsing for files or folders can begin.
Return type:str
ListFolder(path)

Retrieve the contents of a folder path on the remote system.

If an error occurs, a single PathEntry will be returned with appropriate error flags.

Parameters:path (str) – The remote path to list.
Returns:The contents of the specified folder.
Return type:list of PathEntry
LocalProxies()

Retrieve a list of renderers available for local proxying.

These will be strings like “D3D11” or “OpenGL”.

Returns:A list of names of the local proxies.
Return type:list of str
NoPreference = 4294967295
OpenCapture(proxyid, logfile, progress)

Open a capture file for remote capture and replay. The capture will be opened and replayed on the remote system, and proxied to the local system with a given renderer. As much work as possible will happen locally to save on bandwidth, processing and latency.

This function will block until the capture is fully opened on the remote system and ready for use, or an error has occurred.

Note

You must close the resulting ReplayController with the CloseCapture() function to ensure the local proxy is correctly tidied up, instead of using ReplayController.Shutdown().

Parameters:
  • proxyid (int) – The index in the array returned by LocalProxies() to use as a local proxy, or NoPreference to indicate no preference for any proxy.
  • logfile (str) – The path on the remote system where the file is. If the file is only available locally you can use CopyCaptureToRemote() to transfer it over the remote connection.
  • progress (float) – A reference to a float value that will be updated as the copy happens from 0.0 to 1.0. The parameter can be None if no progress update is desired.
Returns:

A tuple containing the status of opening the capture, whether success or failure, and the resulting ReplayController handle if successful.

Return type:

tuple of ReplayStatus and ReplayController

Ping()

Pings the remote server to ensure the connection is still alive.

Returns:True if the ping was sent and received successfully, False if something went wrong and the connection is no longer alive.
Return type:bool
RemoteSupportedReplays()

Retrieve a list of renderers supported by the remote server.

These will be strings like “D3D11” or “OpenGL”.

Returns:A list of names of the remote renderers.
Return type:list of str
ShutdownConnection()

Closes the connection without affecting the running server.

ShutdownServerAndConnection()

Closes the connection and also tells the running server to close.

TakeOwnershipCapture(filename)

Take ownership over a capture file.

Initially when a capture is made, it is owned by the injected library in the application. It passes ownership to any program that is connected via target control that is notified about the capture, which is then responsible for either saving the file or deleting it if it’s unwanted.

Passing ownership of a file to the remote server means that it will be kept around for future use until the server closes, at which point it will delete any files it owns.

Parameters:filename (str) – The remote path to take ownership of.

CaptureFile

class renderdoc.CaptureFile

A handle to a capture file. Used for simple cheap processing and meta-data fetching without opening the capture for analysis.

DriverName()

Retrieves the name of the driver that was used to create this capture.

Returns:A simple string identifying the driver used to make the capture.
Return type:str
Filename()

Retrieves the filename used to open this handle.

This filename is exactly as specified without any modificaton to make it an absolute path.

Returns:The filename used to create this handle.
Return type:str
GetThumbnail(type, maxsize)

Retrieves the embedded thumbnail from the capture.

Parameters:
  • type (FileType) – The image format to convert the thumbnail to.
  • maxsize (int) – The largest width or height allowed. If the thumbnail is larger, it’s resized.
Returns:

The raw contents of the thumbnail, converted to the desired type at the desired max resolution.

Return type:

bytes.

LocalReplaySupport()

Queries for how well a particular capture is supported on the local machine.

Returns:How much support for replay exists locally.
Return type:ReplaySupport
OpenCapture(progress)

Opens a capture for replay locally and returns a handle to the capture.

This function will block until the capture is fully loaded and ready.

Once the replay is created, this CaptureFile can be shut down, there is no dependency on it by the ReplayController.

Parameters:progress (float) – A reference to a float value that will be updated as the copy happens from 0.0 to 1.0. The parameter can be None if no progress update is desired.
Returns:A tuple containing the status of opening the capture, whether success or failure, and the resulting ReplayController handle if successful.
Return type:tuple of ReplayStatus and ReplayController.
OpenStatus()

Retrieves the status of the handle.

This returns an error if the capture file used to create the handle wasn’t found, or was corrupted, or something else went wrong while processing it.

Returns:The status of the handle to the file.
Return type:ReplayStatus
RecordedMachineIdent()

Retrieves the identifying string describing what type of machine created this capture.

Returns:A string identifying the machine ident used to make the capture.
Return type:str
Shutdown()

Closes the handle.