mcpField
C
cli-anything-renderdoc

cli-anything-renderdoc

github.com/hkuds开发57.6k490 次安装5 周前更新
代码仓库

关于 cli-anything-renderdoc

cli-anything-renderdoc 是用于无界面检查和分析 RenderDoc GPU 帧捕获的命令行技能,面向图形开发者和 Agent。它可结构化访问捕获事件、纹理、着色器、管线状态及资源。

主要功能

  1. 01查看捕获元数据和缩略图
  2. 02搜索并汇总绘制操作
  3. 03导出纹理并读取像素
  4. 04查看管线状态并导出着色器
  5. 05检查缓冲区、网格和 GPU 计数器
  6. 06生成捕获及对比预览包

适用场景

  1. 01追踪 GPU 捕获中的绘制调用
  2. 02导出着色器源码或反汇编
  3. 03比较渲染事件或帧捕获
  4. 04生成机器可读的捕获报告

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/hkuds/cli-anything --skill cli-anything-renderdoc

安装后在 Claude Code 中输入/cli-anything-renderdoc确认已加载。

详细介绍

RenderDoc CLI Skill

对 RenderDoc GPU 帧捕获(.rdc 文件)进行无头命令行分析。

功能

  • 捕获检查:元数据、区段、缩略图、格式转换
  • 操作树:列出/搜索/筛选绘制调用、清除、调度、标记
  • 纹理操作:列出、检查、导出(PNG/JPG/DDS/HDR/EXR)、像素拾取
  • 管线状态:任意事件处的完整着色器/RT/视口状态
  • 着色器分析:以人类可读形式导出色着色器(HLSL/GLSL/反汇编)、常量缓冲区回读
  • 资源检查:缓冲区/纹理枚举、原始数据读取
  • 网格数据:顶点着色器输入/输出解码
  • GPU 计数器:枚举并获取硬件性能计数器

命令组

capture
cli-anything-renderdoc -c frame.rdc capture info          # Metadata + sections
cli-anything-renderdoc -c frame.rdc capture thumb -o t.png # Extract thumbnail
cli-anything-renderdoc -c frame.rdc capture convert -o out.rdc --format rdc
actions
cli-anything-renderdoc -c frame.rdc actions list           # All actions
cli-anything-renderdoc -c frame.rdc actions list --draws-only  # Draw calls only
cli-anything-renderdoc -c frame.rdc actions summary        # Counts by type
cli-anything-renderdoc -c frame.rdc actions find "Shadow"  # Search by name
cli-anything-renderdoc -c frame.rdc actions get 42         # Single action
textures
cli-anything-renderdoc -c frame.rdc textures list
cli-anything-renderdoc -c frame.rdc textures get <id>
cli-anything-renderdoc -c frame.rdc textures save <id> -o out.png --format png
cli-anything-renderdoc -c frame.rdc textures save-outputs 42 -o ./renders/
cli-anything-renderdoc -c frame.rdc textures pick <id> 100 200
pipeline
cli-anything-renderdoc -c frame.rdc pipeline state 42

# Export shader in human-readable form
# Text shaders (GLSL/HLSL) → saved directly
# Binary shaders (DXBC/SPIR-V) → embedded source (HLSL/GLSL) or disassembly
cli-anything-renderdoc -c frame.rdc pipeline shader-export 42 --stage Fragment
cli-anything-renderdoc -c frame.rdc pipeline shader-export 42 --stage Vertex -o ./shaders/

cli-anything-renderdoc -c frame.rdc pipeline cbuffer 42 --stage Vertex --index 0

# Compare pipeline state between two events
# Default output: same directory as the capture file  ;  use -o to override
cli-anything-renderdoc -c a.rdc pipeline diff 100 200 -b b.rdc
cli-anything-renderdoc -c frame.rdc pipeline diff 100 200              # same capture
cli-anything-renderdoc -c a.rdc pipeline diff 100 200 -b b.rdc -o result.json
cli-anything-renderdoc -c a.rdc pipeline diff 100 200 -b b.rdc --no-compact
resources
cli-anything-renderdoc -c frame.rdc resources list
cli-anything-renderdoc -c frame.rdc resources buffers
cli-anything-renderdoc -c frame.rdc resources read-buffer <id> --format float32
mesh
cli-anything-renderdoc -c frame.rdc mesh inputs 42 --max-vertices 10
cli-anything-renderdoc -c frame.rdc mesh outputs 42
counters
cli-anything-renderdoc -c frame.rdc counters list
cli-anything-renderdoc -c frame.rdc counters fetch --ids 1,2,3

预览包

RenderDoc 预览支持用于真实的捕获检查,而非实时 创意预览。

# List preview recipes
cli-anything-renderdoc -c frame.rdc --json preview recipes

# Capture a preview bundle for the active capture or a specific event
cli-anything-renderdoc -c frame.rdc --json preview capture --recipe quick --event-id 42

# Capture a diff preview bundle for two events or captures
cli-anything-renderdoc -c frame.rdc --json preview diff 100 200
cli-anything-renderdoc -c a.rdc --json preview diff 100 200 --capture-b b.rdc

# Return the latest existing bundle for the capture
cli-anything-renderdoc -c frame.rdc --json preview latest --recipe quick

典型预览包内容:

  • 捕获缩略图
  • 输出目标图像
  • pipeline_state.json
  • action_summary.json

差异包额外包含:

  • A/B 缩略图
  • A/B 输出目标图像
  • pipeline_diff.json

RenderDoc 目前不提供实时预览会话。相反,每个 捕获/差异包会追加到配方级稳定的 trajectory.json。

查看器命令:

cli-hub previews inspect /path/to/bundle
cli-hub previews html /path/to/bundle -o page.html
cli-hub previews open /path/to/bundle

JSON 模式

所有命令都支持 --json,以输出机器可读格式:

cli-anything-renderdoc -c frame.rdc --json actions summary

环境变量

变量描述
RENDERDOC_CAPTURE默认捕获文件路径
PYTHONPATH必须包含 RenderDoc 路径

Agent 使用说明

  • 使用 pipeline shader-export 提取着色器 —— 对于二进制着色器(DXBC/SPIR-V),它会自动导出内嵌的 HLSL/GLSL 源码,或回退到反汇编;对于文本着色器(GLSL/HLSL),它会直接保存原始源码
  • 按捕获 API 区分的着色器格式:
    • D3D11 → DXBC 二进制,导出为内嵌 HLSL 源码(.hlsl)或字节码汇编(.dxbc.asm)
    • OpenGL/GLES → GLSL 源文本(.glsl),本身已人类可读
    • Vulkan → SPIR-V 二进制,导出为内嵌 GLSL 源码(.glsl)或 SPIR-V 汇编(.spv.asm)
  • 使用 pipeline diff 比较两个事件 —— 它会写入一个 JSON 文件并仅打印路径;使用 -b 指定第二个捕获
  • 为便于程序化消费,始终指定 --json
  • 先使用 actions summary 了解捕获复杂度
  • 使用 actions list --draws-only 专注于实际渲染
  • 当 Agent 需要一个可移植、真实的检查包,而不只是原始重放调用时,使用 preview capture 或 preview diff
  • 如果需要持久的捕获/差异历史,请从预览 JSON 中读取 _trajectory_path
  • 仅使用 cli-hub previews ... 来检查/打开已生成的包
  • 管线状态需要来自操作列表的事件 ID
  • 纹理保存支持:png、jpg、bmp、tga、hdr、exr、dds
  • 缓冲区数据可解码为 hex、float32、uint32 或原始字节

评论

支持 Markdown