memkit-gpu
High-Performance GPU Memory Management for the Memkit Ecosystem.
๐ Overview
memkit-gpu provides a backend-agnostic GPU memory management layer that bridges the gap between high-level intent and low-level hardware constraints. It allows you to write graphics-heavy applications once and target Vulkan, Metal, or DX12 with minimal changes.
๐ The GPU Advantage
| Feature | System (Global) | memkit-gpu |
|---|---|---|
| Latency | Non-deterministic | Deterministic & Predictable |
| Backend | Native-only | Multi-backend Abstraction |
| Safety | Manual pointer math | Type-safe Staging/Device buffers |
| Efficiency | Ad-hoc transfers | Coalesced & Batched transfers |
โจ Features
- ๐๏ธ Backend-Agnostic โ Write once, run on Vulkan, Metal (WIP), or DX12 (WIP).
- ๐ฆ Staging/Device Split โ Explicit management of CPU-visible and GPU-local memory.
- โก Batch Transfers โ Optimized transfer queues to minimize command buffer overhead.
- ๐๏ธ Smart Pooling โ Reusable buffer pools to eliminate allocation judder.
- ๐งช Dummy Backend โ Full CPU-based GPU simulation for testing without hardware.
๐ ๏ธ Quick Start
use ;
// Initialize with the Dummy backend for testing
let gpu = new;
// Create a staging buffer (CPU-visible)
let vertices: & = &;
let staging = gpu.staging_buffer_with_data.unwrap;
// Create a device-local buffer (GPU-fast)
let device = gpu.create_device_buffer.unwrap;
// Efficiently transfer data from Staging to Device
gpu.transfer.unwrap;
๐ Supported Backends
memkit-gpu is designed as a trait-based system. Enable your preferred backend via features:
| Backend | Feature Flag | Status |
|---|---|---|
| Vulkan | vulkan |
โ Production Ready |
| Dummy | (default) | โ Test/Debug Ready |
| Metal | metal |
๐ง Coming Soon |
| DirectX 12 | dx12 |
๐ง Coming Soon |
Vulkan Setup
[]
= { = "0.1.1-beta.1", = ["vulkan"] }
๐๏ธ Architecture
graph TD
A[User Code] --> B[MkGpu]
B --> C{MkGpuBackend}
C -->|vulkan| D[VulkanBackend]
C -->|dummy| E[DummyBackend]
D --> F[Hardware GPU]
E --> G[CPU Simulation]
โ๏ธ License
Licensed under the Mozilla Public License 2.0. See LICENSE.md for details.