renderdoc_parser
Direct-call Python interface for RenderDoc capture analysis. No MCP protocol required — import and call functions directly.
Requires Python 3.6 (the renderdoc.pyd extension module is compiled for Python 3.6).
Quick Start
Requirements
- Python 3.6
renderdoc.pyd and renderdoc.dll in engine/third_party/renderdoc/
- Supported APIs: D3D12, D3D11, Vulkan, OpenGL ES, OpenGL, Metal
API Reference
Session (4 functions)
| Function |
Description |
open_capture(filepath) |
Open a .rdc capture file. Returns API type, action/resource counts. |
close_capture() |
Close the current capture and free resources. |
get_capture_info() |
Capture metadata: API, resolution, texture/buffer counts, GPU quirks. |
get_frame_overview() |
Frame stats: draw calls, clears, dispatches, memory usage, render targets. |
Event Navigation (5 functions)
| Function |
Description |
list_actions(max_depth=2, filter_flags=None, filter=None, event_type=None) |
Draw call/action tree. max_depth limits recursion. filter_flags accepts ["Drawcall", "Clear", "Dispatch"]. event_type shorthand: "draw", "dispatch", "clear". |
get_action(event_id) |
Get a single ActionDescription by event ID. |
set_event(event_id) |
Navigate to a specific event. |
search_actions(name_pattern=None, flags=None) |
Search actions by name substring or ActionFlags. |
find_draws(blend=None, min_vertices=None, texture_id=None, shader_id=None, render_target_id=None, max_results=50) |
Find draw calls matching criteria. |
Pipeline State (4 functions)
| Function |
Description |
get_pipeline_state(event_id=None) |
Full pipeline state at an event: shaders, viewports, scissors, blend, stencil, output targets. |
get_shader_bindings(stage, event_id=None) |
Shader resource bindings. stage is required: "vertex", "hull", "domain", "geometry", "pixel", "compute". |
get_vertex_inputs(event_id=None) |
Vertex input layout (format, semantic, register, stride). |
get_draw_call_state(event_id=None) |
Summary of the draw call at an event (indices, instances, topology, textures, shaders). |
Resources (4 functions)
| Function |
Description |
list_textures(filter_format=None, min_width=0) |
All textures with dimensions, format, mip levels. |
list_buffers(min_size=0) |
All buffers with length and creation flags. |
list_resources(type_filter=None, name_pattern=None) |
All resources (textures + buffers) unified. |
get_resource_usage(resource_id) |
Which events use a given resource and how. |
Data Reading (8 functions)
| Function |
Description |
save_texture(resource_id, output_path, file_type=None, mip=0, event_id=None) |
Save a texture to file. file_type accepts "png", "jpg", "bmp", "tga", "hdr", "exr", "dds". |
get_buffer_data(resource_id, offset=0, length=None, format=None) |
Raw bytes of a buffer. |
pick_pixel(resource_id, x, y, event_id=None) |
RGBA value at a pixel. |
get_texture_stats(resource_id, event_id=None, all_slices=False) |
Min/max/avg values for a texture. |
read_texture_pixels(resource_id, x, y, width, height, mip_level=0, array_slice=0, event_id=None) |
Pixel region as a 2D list of RGBA values. |
export_draw_textures(event_id, output_dir, skip_small=True) |
Save all render targets at a draw call to image files. |
save_render_target(event_id, output_path, save_depth=False) |
Save a specific render target to file. |
export_mesh(event_id, output_path=None) |
Export mesh data (positions, normals, UVs, indices) as a structured dict. |
Shader Analysis (3 functions)
| Function |
Description |
disassemble_shader(stage, target=None, event_id=None, line_range=None, search=None) |
Disassembled shader code. stage is required. target is a disassembly backend (e.g. "DXBC/DXIL"). |
get_shader_reflection(stage, event_id=None) |
Shader reflection: inputs, outputs, cbuffers, textures, samplers. |
get_cbuffer_contents(stage, cbuffer_index, event_id=None, filter=None) |
Contents of a constant buffer slot for a given stage. |
Advanced (6 functions)
| Function |
Description |
pixel_history(resource_id, x, y, event_id=None) |
All events that wrote to or modified a pixel, with before/after values. |
get_post_vs_data(stage="vertex", max_vertices=None, event_id=None) |
Post-vertex-shader data (positions, clip positions, cull distances). |
diff_draw_calls(eid1, eid2) |
Diff two draw calls: state differences and likely causes. |
analyze_render_passes() |
Render pass grouping: which draw calls contribute to which render targets. |
sample_pixel_region(event_id=None, resource_id=None, region=None, sample_count=64, anomaly_threshold=0.5) |
Sample all pixels in a region. Returns NaN/Inf/negative/bright pixel counts. |
debug_shader_at_pixel(event_id=None, pixel_x=None, pixel_y=None, stage=None, watch_variables=None) |
Step-by-step shader debug at a pixel. |
Performance (4 functions)
| Function |
Description |
get_pass_timing(granularity="pass", top_n=20) |
GPU timing per pass or per draw call. |
analyze_overdraw(pass_name=None, region=None, sample_count=64) |
Overdraw analysis: draw counts per render target. |
analyze_bandwidth(breakdown_by=None) |
Estimated memory bandwidth: texture reads, render target writes, buffer traffic. |
analyze_state_changes(pass_name=None, change_types=None) |
Track state changes between draw calls. change_types accepts ["blend", "depth", "cull", "shader", "vertex", "index", "render_target"]. |
Diagnostics (4 functions)
| Function |
Description |
diagnose_negative_values(check_targets=None, trace_depth=100) |
Detect render targets receiving negative values. Operates on current event. |
diagnose_precision_issues(focus=None, threshold=None) |
Detect potential half-float precision issues. |
diagnose_reflection_mismatch(reflection_pass_hint=None, object_hint=None) |
Detect shader resource counts/types that differ from pipeline state. |
diagnose_mobile_risks(check_categories=None, severity_filter="all") |
Mobile GPU-specific risks based on detected driver (Adreno, Mali, PowerVR, Apple). Operates on current event. |
Return Format
All functions return a Python dict. On error, all functions return:
Successful calls return a non-empty dict with function-specific data.
File Structure
GPU Quirks
get_capture_info() automatically detects the GPU/driver and returns known quirks:
- Adreno: mediump precision issues, R11G11B10_FLOAT signed behavior, textureLod bugs
- Mali: R11G11B10_FLOAT undefined negative writes, discard early-Z interactions, mediump accumulation
- PowerVR: tile-based deferred rendering considerations, sampler binding limits
- Apple GPU: tile memory bandwidth, float16 performance recommendations
- OpenGL ES: precision qualifier correctness, extension compatibility