# ash-rs/ash architecture

> Architecture diagram of the GitHub repository ash-rs/ash, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ash-rs/ash
- Repository: https://github.com/ash-rs/ash

## Overview

Ash is a low-level Rust wrapper for Vulkan: an application loads Vulkan entry points, creates an instance and device, then uses typed bindings and explicitly loaded extension dispatch to issue Vulkan operations. Major capability branches include window-system surfaces and swapchains, graphics and ray-tracing extensions, video bindings, and profiling/diagnostic extensions. The README documents loader and safety behavior; sampled source confirms representative extension calls and surface creation, but does not expose all dispatch wiring.

Main entry points: [`ash/src/extensions_generated.rs`](https://github.com/ash-rs/ash/blob/master/ash/src/extensions_generated.rs) (Extension dispatch), [`ash/src/instance.rs`](https://github.com/ash-rs/ash/blob/master/ash/src/instance.rs) (Instance API), [`ash-window/src/lib.rs`](https://github.com/ash-rs/ash/blob/master/ash-window/src/lib.rs) (Surface creation helper), [`ash/src/vk.rs`](https://github.com/ash-rs/ash/blob/master/ash/src/vk.rs) (Vulkan types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core Vulkan API"]
  node_loader["Entry loader<br/>[entry.rs]"]
  node_instance["Instance API<br/>[instance.rs]"]
  node_device["Device API<br/>[device.rs]"]
  node_dispatch["Function tables<br/>[tables.rs]"]
end

subgraph group_extensions["Vulkan Extensions"]
  node_extension_dispatch["Extension dispatch"]
  node_surface["Surface and swapchain<br/>[swapchain.rs]"]
  node_ray["Ray tracing"]
  node_video["Vulkan video<br/>[video_queue.rs]"]
  node_profiling["Profiling and diagnostics"]
end

subgraph group_window["Window Integration"]
  node_window_helper["Surface creation helper<br/>[lib.rs]"]
end

subgraph group_bindings["Typed Bindings"]
  node_vk["Vulkan types<br/>[vk.rs]"]
  node_vkdefs["Type definitions<br/>[definitions.rs]"]
  node_vkfeatures["Features and flags<br/>[features.rs]"]
end

node_app(("Vulkan application"))
node_os_window(("Window system"))
node_vulkan_loader["Vulkan loader and driver"]

node_app -->|"loads entry"| node_loader
node_loader -->|"loads library"| node_vulkan_loader
node_app -->|"creates instance"| node_instance
node_instance -->|"loads instance functions"| node_dispatch
node_instance -->|"creates device"| node_device
node_device -->|"loads device functions"| node_dispatch
node_app -->|"issues commands"| node_device
node_app -->|"uses typed API"| node_vk
node_vk -->|"defines handles"| node_vkdefs
node_vk -->|"defines features"| node_vkfeatures
node_app -->|"loads extensions"| node_extension_dispatch
node_extension_dispatch -->|"dispatches calls"| node_surface
node_extension_dispatch -->|"dispatches calls"| node_ray
node_extension_dispatch -->|"dispatches calls"| node_video
node_extension_dispatch -->|"dispatches calls"| node_profiling
node_app -.->|"requests surface"| node_window_helper
node_window_helper -.->|"uses handles"| node_os_window
node_window_helper -.->|"creates surface"| node_surface
node_app -->|"uses swapchain"| node_surface

click node_loader "https://github.com/ash-rs/ash/blob/master/ash/src/entry.rs"
click node_instance "https://github.com/ash-rs/ash/blob/master/ash/src/instance.rs"
click node_device "https://github.com/ash-rs/ash/blob/master/ash/src/device.rs"
click node_dispatch "https://github.com/ash-rs/ash/blob/master/ash/src/tables.rs"
click node_vk "https://github.com/ash-rs/ash/blob/master/ash/src/vk.rs"
click node_vkdefs "https://github.com/ash-rs/ash/blob/master/ash/src/vk/definitions.rs"
click node_vkfeatures "https://github.com/ash-rs/ash/blob/master/ash/src/vk/features.rs"
click node_extension_dispatch "https://github.com/ash-rs/ash/blob/master/ash/src/extensions_generated.rs"
click node_surface "https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/swapchain.rs"
click node_ray "https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/ray_tracing_pipeline.rs"
click node_video "https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/video_queue.rs"
click node_profiling "https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/performance_query.rs"
click node_window_helper "https://github.com/ash-rs/ash/blob/master/ash-window/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_loader,node_instance,node_device,node_dispatch toneBlue
class node_extension_dispatch,node_surface,node_ray,node_video,node_profiling toneAmber
class node_window_helper toneMint
class node_vk,node_vkdefs,node_vkfeatures toneRose
class node_app,node_os_window,node_vulkan_loader toneIndigo
```

## Components

### Core Vulkan API

- [Entry loader](https://github.com/ash-rs/ash/blob/master/ash/src/entry.rs): `ash/src/entry.rs`
- [Instance API](https://github.com/ash-rs/ash/blob/master/ash/src/instance.rs): `ash/src/instance.rs`
- [Device API](https://github.com/ash-rs/ash/blob/master/ash/src/device.rs): `ash/src/device.rs`
- [Function tables](https://github.com/ash-rs/ash/blob/master/ash/src/tables.rs): `ash/src/tables.rs`

### Vulkan Extensions

- [Extension dispatch](https://github.com/ash-rs/ash/blob/master/ash/src/extensions_generated.rs): `ash/src/extensions_generated.rs`
- [Surface and swapchain](https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/swapchain.rs): `ash/src/extensions/khr/swapchain.rs`
- [Ray tracing](https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/ray_tracing_pipeline.rs): `ash/src/extensions/khr/ray_tracing_pipeline.rs`
- [Vulkan video](https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/video_queue.rs): `ash/src/extensions/khr/video_queue.rs`
- [Profiling and diagnostics](https://github.com/ash-rs/ash/blob/master/ash/src/extensions/khr/performance_query.rs): `ash/src/extensions/khr/performance_query.rs`

### Window Integration

- [Surface creation helper](https://github.com/ash-rs/ash/blob/master/ash-window/src/lib.rs): `ash-window/src/lib.rs`

### Typed Bindings

- [Vulkan types](https://github.com/ash-rs/ash/blob/master/ash/src/vk.rs): `ash/src/vk.rs`
- [Type definitions](https://github.com/ash-rs/ash/blob/master/ash/src/vk/definitions.rs): `ash/src/vk/definitions.rs`
- [Features and flags](https://github.com/ash-rs/ash/blob/master/ash/src/vk/features.rs): `ash/src/vk/features.rs`

### Other components

- **Vulkan application**
- **Window system**
- **Vulkan loader and driver**

## Connections

- Vulkan application → Entry loader: loads entry
- Entry loader → Vulkan loader and driver: loads library
- Vulkan application → Instance API: creates instance
- Instance API → Function tables: loads instance functions
- Instance API → Device API: creates device
- Device API → Function tables: loads device functions
- Vulkan application → Device API: issues commands
- Vulkan application → Vulkan types: uses typed API
- Vulkan types → Type definitions: defines handles
- Vulkan types → Features and flags: defines features
- Vulkan application → Extension dispatch: loads extensions
- Extension dispatch → Surface and swapchain: dispatches calls
- Extension dispatch → Ray tracing: dispatches calls
- Extension dispatch → Vulkan video: dispatches calls
- Extension dispatch → Profiling and diagnostics: dispatches calls
- Vulkan application → Surface creation helper: requests surface
- Surface creation helper → Window system: uses handles
- Surface creation helper → Surface and swapchain: creates surface
- Vulkan application → Surface and swapchain: uses swapchain
