RepoPilotOpen in app →

gfx-rs/gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.

Healthy

Healthy across all four use cases

weakest axis
Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • 15 active contributors
  • Apache-2.0 licensed
  • CI configured
Show all 6 evidence items →
  • Tests present
  • Stale — last commit 3y ago
  • Concentrated ownership — top contributor handles 52% of recent commits

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/gfx-rs/gfx)](https://repopilot.app/r/gfx-rs/gfx)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/gfx-rs/gfx on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: gfx-rs/gfx

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/gfx-rs/gfx shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across all four use cases

  • 15 active contributors
  • Apache-2.0 licensed
  • CI configured
  • Tests present
  • ⚠ Stale — last commit 3y ago
  • ⚠ Concentrated ownership — top contributor handles 52% of recent commits

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live gfx-rs/gfx repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/gfx-rs/gfx.

What it runs against: a local clone of gfx-rs/gfx — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in gfx-rs/gfx | Confirms the artifact applies here, not a fork | | 2 | License is still Apache-2.0 | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 1196 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>gfx-rs/gfx</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of gfx-rs/gfx. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/gfx-rs/gfx.git
#   cd gfx
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of gfx-rs/gfx and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "gfx-rs/gfx(\\.git)?\\b" \\
  && ok "origin remote is gfx-rs/gfx" \\
  || miss "origin remote is not gfx-rs/gfx (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
  && ok "license is Apache-2.0" \\
  || miss "license drift — was Apache-2.0 at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "src/hal" \\
  && ok "src/hal" \\
  || miss "missing critical file: src/hal"
test -f "Cargo.toml" \\
  && ok "Cargo.toml" \\
  || miss "missing critical file: Cargo.toml"
test -f "src/backend/vulkan" \\
  && ok "src/backend/vulkan" \\
  || miss "missing critical file: src/backend/vulkan"
test -f "src/backend/dx12" \\
  && ok "src/backend/dx12" \\
  || miss "missing critical file: src/backend/dx12"
test -f "src/auxil/auxil/src/lib.rs" \\
  && ok "src/auxil/auxil/src/lib.rs" \\
  || miss "missing critical file: src/auxil/auxil/src/lib.rs"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 1196 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~1166d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/gfx-rs/gfx"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

gfx-rs is a low-level, Vulkan-like hardware abstraction layer (HAL) for GPU graphics and compute in Rust that translates API calls to native backends (Vulkan, DirectX 12/11, Metal, OpenGL/WebGL). It provides unsafe but performant cross-platform graphics abstractions consumed by engines and libraries that need tight control over GPU resources. Monorepo (Cargo workspace) with src/hal/ as the core HAL trait definitions, src/backend/{vulkan,dx12,dx11,metal,gl,webgpu}/ containing backend implementations, src/auxil/ with shared utilities (range-alloc, renderdoc), src/warden/ for reference testing, and examples/ with runnable demos (quad, colour-uniform, compute, mesh-shading).

👥Who it's for

Performance-sensitive graphics libraries, game engines, and rendering frameworks that need cross-platform GPU abstraction without the safety overhead of higher-level APIs. Not recommended for application developers—use wgpu-rs instead.

🌱Maturity & risk

gfx-hal is now in maintenance mode as of v0.9 (2021). Development shifted to wgpu-hal when wgpu became the primary consumer. The project has solid CI via GitHub Actions (see .github/workflows/CI.yml), comprehensive examples, and multiple production-quality backends, but active feature development has stopped.

High risk: gfx-hal is explicitly in maintenance mode with only critical bug fixes expected. The ecosystem shifted to wgpu-hal, reducing community momentum. Monorepo spans 6 backends (Vulkan, DX12, DX11, Metal, GL, WebGPU) meaning complexity is distributed; a single backend bug affects many dependents. No active security monitoring visible beyond basic deny.toml dependency checks.

Active areas of work

Repository is in maintenance mode—no active development visible from the description. Recent work likely focused on keeping backends compatible with OS updates and fixing reported bugs. The README explicitly directs new users toward wgpu-rs instead.

🚀Get running

git clone https://github.com/gfx-rs/gfx.git
cd gfx
cargo build -p gfx-hal
cargo run --example quad

Daily commands: Use Makefile (see Makefile in root) or cargo directly: cargo build --workspace builds all backends. Run examples with cargo run --example quad (requires native GPU driver). Run tests with cargo test --all.

🗺️Map of the codebase

  • src/hal — Core HAL (Hardware Abstraction Layer) traits and types that define the cross-platform GPU API contract; every backend and consumer depends on this.
  • Cargo.toml — Workspace root configuration managing all backend crates (dx11, dx12, metal, vulkan, webgpu, gl) and their inter-dependencies.
  • src/backend/vulkan — Vulkan backend implementation; primary reference backend for the Vulkan-like API design philosophy.
  • src/backend/dx12 — DirectX 12 backend with command recording and descriptor management; critical for Windows GPU abstraction.
  • src/auxil/auxil/src/lib.rs — Shared auxiliary utilities used across all backends (format conversions, memory helpers, debug tools).
  • README.md — Explains maintenance mode status, v0.9 deprecation, and wgpu migration path—essential context for all contributors.
  • CHANGELOG.md — Historical evolution and breaking changes across versions; required reading to understand API stability and design decisions.

🛠️How to make changes

Add a New GPU Feature to HAL

  1. Define the new trait method or type in the HAL core (e.g., new Queue capability, new Image format support). (src/hal)
  2. Implement the trait in each backend that supports it. Start with the reference Vulkan implementation. (src/backend/vulkan/src/lib.rs)
  3. Add fallback/stub implementations in backends that don't support the feature (return Err or UnsupportedFeature). (src/backend/dx12/src/lib.rs)
  4. Write an example or warden test demonstrating the new feature. (examples/quad/main.rs)
  5. Update CHANGELOG.md with breaking change notes if applicable. (CHANGELOG.md)

Fix a Backend-Specific Bug

  1. Locate the backend implementation (e.g., device.rs, command.rs for DX12). (src/backend/dx12/src/device.rs)
  2. Check auxiliary conversion helpers for format/layout mismatches. (src/auxil/auxil/src/lib.rs)
  3. Add or update a warden test case to verify the fix across all backends. (src/warden)
  4. Run CI locally or push to verify all platforms: cargo test --all. (.github/workflows/CI.yml)

Add Support for a New Platform

  1. Create a new backend directory under src/backend/{platform}/ with Cargo.toml. (src/backend/empty)
  2. Implement all required HAL traits (Instance, Device, Queue, CommandBuffer, etc.). (src/backend/empty)
  3. Register the new backend in the root workspace Cargo.toml. (Cargo.toml)
  4. Update CI matrix to test the new platform and add feature flags. (.github/workflows/CI.yml)

🔧Why these technologies

  • Rust with unsafe blocks for FFI and manual memory management — Low-overhead abstraction: minimal runtime overhead while maintaining memory safety guarantees for safe API surface
  • Trait-based abstraction (Instance, Device, Queue, CommandBuffer) — Enables zero-cost polymorphism; concrete backend types are monomorphized at compile time with no vtable indirection
  • Multiple backends (Vulkan, DX12, Metal, GL, WebGPU) — Cross-platform portability; allows one application to target all major graphics APIs via single HAL
  • Naga shader compilation (patched dependency) — Decouples application from GLSL/HLSL/SPIR-V details; shader translation across backends

⚖️Trade-offs already made

  • Maintenance mode (v0.9+): gfx-hal is frozen; wgpu moved to wgpu-hal

    • Why: wgpu drove most HAL development but has different design goals; maintaining two abstraction layers was inefficient
    • Consequence: gfx-hal receives only critical bugfixes; new projects should use wgpu-hal instead
  • Require explicit backend implementation for new features

    • Why: Prevents polyfills that hide platform limitations; forces API to remain realistic and portable
    • Consequence: Adding a feature requires coordinated work across 6+ backends; slow iteration but high portability
  • Immediate-mode GPU commands (submit, then wait) vs. task graphs

    • Why: Simpler API surface, matches native Vulkan/DX12 submission model closely
    • Consequence: No automatic reordering, batching, or GPU-driven rendering; application must manage CPU-GPU sync
  • Separate memory pools/heaps per backend (not unified allocator)

    • Why: Reflects hardware reality: DX12 descriptor heaps, Vulkan device memory types differ fundamentally
    • Consequence: Application must use backend-specific memory strategies; no one-size-fits-all allocator

🚫Non-goals (don't propose these)

  • High-level rendering API (no scene graph, no materials library)
  • Automatic GPU memory management or garbage collection
  • Shader preprocessing or macro system (use Naga separately)
  • Runtime validation or error recovery (validation only in debug mode)
  • Real-time performance monitoring or profiling (rely on RenderDoc)
  • Support for deprecated graphics APIs (DX9, OpenGL ES 2.0)

🪤Traps & gotchas

Unsafe by design: gfx-hal exposes raw GPU operations without memory safety; GPU memory leaks, use-after-free, and synchronization bugs are on the caller. Backend selection is compile-time (feature flags) not runtime, so switching backends requires recompiling. SPIR-V shaders must be precompiled (see .spv files in examples/); inline GLSL is not supported. The Vulkan backend requires Vulkan SDK and drivers; DX12/DX11 require Windows; Metal requires macOS/iOS; GL works everywhere but is slower. No async/await support—all operations are synchronous.

🏗️Architecture

💡Concepts to learn

  • Hardware Abstraction Layer (HAL) — gfx-hal IS a HAL; understanding the abstraction boundary between platform-agnostic trait definitions and platform-specific backend implementations is fundamental to navigating the codebase
  • Vulkan GPU Synchronization Model — gfx-hal's API surface is modeled after Vulkan's semaphores, fences, and pipeline stages; understanding memory ordering, queue synchronization, and hazards is required to write correct backends
  • Trait-based Polymorphism in Rust — Each backend implements gfx-hal's Device, Queue, CommandBuffer traits; Rust's trait system enables compile-time backend selection and zero-cost abstraction
  • Command Buffers & Deferred Execution — Core to gfx-hal's design: render commands are recorded into CommandBuffer objects and submitted later for asynchronous GPU execution; eliminates immediate-mode API overhead
  • SPIR-V Binary Shader Format — gfx-hal uses SPIR-V intermediate representation (see .spv files in examples/); backends translate SPIR-V to native shaders (HLSL bytecode, Metal IR, GLSL), enabling cross-platform shader reuse
  • Descriptor Sets & Resource Binding — Vulkan-style descriptor sets (buffers, images, samplers bound as groups) are fundamental to gfx-hal's resource model; each backend must efficiently map this abstraction to native binding mechanisms
  • Cross-platform Memory Model — Different backends have different alignment, layout, and lifetime requirements (DX12 staging buffers, Metal memoryless textures, GL sync objects); gfx-auxil abstracts these with its range-alloc and memory management utilities
  • gfx-rs/wgpu — Successor to gfx-hal; now uses wgpu-hal instead of gfx-hal as its GPU abstraction, representing the ecosystem's evolution toward safer APIs
  • gfx-rs/wgpu-hal — Drop-in replacement for gfx-hal developed within wgpu; cleaner API design and active development, recommended for new projects
  • gfx-rs/naga — Shader translation infrastructure (see [patch] section in Cargo.toml); converts between HLSL, GLSL, SPIR-V, and native backends—critical for cross-platform shader support
  • gfx-rs/portability — Uses gfx-hal as the backend for exposing Vulkan API on non-Vulkan platforms (macOS, Windows via DX); demonstrates real-world gfx-hal consumption
  • khronos/Vulkan-Docs — gfx-hal API design is based on Vulkan spec; understanding Vulkan semantics (synchronization, pipeline stages, descriptor sets) is essential for backend implementation

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive backend feature matrix documentation in info/

The repo supports multiple backends (dx11, dx12, gl, metal, vulkan, webgpu) but there's no centralized documentation comparing feature support across backends. This is critical for maintenance mode to help users understand which backend to target. The info/ directory already contains getting_started.md and research.md but lacks a feature compatibility matrix.

  • [ ] Create info/backend-features.md documenting feature support (e.g., compute shaders, mesh shading, external memory) across dx11, dx12, gl, metal, vulkan, webgpu
  • [ ] Reference specific backend crates (src/backend/*/Cargo.toml) to identify their current capabilities
  • [ ] Cross-reference with examples/ (compute, mesh-shading, colour-uniform) to show which examples work on which backends
  • [ ] Link this matrix from README.md and CONTRIBUTING.md to surface it to new contributors

Add integration tests for backend interoperability with external-memory

The src/auxil/external-memory crate handles fd.rs, handle.rs, and ptr.rs for cross-platform memory sharing, but there are no visible integration tests verifying this works across backends. For a maintenance-mode library, these tests are critical to prevent regressions when dependencies update.

  • [ ] Create src/warden/tests/ directory (warden is listed as a workspace member) or add tests/ directory at workspace root
  • [ ] Write integration tests that allocate external memory via external-memory and validate it works with vulkan, metal, and dx12 backends
  • [ ] Test the three external-memory types (fd, handle, ptr) against their appropriate platforms (Linux/Unix, Windows, generic)
  • [ ] Add test execution to .github/workflows/CI.yml for these new integration tests

Refactor and document the auxil workspace split (auxil, external-memory, range-alloc)

There are three separate auxil crates (src/auxil/auxil, external-memory, range-alloc) but no clear documentation on why they're split or how they interact. Contributors adding utility code won't know which crate to modify. A design document and clearer module boundaries would improve maintainability.

  • [ ] Create info/auxil-architecture.md explaining the purpose of each auxil crate: core utilities (auxil), memory/handle abstractions (external-memory), and allocator (range-alloc)
  • [ ] Add module-level doc comments to src/auxil/auxil/src/lib.rs, src/auxil/external-memory/src/lib.rs, and src/auxil/range-alloc/src/lib.rs
  • [ ] Reference this document in .github/CONTRIBUTING.md in a new 'Architecture' section for where to add utility code
  • [ ] Verify Cargo.toml dependencies between auxil crates are clearly documented (what depends on what)

🌿Good first issues

  • Add missing documentation examples for the Device trait in src/hal/src/lib.rs—many backend implementors stumble on the Device::create_command_pool contract, a worked example would help
  • Expand examples/bench/main.rs with timing comparisons across all backends (Vulkan, Metal, DX12); currently it lacks structured performance baseline data that maintainers could reference
  • Add integration tests in src/warden/tests/ for the compute shader example (examples/compute/shader/collatz.comp) across all backends—compute support exists but test coverage is minimal compared to graphics tests

Top contributors

Click to expand

📝Recent commits

Click to expand
  • bc77309 — added support for aarch64 ios simulator (#3783) (geertbleyen)
  • 2c8db0b — Merge #3782 (bors[bot])
  • 2312ef3 — fix: readWriteTextureSupport is support on macOS 10.13+ / iOS 11.0 (xiaopengli89)
  • 2e8a2ff — Merge #3781 (bors[bot])
  • 80c8242 — Fix broken links. (meowjesty)
  • dc0fdb2 — [dx12] handle dynamic offsets in all descriptor kinds (kvark)
  • d518576 — Merge #3777 (bors[bot])
  • 1b35a7b — Bump version and add changelog (cwfitzgerald)
  • bb88c1e — Merge #3776 (bors[bot])
  • 2ab5fec — Bump metal-rs to 0.23 (cwfitzgerald)

🔒Security observations

The gfx-rs codebase demonstrates reasonable security practices with a deny.toml configuration present for dependency management. However, the project's maintenance-mode status is the primary security concern, as it limits the frequency and responsiveness of security updates. The complexity of the multi-backend architecture and workspace structure increases the difficulty of comprehensive security audits. No immediate critical vulnerabilities were identified based on file structure analysis, but reliance on this library for new projects should be carefully considered. The presence of pre-compiled shader binaries and commented-out local patches represents minor concerns that should be documented and monitored.

  • Medium · Maintenance Mode with Limited Security Updates — README.md, Project Status. The gfx-hal library is explicitly in maintenance mode as of v0.9 release. This means the project may not receive timely security updates for vulnerabilities discovered in dependencies or the codebase itself. Maintenance mode typically implies minimal active development and patch cycles. Fix: For production use, consider evaluating actively maintained graphics libraries. If using gfx-hal, implement a strict dependency audit process and monitor security advisories via cargo-audit and advisory databases.
  • Medium · Workspace Dependency Management Complexity — Cargo.toml workspace configuration. The workspace contains 13 member crates across multiple backends (dx11, dx12, gl, metal, vulkan, webgpu, empty) with interdependencies. This complexity increases the attack surface and makes it harder to track and manage security updates across all components. Fix: Implement automated dependency scanning using tools like 'cargo-audit', 'cargo-deny' (already present as deny.toml), and CI/CD checks. Regularly update transitive dependencies and maintain a clear dependency tree documentation.
  • Low · Commented-out Dependency Patch — Cargo.toml line: [patch."https://github.com/gfx-rs/naga"]. The Cargo.toml contains a commented-out patch for the naga dependency pointing to a local path. While currently inactive, this indicates local development workflows that could introduce untested code if uncommented. Fix: Document the purpose of this patch clearly. Ensure it's only used in development environments and never in production releases. Consider using feature flags instead if this is for conditional compilation.
  • Low · Pre-compiled Shader Files in Repository — examples/quad/data/quad.frag.spv, examples/quad/data/quad.vert.spv, examples/mesh-shading/data/triangles.mesh.spv. The repository contains pre-compiled SPIR-V shader files (.spv) in examples/. While this is common for examples, pre-compiled binaries should be treated with caution regarding their origin and compilation parameters. Fix: Document the build process and compiler version used for SPIR-V generation. Consider providing build scripts to regenerate these files from source. Verify checksums of pre-compiled assets in CI/CD.
  • Low · Multiple Backend Implementations Increase Code Review Burden — src/backend/ directory structure. Supporting 6+ graphics backend implementations (DirectX 11/12, OpenGL, Metal, Vulkan, WebGPU) significantly increases the codebase size and potential for platform-specific vulnerabilities that may be harder to audit comprehensively. Fix: Maintain separate security audit processes for each backend. Use feature flags to allow users to compile only needed backends, reducing attack surface in production deployments.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · gfx-rs/gfx — RepoPilot