Overview . Inspect . Capture . Record
This guide is for a WebGPU app that runs well on a desktop graphics card and poorly on a tile-based GPU: Apple silicon, and the Arm Mali, Qualcomm Adreno and Imagination PowerVR GPUs in phones and tablets. It uses the Capture panel's reports and the tools of the Claude Code plugin (claude-plugin/), and names the fields each one returns.
A tile-based GPU does not draw a render pass straight into its attachments. It first collects the pass's geometry, then renders the screen one small tile at a time in fast memory on the chip. For each tile it loads every attachment whose loadOp is "load" from memory into the tile, draws, and stores every attachment whose storeOp is "store" back.
Three things follow.
- Every pass boundary costs a round trip. Ending a pass on a full-screen target and beginning another that loads it stores the whole target and reads it back in. Two passes that could have been one pay for a store and a load that do nothing. On a desktop GPU a pass boundary is nearly free, so a renderer written there tends to have many.
- Hidden-surface removal has conditions. Apple and PowerVR GPUs work out which opaque fragment is visible at each pixel before shading any, so each pixel is shaded once whatever order the draws came in. That only works for draws whose fragment shader cannot
discardand does not writefrag_depth, and whose pipeline does not use alpha-to-coverage. A draw that can do any of those has to be shaded to find out whether its fragments exist, and it forces the geometry before it to be resolved first. - Per-pass timestamps overlap. Because the GPU collects geometry for a pass and rasterizes it later, the work of consecutive passes interleaves. The begin and end timestamps of different passes overlap, their durations add up to more than the frame took, and "this pass took 4 ms" is not a number that can rank passes. Diagnosis has to rest on what can be computed from the capture, and on measurements of the whole frame.
Take a capture on the device, or of the app running on it. With the plugin: capture_frames({ frames: 3, profilePasses: true, payloads: "none" }). Capturing a few frames matters for step 5. In DevTools, use the Capture panel.
Most of the analysis works the same on a capture taken on any machine, because it is computed from the commands. Only steps 1 and 6 need the device itself.
get_capture_summary returns summary.gpu:
"gpu": { "vendor": "apple", "architecture": "metal-3", "tileBased": true, "family": "Apple GPU" }
tileBased is true for Apple, Arm, Qualcomm and Imagination adapters, false for NVIDIA, AMD and Intel, and null when the adapter info does not say. The same gpu object is in the results of get_render_graph, get_frame_issues, get_bottlenecks and analyze_performance. When it is true, the findings in steps 3 and 4 are raised one severity level, and the Render Graph panel's bandwidth line says so.
The summary also has summary.timing. A bad result looks like this:
"timing": { "reliable": false, "reason": "7 of 9 timed passes start before an earlier pass ended, so their GPU time spans overlap; the pass durations sum to 61.2 ms, 3.4x the 18.1 ms the passes span. ..." }
When timing.reliable is false, do not rank passes by gpuMs or durationMs. analyze_performance and get_bottlenecks stop doing so themselves: their rankedBy field says they ordered passes by modeled workload, analyze_performance gives each pass a workloadPercent instead of a gpuPercent, and get_bottlenecks leaves share empty and fills workloadShare. Timestamps are also reported as unreliable when they are quantized (every duration a multiple of the same step, or many of them exactly zero), which browsers do by default and which mostly affects frames of short passes.
get_render_graph returns bandwidth, the bytes the frame moves between render-target memory and the GPU, computed from each pass's attachments: pixels x bytes per pixel of the format x samples, for each attachment loaded and each stored.
"bandwidth": {
"loadBytes": 184320000, "storeBytes": 276480000, "resolveBytes": 0, "copyBytes": 0, "totalBytes": 460800000,
"color": { "loadBytes": ..., "storeBytes": ... },
"depthStencil": { "loadBytes": ..., "storeBytes": ... },
"reference": { "width": 1280, "height": 720, "bytesPerPixel": 4, "format": "bgra8unorm", "source": "canvas" },
"fullScreenEquivalents": { "load": 50, "store": 75, "copy": 0, "total": 125 },
"fullScreenPasses": { "count": 31, "passes": [ ... ] },
"largestPasses": [ { "ordinal": 12, "label": "...", "loadBytes": ..., "storeBytes": ... }, ... ]
}
One full-screen equivalent is one load or one store of a target the size and format of reference, which is the canvas (or the frame's largest render target when the capture has no canvas). fullScreenPasses.count is the number of passes whose target has at least 90% of the reference's pixels.
A bad result is a fullScreenEquivalents.total in the dozens or hundreds, a large loadBytes (every loaded byte was stored by an earlier pass, so loads come in pairs with stores), and a fullScreenPasses.count much larger than the number of things the frame conceptually renders. largestPasses lists the passes that move the most, largest first, and each entry of passes has the detail:
{ "ordinal": 12, "label": "vegetation", "target": { "width": 1280, "height": 720, "sampleCount": 1 },
"resolutionScale": 1, "loadBytes": 33177600, "storeBytes": 33177600,
"attachments": [
{ "attachment": "color 0", "resource": "\"albedo\"", "format": "rgba8unorm", "width": 1280, "height": 720,
"sampleCount": 1, "loadOp": "load", "storeOp": "store", "resolve": false, "loadBytes": 3686400, "storeBytes": 3686400 },
...
{ "attachment": "depth-stencil", "resource": "\"depth\"", "format": "depth32float", ..., "depthLoadOp": "load", "depthStoreOp": "store", ... }
] }
In DevTools, the Render Graph report shows the same totals in a line under its summary, and hovering a pass in the chart lists its size, what it loads and stores, and each attachment's load and store op.
The findings of get_render_graph (also in get_frame_issues, and under Suggestions in the Render Graph report) name the loads and stores that need not happen. Each has a bytes total and a details list.
| Rule | What it means | What to do |
|---|---|---|
mergeable-passes |
A render pass loads what an earlier pass stored, and the two can be recorded as one. details gives earlier, later, the attachments, bytesSaved, and moved: the passes between them that would have to run before the first ("where": "before") or after the second. |
Draw both in one render pass. Move the named passes. When the two passes' attachment lists differ, give both the longer list, with writeMask: 0 in the pipelines that don't write a target. |
reopened-target |
A render pass reloads an attachment an earlier pass stored, and they cannot simply be merged. details gives reloadBytes, and reason with reasonText: intervening-pass (a pass between them samples or writes the attachment; blockedBy names it), samples-earlier-attachment (the later pass samples what the earlier one renders to), different-attachments, clears-shared-attachment or shared-resource. |
Remove what the reason names: sample a copy made once instead of the live target, reorder the pass in between, or align the attachment lists so the pair becomes mergeable. Some reopens are necessary; see Limits. |
copy-through-pass |
A pass that is a single draw of 3, 4 or 6 vertices, sampling a texture of the same size and format as the new target it clears and writes. | Do the same work as a blended draw into the source, or as the last draw of the pass that renders the source, or the first of the pass that reads the result. |
unread-store |
An attachment is stored and nothing later in the capture reads it. | Use storeOp: "discard". A target the next frame reads (a history buffer) looks unread in a single frame; check before changing it. |
msaa-store |
A multisampled attachment is stored as well as resolved, and nothing reads the samples. | Use storeOp: "discard" on the multisampled attachment and keep the resolve. |
bound-never-written |
A color attachment is bound to a pass in which every draw's pipeline has writeMask: 0 for it. It is still loaded or cleared, and stored. |
Leave the attachment out of that pass. |
A bad result is several mergeable-passes pairs on full-screen targets, each with a bytesSaved in the tens of megabytes.
4. Check Hidden-Surface Removal
get_bottlenecks gives each render pass that writes depth, or has draws of the kind described here, a hiddenSurfaceRemoval object:
"hiddenSurfaceRemoval": {
"depthWrites": true, "draws": 412, "unskippableDraws": 380, "unskippableDrawShare": 0.922,
"byFeature": { "discard": 380, "fragDepth": 0, "alphaToCoverage": 0 },
"unskippableFragmentShare": 0.87, "opaqueAfterAlphaTest": 31
}
unskippableDraws counts the draws whose fragment shader can discard or write frag_depth, or whose pipeline uses alpha-to-coverage. Whether a shader can discard is read from its syntax tree, following calls from its entry point, so a discard in a function the entry point never calls does not count. unskippableFragmentShare is the share of the pass's rasterized fragments those draws produce; it is present when the fragment counts were measured, which needs a browser the plugin controls (launch_browser).
Two findings come from it, in get_bottlenecks and get_frame_issues and in the GPU Bottlenecks and Frame Issues reports:
discard-in-opaque-pass: more than half the draws of a depth-writing pass can discard. This usually means one shader serves both opaque and alpha-tested materials, and contains adiscardbehind a material flag. The GPU cannot know the flag is off. Compile a variant withoutdiscardfor opaque materials.opaque-after-alpha-test: an opaque draw follows alpha-tested draws in the same pass. Draw opaque geometry first, then alpha-tested, then blended.
An app that scales its render resolution to hold a frame rate can hide a problem: the frame rate looks acceptable because the app is rendering a quarter of the pixels.
get_capture_summary returns summary.canvas, with the canvas's drawing-buffer width and height and, when the page recorded them, cssWidth, cssHeight and devicePixelRatio. Each pass in get_render_graph and analyze_performance has a resolutionScale: its target width divided by the canvas width. A main scene pass at 0.5 is rendering a quarter of the canvas's pixels.
For a capture of several frames, summary.frames lists them:
"frames": [
{ "frame": 0, "frameNumber": 4410, "commandRange": [0, 2817], "renderPasses": 58, "computePasses": 6, "draws": 1904,
"gpuMs": 17.3, "mainTarget": { "width": 1280, "height": 720, "pass": "gbuffer" } },
{ "frame": 1, "frameNumber": 4411, "commandRange": [2818, 5630], ...,
"mainTarget": { "width": 1024, "height": 576, "pass": "gbuffer" } }
]
A mainTarget that changes size between frames is dynamic resolution at work. get_capture_summary, analyze_performance, get_render_graph, get_frame_issues and get_bottlenecks take a frame parameter (the frame value above) to analyze one frame; without it they cover all captured frames together, so pass an explicit frame when reading bandwidth totals. A pass that appears in every frame with the same draws, such as a distant shadow level, is a candidate for rendering less often.
Two measurements work without timestamp queries. Both need the page open on the device in a browser the plugin controls.
get_frame_stats reports gpuLatencyMs (mean, p50, p90, samples) next to its CPU numbers: the time from each frame's last queue.submit() to queue.onSubmittedWorkDone() resolving. Unlike the frame interval it is not capped by the display's refresh rate. It includes the trip to the browser's GPU process, so use it to compare, not as an absolute GPU time. frameIntervalMs has the same statistics for the frame interval.
ablate_passes turns part of a render pass off on the live page and measures how much faster the frame gets. Passes are selected by label: ablate_passes({ pass: "gbuffer" }) for one (an exact label, otherwise a regular expression, whose matches are ablated together), or no pass to try each labeled render pass in turn. For each it runs two modes against the unmodified page, alternating in blocks so that drift cancels:
scissorgives the pass a 1x1 scissor rectangle. Vertex work and the loads and stores remain; fragment work goes.skip-drawsdrops the pass's draw calls. Only its loads, stores and fixed overhead remain.
The result for a pass:
{ "pass": "lighting", "matchedLabels": ["lighting"], "matchedBy": "exact",
"modes": {
"scissor": { "baseline": {...}, "ablated": {...},
"saved": { "frameIntervalMs": { "savedMs": 0, "noiseMs": 0.5, "significant": false },
"gpuLatencyMs": { "savedMs": 6.1, "noiseMs": 0.6, "significant": true } },
"passesAblatedPerFrame": 1 },
"skip-draws": { ..., "saved": { ..., "gpuLatencyMs": { "savedMs": 6.4, "noiseMs": 0.6, "significant": true } } }
},
"classification": "fragment-bound", "basis": "gpuLatencyMs", "explanation": "..." }
Read classification as follows.
fragment-bound: the scissor saves most of what dropping the draws saves. The pass's cost is shading: resolution, overdraw, shader cost.geometry-bound: dropping the draws helps and the scissor does not. The cost is vertex processing, triangle count and draw calls.mixed: both matter.bandwidth/fixed: neither mode changes the frame by more than the noise. The pass's draws are not what it costs. What is left is its loads and stores, which step 2 sizes, or the pass is simply cheap.
saved is baseline minus ablated, on medians; noiseMs is the threshold a saving has to exceed to be significant. The top-level vsyncCapped is true when the frame interval sits at the refresh period: then removing work cannot shorten the interval and only gpuLatencyMs moves, which is why basis names the metric the classification used. The page renders wrong images while this runs, and is restored when it finishes. Removing a pass's output can change what later passes cost, so a saving is the pass plus its effect downstream.
Capture again after a change and call compare_captures({ captureA, captureB }). Its bandwidth object has loadBytes, storeBytes, copyBytes and totalBytes, each as { a, b, delta }, plus fullScreenEquivalents and fullScreenPasses. Each entry of passChanges has bandwidthBytes, loadBytes and storeBytes when they changed. None of this needs timestamps, so it is a dependable way to confirm that a restructuring removed the loads and stores it was meant to. Then confirm on the device with get_frame_stats.
Both captures should hold the same number of frames, or the totals differ for that reason alone.
The numbers below are an illustration of what the reports show for a deferred renderer at 1280x720, not measurements of a particular app.
The G-buffer. The G-buffer has five color targets and a depth buffer, 40 bytes per pixel together. It is filled by three consecutive render passes: opaque geometry, then two vegetation passes, with compute passes between them that prepare the vegetation's instance data. The vegetation passes bind only the targets they write.
get_render_graph shows the first pass storing 40 bytes per pixel, the second loading and storing 36, and the third loading and storing 20: about 150 bytes per pixel of traffic, where one pass storing 40 would do. It reports mergeable-passes for both vegetation passes. Each pass's attachments are a subset of the pass before it, which the rule accepts, and each entry of details lists the compute passes in moved with "where": "before": they read nothing the opaque pass writes, so they can run ahead of it. The finding's message adds that the pipelines of the pass with fewer attachments have to declare the others, because a pipeline must match the attachments of the pass it is used in.
So the fix has three parts. Give the vegetation passes the same attachment list as the opaque pass, with writeMask: 0 on the targets their pipelines do not write. Move the compute passes ahead of the opaque pass. Then draw all three in one render pass. Had a vegetation pass bound a target the opaque pass lacks while leaving out others, the report would have shown reopened-target with "reason": "different-attachments" instead, and the first step would be the same.
The lit scene. The lit scene color is produced by a chain: a pass that clears it and draws the sky, a lighting pass that loads it, and a pass for local lights that loads it again. These are reported as mergeable-passes directly. Drawn as one pass, two stores and two loads of a 16-bit float target go away.
A shadow level. The bandwidth list shows a 2048x2048 depth target stored by a pass with several hundred draws, and get_render_graph with frame set to 0, 1 and 2 shows the same pass with the same draw count in each captured frame. It is the farthest shadow level, which changes slowly. Rendering it every few frames removes most of its cost.
Discard in the opaque shader. get_bottlenecks reports discard-in-opaque-pass on the G-buffer pass with unskippableDrawShare above 0.9. The material shader contains discard for alpha-tested and dithered materials, selected by a uniform that is off for most draws. A variant compiled without discard for opaque materials, together with drawing opaque geometry nearest first, lets the GPU reject hidden fragments again.
The result. In this example compare_captures shows the pass count going from 58 to 47 and bandwidth.totalBytes from about 460 MB to about 230 MB per frame. ablate_passes on the device, before and after, shows what that was worth in frame time.
- The bandwidth model counts bytes, not time. It says how much render-target memory the frame's passes load and store. How long that takes depends on the device, and a driver may avoid some of it. Use it to find and rank candidates, and
ablate_passesandget_frame_statsto measure. - Depth formats are sized nominally.
depth24pluscounts as 4 bytes and a stencil aspect as 1; what the device allocates may differ. - The fragment counts come from a replay on the analysis machine. The rasterized and surviving fragment counts in
get_bottlenecksare measured by replaying the capture on the GPU of the machine running the analysis. The counts are properties of the geometry and transfer to the device; any timing from a replay does not. - Discard is detected statically. A
discardreachable from the entry point counts even if a uniform or a constant keeps it from running. That matches what the GPU can know, which is why a discard-free shader variant is the fix, but the report cannot tell how often the discard is taken. - The graph sees the captured frames only. A target that the next frame reads looks unread, and
unread-storesays so. - Some passes cannot be merged. WebGPU has no way for a fragment shader to read the attachment it is rendering to. A pass that samples the scene color and writes a new version of it (refraction, distortion, a composite that reads what is behind it) needs the earlier pass to end and its target to be stored first.
reopened-targetreports these withsamples-earlier-attachmentorintervening-pass; they are a cost of the effect, to be reduced by sampling a smaller copy or by doing several such effects in one pass, not removed. - Ablation changes the frame. A pass whose output is missing can make later passes cheaper or dearer. Treat the classification as a strong hint, and confirm a fix by measuring the fixed frame.
- The panel and the plugin overlap but are not the same. The bandwidth line, the pass findings and the hidden-surface-removal findings are in the DevTools reports. Selecting one frame of a multi-frame capture,
resolutionScale, GPU latency andablate_passesare plugin tools.