Open-Source Wikis

/

wgpu

/

By the numbers

gfx-rs/wgpu

By the numbers

A statistical snapshot of the wgpu codebase. Data collected on 2026-04-30 from trunk at commit 1ab3b902.

Size

xychart-beta horizontal
    title "Lines of code by language"
    x-axis ["Rust", "WGSL", "Markdown", "GLSL", "TOML", "JavaScript"]
    y-axis "Lines" 0 --> 360000
    bar [347158, 51355, 10376, 5808, 3998, 1475]
Language Lines
Rust (*.rs) 347,158
WGSL (*.wgsl) 51,355
Markdown (*.md) 10,376
GLSL (*.glsl) 5,808
TOML (*.toml) 3,998
JavaScript (*.js) 1,475

The Rust line count is dominated by naga and wgpu-core. The WGSL count is mostly test fixtures under naga/tests/in/wgsl/ plus the example shaders under examples/features/src/*/shader.wgsl.

Source files

771 .rs files in total. Workspace member counts (top-level directories with a Cargo.toml):

Crate Notes
wgpu 33 files in wgpu/src/api/, plus backend/, util/, macros/
wgpu-core 30+ files in wgpu-core/src/, plus subdirectories for command, device, track, lock, ...
wgpu-hal 5 backends (vulkan, metal, dx12, gles, noop), each ~10 files
naga Front-ends, back-ends, IR, validator, processors
tests Custom GPU test harness + integration tests
examples 31 runnable feature demos + 3 standalone copy-paste examples

Largest source files

These are the files most likely to need to be split as they grow.

File Size
naga/src/back/msl/writer.rs 349 KB
naga/src/back/hlsl/writer.rs 214 KB
wgpu-core/src/device/resource.rs 210 KB
naga/src/back/glsl/writer.rs 198 KB
naga/src/front/wgsl/lower/mod.rs 197 KB
naga/src/proc/constant_evaluator.rs 189 KB
naga/src/back/spv/block.rs 183 KB
naga/src/back/spv/writer.rs 163 KB
naga/tests/naga/wgsl_errors.rs 152 KB
wgpu/src/backend/webgpu.rs 150 KB
wgpu-hal/src/vulkan/adapter.rs 144 KB
wgpu-core/src/command/render.rs 140 KB
naga/src/front/spv/next_block.rs 140 KB

The pattern is consistent: code generation, lowering, and validation are inherently long. The device/resource.rs and command/render.rs files in wgpu-core are also heavy because they implement the bulk of the Device and the render-pass APIs respectively.

Activity

Window Commits
Last 90 days 396
Last 365 days 1,321
All time 10,636

Bot-attributed commits

Author class Commits Share
bors[bot] (historical) 1,172 11.0 %
dependabot[bot] 280 2.6 %
renovate[bot] 145 1.4 %
Other bots (factory-droid, github-actions, ...) ~few
Total bot-attributed ~1,597 ~15 %

This is a lower bound on automation: it counts only commits whose author or co-author is a recognizable bot. The bors[bot] count is historical — the project moved to the GitHub merge queue, which doesn't leave a bot author behind. Inline AI tools (Copilot, Claude in editor) leave no trace in git history. The recent influx of commits attributed to "Inner Daemons" is a real human contributor, despite the unusual handle.

Most-changed directories (last 90 days)

Counted as commits touching files inside each directory.

Directory Commits Notable activity
wgpu-core/ 100+ Submission/queue refactors, lock-graph fixes
naga/ 100+ Constant evaluator, WGSL frontend, SPV frontend
wgpu-hal/ 70+ Vulkan descriptor allocator, Metal autorelease/arm64_32, DX12 fence APIs
tests/ 30+ Backend-specific test gating
cts_runner/ tens CTS revision bumps

The wgpu-naga-bridge crate appears for the first time in March 2026 (2026-03-13), separating naga integration from wgpu-core.

Codebase complexity by crate

Approximate file sizes summed per crate root:

Crate Lines (~) Files (~)
naga/src 105,000 130
wgpu-core/src 65,000 35
wgpu-hal/src 80,000 50
wgpu/src 25,000 35
tests/ 10,000 60
examples/features/src 8,000 50
wgpu-types/src 11,000 25

Test fixtures

naga/tests/in/ contains hundreds of small WGSL/GLSL/SPIR-V shaders that drive the snapshot suite. naga/tests/out/ mirrors them with expected output for each backend. Together they're the single largest source of WGSL in the repo.

Test list state

cts_runner/test.lst (42 KB) lists every CTS selector that must pass. cts_runner/fail.lst (15 KB) lists known failures with // xx% pass-rate annotations. cts_runner/skip.lst (~2 KB) lists ≥ 90 %-skipped suites.

Dependencies

The root Cargo.toml holds a [workspace.dependencies] table with ~80 crates. The major external surface:

  • Vulkan via ash (0.38).
  • Metal via objc2 and friends (0.6.x), no third-party metal crate.
  • DX12 via windows (0.62), DXC via mach-dxcompiler-rs, allocator via gpu-allocator.
  • GL via glow (0.17), EGL via khronos-egl, GLSL parsing via pp-rs.
  • WGSL parsing built in. SPIR-V via spirv (0.4) and rspirv (0.13).
  • Wasm via wasm-bindgen (0.2.108), web-sys (0.3.85), js-sys.
  • Deno integration: deno_console, deno_core, deno_features, deno_url, deno_web, deno_webidl — all 200-series releases pinned to specific versions.

Test-to-code ratio

tests/ (the integration test crate) has about 10 K lines for ~95 K lines in wgpu + wgpu-core it primarily exercises. Naga's tests/ is on the same order as its source. The CTS adds external test surface that's much larger than the in-tree suite.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

By the numbers – wgpu wiki | Factory