Project 10: Vulkan Renderer

A Vulkan renderer from scratch—device initialization, swapchain, render passes, pipelines, buffers, and drawing a 3D scene with textures and lighting.

Quick Reference

Attribute Value
Primary Language Odin
Alternative Languages C, C++, Rust
Difficulty Level 5: Master
Time Estimate 4-6 weeks
Knowledge Area Graphics / GPU Programming
Tooling Odin’s vendor:vulkan
Prerequisites Project 6 (Software Rasterizer), understanding of GPU concepts

What You Will Build

A Vulkan renderer from scratch—device initialization, swapchain, render passes, pipelines, buffers, and drawing a 3D scene with textures and lighting.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Vulkan initialization boilerplate → maps to handling C APIs in Odin
  • Memory management for GPU resources → maps to custom allocators
  • Pipeline creation → maps to complex struct initialization
  • Synchronization → maps to understanding GPU execution

Key Concepts

  • Vulkan in Odin: vendor:vulkan
  • Vulkan Fundamentals: “Vulkan Programming Guide” or vulkan-tutorial.com
  • GPU Memory: VkBuffer, VkImage, VkDeviceMemory
  • Render Passes: Framebuffers, attachments, subpasses

Real-World Outcome

$ odin run vulkan_renderer -o:speed

[Vulkan] Instance created
[Vulkan] Physical device: NVIDIA GeForce RTX 3080
[Vulkan] Logical device created
[Vulkan] Swapchain: 3 images, 1920x1080, VK_FORMAT_B8G8R8A8_SRGB
[Vulkan] Render pass created
[Vulkan] Graphics pipeline created
[Vulkan] Loading mesh: sponza.obj (262,144 vertices)
[Vulkan] Vertex buffer: 12 MB (GPU memory)
[Vulkan] Loading textures: 24 textures, 89 MB total

[Window opens with real-time 3D rendering]

Controls:
  WASD - Move camera
  Mouse - Look around
  F1 - Toggle wireframe
  F2 - Toggle frustum culling

Stats:
  FPS: 144 (6.9ms frame time)
  Draw calls: 156
  Triangles: 87,456
  GPU memory: 142 MB

Vulkan features used:
  ✓ Dynamic rendering
  ✓ Descriptor indexing
  ✓ Buffer device address
  ✓ Timeline semaphores

Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_ODIN_PROGRAMMING_LANGUAGE.md
  • “Vulkan Programming Guide” by Graham Sellers