How milkru/vulkanizer works
Main Components
• Rendering Engine Core:
• Includes core graphics routines and resource management (see files in src/core such as device, buffer, pipeline, swapchain, shader, texture, frame_pacing, pass, and query).
• Responsible for interfacing with Vulkan and managing GPU resources.
• Window and Input Management:
• Handled via GLFW (with its related integration code in src/window.cpp/h and camera.cpp/h).
• Manages the creation of the window and handles user input and camera movement.
• Shader and GPU Pipeline:
• Located in src/shaders. Contains shader code (vertex, fragment, compute, mesh/task shaders) essential for defining the rendering pipeline.
• Mesh and Geometry Handling:
• Implements multiple mesh rendering, LOD system, and culling (occlusion, frustum).
• GUI Overlay:
• GUI implementation for performance and settings windows (src/gui.cpp/h).
• Uses a custom Vulkan backend for Dear ImGui.
• Profiling:
• Contains both CPU (via easy_profiler integration) and GPU profiling capabilities (src/gpu_profiler.cpp/h).
• Third Party Libraries:
• The 3rdparty directory contains integrated libraries such as volk (for Vulkan meta loading), VulkanMemoryAllocator, glfw, glm, imgui, SPIRV-Reflect, and others that enhance the engine’s capabilities.
• Build and Configuration:
• Build files like CMakeLists.txt and configuration files (e.g., .gitignore) indicate usage of CMake, making it easier to manage dependencies and builds.
Relationships and Interactions
• The Main Application (src/main.cpp) acts as the orchestrator, initializing the window, setting up the Vulkan device (using the functions encapsulated in core/device.cpp/h) and linking all other subsystems.
• The Window Module (using GLFW) is tightly coupled with the rendering core to handle swap chain recreation, event processing, and camera updates.
• The Core Rendering Module interacts with:
• Shader management (loading and compiling shaders from src/shaders).
• Memory management, using VulkanMemoryAllocator for GPU resource allocation.
• The Mesh & Geometry subsystem:
• Imports mesh data using fast_obj and refines it via meshoptimizer.
• Implements LOD and culling strategies before passing the data to the rendering pipeline.
• The GUI Module interacts with the rendering core by drawing overlay menus and performance stats using ImGui with a custom Vulkan backend.
• Profiling components (both CPU and GPU) hook into various stages of the rendering loop, logging performance statistics.
Architectural Patterns and Principles
• Modular Design: Each component (core rendering, windowing, GUI, mesh processing) is separated into clearly defined modules.
• Abstraction Layers: The core directory encapsulates low-level Vulkan operations, while higher-level modules (like window and GUI) build on top of these abstractions.
• Integration of Third Party Libraries: The design leverages multiple specialized libraries to simplify tasks (e.g., memory allocation, shader reflection), emphasizing reusability.
• Performance and Real-Time Constraints: Specialized profiling and culling techniques highlight the engine’s emphasis on throughput and efficiency.
Technologies and Frameworks to Highlight
• Vulkan 1.3 for the rendering backend.
• GLFW for window and input handling.
• VulkanMemoryAllocator, SPIRV-Reflect, volk, and Vulkan’s dynamic rendering features.
• CUDA-like mesh and vertex processing pipelines (mesh shaders, task shaders) with traditional rendering support.
• Integration with easy_profiler and GPU query timing for performance analysis.
• Dear ImGui for in-engine GUI support.
Essential Elements
• Clear labels for each module (e.g., Application/Main, Window Management, Rendering Engine Core, Shader Pipeline, Mesh Processing, GUI, Profiling, Third Party Libraries).