By penspanic
Debug Chrome WebGPU apps on macOS — browser-level via Chrome DevTools MCP, GPU driver-level via Xcode xctrace Metal System Trace
A toolkit for debugging Chrome WebGPU applications on macOS with AI coding assistants. Combines Chrome DevTools MCP for browser-level debugging with Xcode xctrace for Metal driver-level profiling.
WebGPU debugging is hard:
printf in shadersThis kit gives your AI assistant direct access to browser state (evaluate_script) and GPU driver traces (xctrace).
/plugin marketplace add penspanic/webgpu-metal-debug-kit
/plugin install webgpu-metal-debug-kit@webgpu-metal-debug-kit
/reload-plugins
git clone https://github.com/penspanic/webgpu-metal-debug-kit.git \
~/.claude/skills/webgpu-metal-debug-kit
Works with any agent that supports Agent Skills (Claude Code, Codex CLI, Cursor, VS Code Copilot, etc.).
The AI uses Chrome DevTools MCP to directly control the browser:
// AI runs these via evaluate_script
window.__gpu.stats() // { fps, avgMs, maxMs, frameGapMs }
window.__gpu.setDebugMode(2) // step heatmap
window.__gpu.textures() // texture info
When browser-level analysis isn't enough, the AI captures Metal traces:
# AI finds GPU process and runs xctrace directly
GPU_PID=$(pgrep -f "Google Chrome.*--type=gpu-process" | head -1)
/usr/bin/xcrun xctrace record --template 'Metal System Trace' \
--attach "$GPU_PID" --time-limit 5s --output /tmp/webgpu-metal-trace.trace
# Start your app
python3 -m http.server 8080
# Launch Chrome with Metal debug flags
bash scripts/setup-metal-debug.sh http://localhost:8080
# Capture Metal trace
bash scripts/capture-metal-trace.sh 5
# Open in Instruments
open /tmp/webgpu-metal-trace.trace
In the Chrome console: __gpu.stats(), __gpu.setDebugMode(2), etc.
Add assets/webgpu-debug-helpers.js to your WebGPU app:
import { initDebugHelpers, frameStart, frameEnd, getDebugMode } from './webgpu-debug-helpers.js';
initDebugHelpers(device);
function render() {
frameStart();
// pass getDebugMode() to your shader uniforms
frameEnd();
requestAnimationFrame(render);
}
Add assets/debug-shader-snippet.wgsl to your shader for debug visualization modes.
| Mode | Visualization | Use Case |
|---|---|---|
| 0 | Normal | Default rendering |
| 1 | Render path | Which shader path rendered each pixel |
| 2 | Step heatmap | Raymarching performance hotspots |
| 3 | Depth | Depth buffer visualization |
| 4 | Normals | Surface normal visualization |
See references/debug-modes.md for details.
bash demo/start.sh
# Opens http://localhost:8080/demo/ in Chrome
Note:
file://URLs won't work due to CORS. Use an HTTP server.
xcodebuild -downloadComponent MetalToolchain if template missing)MIT
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub penspanic/webgpu-metal-debug-kit --plugin webgpu-metal-debug-kitCapture and analyze WebGPU frames from a live page with Claude, using the WebGPU Inspector local capture API and a live bridge.
Graphics engineering agents providing expertise in GPU programming, shaders, and rendering
Claude skill for WebGPU-enabled Three.js development with TSL (Three.js Shading Language)
Agent-first SwiftUI motion observability for debugging animations and scroll behavior with MotionEyes traces.
Reliable automation, in-depth debugging, and performance analysis in Chrome using Chrome DevTools and Puppeteer
Mobile app debugging for iOS, Android, cross-platform frameworks. Use for crashes, memory leaks, performance issues, network problems, or encountering Xcode instruments, Android Profiler, React Native debugger, native bridge errors.