How gfx-rs/wgpu works
Main Components (Top Level)
• wgpu | | wgpu-core | | wgpu-hal |
• (Public API) | --> | (Safe Core) | --> | (HAL Layer) |
Backend Implementations (Second Level)
• Under the HAL layer, connected with lines:
• Vulkan | | Metal | | DX12 | | OpenGL | | WebGPU |
Supporting Components (Side Components)
• Naga | --> | wgpu-types |
• (Shader)| | (Shared |
• Types) |
Key Features to Highlight
• Blue: Core API components
• Green: Backend implementations
• Yellow: Supporting libraries
• Red: Critical paths/dependencies
• Shader compilation flow through Naga
• Command submission flow from API to backends
• Resource management paths
Integration Points
• WebAssembly integration path
• Platform-specific bridges
• Conformance test integration points
Detailed Component Breakdown
• Resource management
• Command encoding
• Pipeline state
• Memory management
Cross-Cutting Concerns
Horizontal layers showing:
• Safety boundaries
• Platform abstraction
• API compatibility
Implementation Notes
Callouts for:
• WGSL support
• Platform-specific considerations
• Safety guarantees
• Performance characteristics
The WebGPU compliance path
Use consistent visual language:
• Double lines for safety boundaries
Keep the abstraction level appropriate by:
• Focusing on architectural components rather than implementation details
• Highlighting key integration points
• Showing major data flows
• Indicating critical dependencies
• How the components interact
• Where their code fits in the stack
• How data flows through the system
• Where platform-specific code lives
• How safety is maintained