shdrlib-0.1.2 has been yanked.
shdrlib
Three-tier Vulkan rendering in pure Rust. Choose your abstraction.
What is this?
A backend Vulkan library with three tiers of abstraction:
- EZ - One-liners, smart defaults (~30 lines for a triangle)
- EX (recommended) - Explicit control, production-ready (~100 lines for a triangle)
- CORE - Thin Vulkan wrappers, max control (~400 lines for a triangle)
This is NOT a game engine. It's a rendering library. You bring your own windowing.
Quick Start
[]
= "0.1.2"
= "0.38"
EZ Tier - 30 Lines
use *;
const VERTEX_GLSL: &str = r#"
#version 450
vec2 pos[3] = vec2[](vec2(0.0,-0.5), vec2(0.5,0.5), vec2(-0.5,0.5));
void main() { gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0); }
"#;
const FRAGMENT_GLSL: &str = r#"
#version 450
layout(location = 0) out vec4 outColor;
void main() { outColor = vec4(1.0, 0.5, 0.2, 1.0); }
"#;
EX Tier - 100 Lines (Recommended)
use ;
CORE Tier - Maximum Control
use *;
Examples
# EZ tier (learning)
# EX tier (production, recommended)
# CORE tier (advanced)
Features
- Pure Rust - naga for shader compilation, no external tools
- Zero-cost abstractions - All tiers compile to same machine code
- Memory safe - Rust ownership prevents use-after-free
- Flexible - Drop to lower tiers anytime for more control
Documentation
- Quick Start - Triangle in 5 minutes
- User Guide - Full documentation
- API Docs - Or run
cargo doc --open - Examples - Working code for all tiers
Requirements
- Rust 1.82+ (Edition 2024)
- Vulkan 1.3+ with dynamic rendering
- Windows, Linux, or macOS
Status
| Component | Status | Tests |
|---|---|---|
| CORE Tier | Complete | 48 passing |
| EX Tier | Complete | 25 passing |
| EZ Tier | Complete | 3 demos |
Dependencies
- ash 0.38 - Vulkan bindings
- naga 22 - GLSL→SPIR-V compiler
- spirv-reflect 0.2 - Reflection
- thiserror 1.0 - Error handling
License
Dual-licensed under MIT or Apache-2.0.
Contributing
See CONTRIBUTING.md for guidelines.
Getting Started: cargo add shdrlib ash and see QUICKSTART.md