DEV Community

Cover image for Building a Custom Vulkan Engine: Deep Dive into M4 Advanced Rendering & Resource Pipeline
p3nGu1nZz
p3nGu1nZz

Posted on

Building a Custom Vulkan Engine: Deep Dive into M4 Advanced Rendering & Resource Pipeline

This milestone introduces render graphs, VMA integration, modern descriptors, GUID-based asset management, and a full asset pipeline to transform our experimental Vulkan renderer into a production-ready system capable of complex 3D worlds.

Hey fellow game developers and graphics engineers!

In this post, I'll dive deep into our M4 milestone for Bad Cat: Void Frontier, focusing on the advanced rendering and resource pipeline implementation. After completing M3 with a solid Vulkan renderer and Entity pattern foundation, we're now tackling the complex systems that will transform our engine from experimental to production-ready.

Figure 1

I'll break down our comprehensive action plan and TODO list, explaining the technical challenges, architectural decisions, and implementation strategy for each major system.

Current Status: M3 Complete, Ready for M4

Before diving into M4, let's recap what M3 delivered:

  • Complete Vulkan rendering pipeline with triangle rendering and cross-platform support
  • Device injection architecture with clean separation of platform and rendering concerns
  • Entity pattern implementation providing a lightweight OOP API over EnTT
  • Comprehensive test coverage (1025 assertions across 138 test cases)
  • System architecture with Transform, Camera, Layer, and Render systems

M3 established a robust foundation, enabling us to focus on advanced rendering features without entity management overhead.

M4 Goals & Strategy

M4 represents a significant evolution in our engine's capabilities. We're implementing modern Vulkan features, comprehensive asset management, and hierarchical scene organization to support complex 3D worlds with efficient resource handling.

Figure 2

Core M4 Systems Implementation

Our M4 action plan centers on four major system pillars:

1. Render Graph Architecture

The render graph manages resource dependencies, automatic barriers, and optimal GPU resource usage. Unlike traditional frame graphs, render graphs automatically resolve synchronization barriers and maximize GPU parallelism by analyzing resource usage patterns at build-time.

Key Implementation Tasks:

  • Implement render graph foundation in engine/systems/render/
  • Add automatic resource barriers and state transitions
  • Implement optimal memory aliasing and resource reuse
  • Add pipeline scheduling and dependency management

2. Vulkan Memory Allocator (VMA) Integration

VMA provides efficient GPU memory allocation, defragmentation, and budget tracking.

Key Implementation Tasks:

  • Integrate Vulkan Memory Allocator for GPU memory management
  • Implement memory budget tracking and defragmentation with VMA
  • Add staging buffer management for asset streaming with VMA

3. Modern Descriptor Management

We're implementing bindless resources and dynamic descriptor updates. VK_EXT_descriptor_indexing enables very large descriptor arrays, allowing bindless access to textures and buffers directly from shaders without traditional descriptor sets, dramatically improving scalability for complex scenes.

Key Implementation Tasks:

  • Implement descriptor indexing with VK_EXT_descriptor_indexing
  • Add bindless resources support for large descriptor arrays
  • Implement dynamic descriptor updates for efficient resource binding

4. GUID-Based Asset Management

Stable asset identification with hot-reload and streaming capabilities. GUIDs are generated using UUIDv4 and stored as stable 128-bit identifiers that survive asset renames or moves, with human-readable aliases for developer convenience.

Key Implementation Tasks:

  • Build GUID-based asset management system
  • Implement VPak streaming and hot-reload capabilities
  • Add mod support and asset protection features
  • Create asset pipeline tools (asset_importer, vpak_builder, asset_viewer, level_editor)

HierarchyComponent for Scene Management

Key Implementation Tasks:

  • Create spec: docs/specs/components/hierarchy_component.md
  • Design HierarchyComponent structure (parent entity ID, child entity list, transform inheritance flags)
  • Implement utility functions in v::engine::components::hierarchy namespace
  • Add HierarchyComponent to TransformSystem for hierarchical transform updates
  • Add HierarchyComponent to RenderSystem for scene graph rendering order
  • Create tests mapping 1:1 to spec Acceptance Criteria in /tests
  • Validate with ./scripts/test.sh and update TODO.md
  • Integrate with Entity wrapper for clean parent-child API (entity.add_child(other_entity))

Here's a quick example of the Entity wrapper API in action:

// Create a spaceship entity with child components
auto spaceship = Entity::create<TransformComponent, HierarchyComponent>(registry);
auto engine = Entity::create<TransformComponent, RenderComponent>(registry);
auto door = Entity::create<TransformComponent, RenderComponent>(registry);

// Build the hierarchy
spaceship.add_child(engine);
spaceship.add_child(door);

// Systems automatically handle hierarchical updates
Enter fullscreen mode Exit fullscreen mode

Figure 3

M4 Implementation Phases

We're executing M4 in four focused phases:

Phase 1: Advanced Vulkan Features

  • Implement render graph architecture in engine/systems/render/
  • Add automatic resource barriers and state transitions to render graph
  • Implement optimal memory aliasing and resource reuse in render graph
  • Add pipeline scheduling and dependency management to render graph
  • Integrate Vulkan Memory Allocator (VMA) for efficient GPU memory management
  • Implement memory budget tracking and defragmentation with VMA
  • Add staging buffer management for asset streaming with VMA
  • Implement modern descriptor management with descriptor indexing
  • Add bindless resources support for large descriptor arrays
  • Implement dynamic descriptor updates for efficient resource binding
  • Add compute shader support for modern Vulkan 1.2+ features
  • Implement mesh shader pipeline for advanced geometry processing
  • Add ray tracing support for realistic lighting and reflections

Phase 2: Resource Management System

  • Design and implement GUID-based asset management system
  • Implement VPak streaming and hot-reload capabilities
  • Add mod support and asset protection features
  • Create asset pipeline tools (asset_importer, vpak_builder, asset_viewer, level_editor)

Phase 3: Hierarchy & Scene Management

  • Create spec: docs/specs/components/hierarchy_component.md using template
  • Design HierarchyComponent structure (parent entity ID, child entity list, transform inheritance flags)
  • Implement utility functions in v::engine::components::hierarchy namespace
  • Add HierarchyComponent to TransformSystem for hierarchical transform updates
  • Add HierarchyComponent to RenderSystem for scene graph rendering order
  • Create tests mapping 1:1 to spec Acceptance Criteria in /tests
  • Validate with ./scripts/test.sh and update TODO.md
  • Integrate with Entity wrapper for clean parent-child API (entity.add_child(other_entity))

Phase 4: Advanced Rendering Features

  • Implement modern Vulkan 1.2+ features (compute shaders, mesh shaders, ray tracing)
  • Add realistic materials and lighting systems
  • Integrate vendor-specific features (DLSS/FSR/XeSS)
  • Optimize shader compilation and pipeline management

Figure 4

Asset Pipeline Implementation

Key Implementation Tasks:

  • Tools in /tools/ for offline processing
  • Asset importer with GUID assignment, format conversion, and validation
  • VPak builder with compression, integrity verification, and streaming support
  • Asset viewer for preview and validation capabilities
  • Level editor with VPak integration and version control support

Testing & Quality Assurance Strategy

Key Implementation Tasks:

  • Unit tests for render graph resource management
  • Unit tests for VMA allocation and defragmentation
  • Unit tests for GUID generation, asset loading, and VPak streaming
  • Unit tests for HierarchyComponent parent-child relationships and transform inheritance
  • Integration tests for resource system hot-reload and mod support
  • Performance tests for rendering optimizations and asset streaming
  • Cross-platform tests for console rendering backend compatibility

M4 Success Criteria & Deliverables

Technical Milestones:

  • Render graph managing complex rendering pipelines
  • VMA providing efficient GPU memory management
  • Modern descriptor management with bindless resources
  • GUID-based asset system with stable identifiers
  • HierarchyComponent enabling scene graph organization
  • VPak streaming with 30-70% compression ratios
  • Hot-reload working for shaders and assets
  • Asset pipeline tools supporting full workflow

Quality Gates:

  • Comprehensive test coverage for all new systems
  • Performance benchmarks meeting targets
  • Cross-platform compatibility verified
  • Documentation complete for all features

Technical Challenges & Solutions

  • Render Graph Dependencies: Build-time analysis with runtime validation
  • GPU Memory Fragmentation: VMA's automatic defragmentation
  • Asset Hot-Reload: Versioned resources and safe replacement
  • Cross-Platform Descriptors: Extension abstraction with fallbacks

Conclusion

M4 is transforming our Vulkan engine from experimental to production-ready. The detailed action plan and phased approach ensure we deliver robust advanced rendering and resource management systems.

If you're working on graphics-intensive applications, these implementation patterns could provide valuable insights for your own engine development.

If you're building something similar, drop a link — we'd love to see your approach! What's your experience with implementing advanced rendering pipelines? Share in the comments!

Till next time,
~p3n

BadCatVoidFrontier #GameDev #Vulkan #GraphicsProgramming #IndieGameDev #gamedev #rendering #enginearchitecture #assetpipeline #devlog

Top comments (0)