Repository navigation
Vulkan Backend
Release boundary: This page documents an experimental implementation outside the blocked and uncertified
stable-v1product scope (Windows 11 x64/MSVC v143 with D3D11 or Windows NullRHI and C++ modules). It is not a supported or release-certified backend.
SparkEngine has a Vulkan RHI implementation for Windows, Linux, and MoltenVK-based macOS development work. It is experimental and outside stable-v1, not a primary cross-platform supported renderer.
-
Namespace:
Spark::RHI::Vulkan -
Files:
Graphics/RHI/Vulkan/VulkanDevice.{h,cpp}(~550 LOC header),VulkanCommandList.cpp,VulkanDescriptorCache.{h,cpp},VulkanFormatHelpers.cpp. -
Guard:
#ifdef SPARK_VULKAN_SUPPORT(set by CMake whenENABLE_VULKAN=ON). -
Linkage:
libvulkan.so.1/vulkan-1.dllviavolkloader. - API level: Vulkan 1.4 — dynamic rendering, push descriptors, timeline semaphores, synchronization2.
| Class | Purpose | RHI interface |
|---|---|---|
VulkanDevice |
Instance + physical device + logical device + queues | IRHIDevice |
VulkanBuffer |
VkBuffer + VkDeviceMemory, optional persistent mapping |
IRHIBuffer |
VulkanTexture |
VkImage + VkImageView, tracks current layout |
IRHITexture |
VulkanShader |
VkShaderModule compiled from SPIR-V |
IRHIShader |
VulkanSampler |
VkSampler |
IRHISampler |
VulkanPipelineState |
VkPipeline + VkPipelineLayout
|
IRHIPipelineState |
VulkanSwapChain |
VkSurfaceKHR + VkSwapchainKHR
|
IRHISwapChain |
VulkanCommandList |
Per-frame primary VkCommandBuffer
|
IRHICommandList |
VulkanDescriptorCache |
LRU-cached VkDescriptorSet layouts |
internal |
Queue selection picks the best-fit families from the platform:
struct QueueFamilyIndices
{
std::optional<uint32_t> graphicsFamily; // graphics + present
std::optional<uint32_t> computeFamily; // async compute (optional)
std::optional<uint32_t> transferFamily; // DMA copies (optional)
std::optional<uint32_t> presentFamily;
bool IsComplete() const;
};Separate compute and transfer queues are used when the adapter exposes them; otherwise the graphics queue handles all three.
-
Vulkan 1.4 dynamic rendering — no
VkRenderPassobjects; pipelines bind color / depth formats inline viaVK_KHR_dynamic_rendering(core in 1.3+). -
Push descriptors — frequent CBV/SRV bindings skip descriptor-set allocation via
VK_KHR_push_descriptor. -
Timeline semaphores — unified CPU/GPU synchronization primitive (
VK_KHR_timeline_semaphore). Used for async compute and frame pacing. -
Synchronization2 — coarse-grained
VkPipelineStageFlags2and image-barrier builders. -
VMA / explicit memory — currently plain
vkAllocateMemorywith a per-heap budget cache; the VMA port is on the Tier-2 roadmap. -
Descriptor cache —
VulkanDescriptorCachememoizesVkDescriptorSetLayoutso render passes don't rebuild them every frame. -
Validation layer — Debug builds automatically enable
VK_LAYER_KHRONOS_validation; theVK_EXT_debug_utilscallback routes messages throughSpark::Logger. - Lavapipe development route — Linux development tests may use Mesa Lavapipe with explicitly configured software-ICD and display settings. This is not a generic fallback or a support/certification claim. See Cross-Compilation: Wine Testing.
auto& caps = device->GetCapabilities();
caps.rayTracingSupport // VK_KHR_ray_tracing_pipeline
caps.meshShaderSupport // VK_EXT_mesh_shader
caps.bindlessResourceSupport // VK_EXT_descriptor_indexing + update-after-bind
caps.conservativeRasterSupport // VK_EXT_conservative_rasterization// RHIFactory.cpp
case GraphicsBackend::Vulkan:
device = std::make_unique<Vulkan::VulkanDevice>();
break;On Linux, RHIFactory::GetRecommendedBackend() can select Vulkan from the compiled and available candidates. Runtime availability and failure handling are owned by RHIBridge, not by the factory selector.
- MoltenVK macOS development path — no certified surface or packaged-runtime proof exists; the native Metal backend is also partial and blocked.
-
Mesh shaders — plumbed through
VK_EXT_mesh_shader, requires recent Mesa (RADV) or NVIDIA drivers. -
DXR equivalent — implemented via
VK_KHR_ray_tracing_pipelinebut currently flagged experimental. See DXR Raytracing for the D3D12 sibling. - Release evidence — full production-pass execution, GPU readback, shader-toolchain, and supported-driver evidence remain incomplete.
- RHI Abstraction Layer — shared interface.
- D3D12 Backend — Windows modern alternative.
- OpenGL Backend — experimental development alternative when compiled.
- Cross-Compilation: Wine Testing — running D3D11 builds under Wine + DXVK (Vulkan).
Published from 2b03dc797148. Edit the canonical source in wiki/.
- Documentation
- Docs route
- Wiki index
- Guides
- Tutorials
- Samples
- Examples
- API Reference
- API route
- Reference
- Build Guide
- Dependencies
- FAQ
- Changelog
- Roadmap
- Contributing
- Code of Conduct
- Home
- FAQ
- Getting Started
- Quick-Start Tutorial
- Making Your First Game
- Making Your First Multiplayer Game
- Artist Workflow Guide
- Editor Walkthrough
- Migration Guide
- How SparkEngine Works
- Architecture Overview
- Engine Architecture Flowchart
- Creating a Game Module
- Game Modules (catalog)
- Entity Component System
- Rendering and Graphics
- Physics
- Cloth Simulation
- Audio
- Input System
- Camera System
- Scripting with AngelScript
- Visual Scripting
- AI and Navigation
- Animation
- 2D Systems
- Networking
- Dedicated Server
- Multiplayer Quick Start
- Area Server Architecture
- Scene Management
- Large World Support
- Collaborative Editing
- Coroutine System
- Event System
- Event Response System
- Job System
- UI System
- UI Layout Extensions
- Localization
- Dialogue System
- Destruction System
- Replay System
- Achievement System
- Loading System
- Mod System
- Content Delivery
- Tween System
- Memory Integrity
- Gameplay Systems
- Terrain and Procedural Generation
- Save System
- Persistence System
- Day Night Cycle and Weather
- Cinematic Sequencer
- Runtime Prefabs
- SparkEditor
- Editor Tutorials
- SparkConsole
- SparkDaemon
- Shader Pipeline
- Asset Pipeline
- Asset Validation
- Asset Migration
- Game Packaging
- Online Services
- DataTable System
- Loot and Crafting System
- CSG System
- Font System
- Timer Manager
- Movie Render Pipeline
- HLOD and World Partition
- Remote Debug System
- Selection Manager
- Asset Dependency Graph
- Editor Automation
- File Watcher
- Project Templates
- System Requirements
- VR Support
- Mobile Platform
- Accessibility
- Platform Input
- Platform Certification
- Cross-Compilation: Wine Testing
- RHI Abstraction Layer
- D3D11 Backend
- D3D12 Backend
- Vulkan Backend
- OpenGL Backend
- Metal Backend
- DXR Raytracing
- Hybrid Ray Tracing
- Upscaling (DLSS/FSR)
- Render Graph
- Shader Graph
- GPU Particles
- GPU-Driven Rendering
- Volumetric Fog
- Volumetric Clouds
- Global Illumination
- Virtual Texturing
- Water Rendering
- Clustered Lighting
- Material System
- Post-Processing
- Shadow System
- Particle System
- Decal System
- Sky and Atmosphere
- Foliage System
- Mesh Shaders
- Neural Rendering
- Configuration Reference
- Performance Tips
- Benchmark Framework
- Threading Model
- Fuzz Policy and Parser Security
- Memory Safety
- Memory Management Patterns
- Build System and CMake Modules
- Profiler and Debugging
- Performance Profiling Guide
- Telemetry System
- Crash Reporting
- Golden Image Testing
- Utilities
- Testing
- Fuzz Policy and Parser Security
- Codebase Statistics
- Codebase Health
- Error Handling Patterns
- Hot Reload Overview
- Troubleshooting
- Contributing
- Workflow Patterns
- Build Optimizations
- CI Reproducible Builds
- GitHub API and PR Checks
- Git Rebase Conflicts
- Clang-Format
- Code Quality Violations
- AI Bloat Pattern
- MinGW + Wine Cross-Compilation
- Live Editor Testing
- Engine & Renderer Landscape
- DuetOS Portability Catalog
- Five-Engine Analysis
- Eleven-Engine Analysis
- ThorVG / Unity Graphics Analysis
- Advanced Techniques Catalog
- Third-Party Library Evaluation
- Engine Viability Evaluation
- Engine Feature Recommendations
- Project Recommendations
- Mac Compatibility Analysis
- Codebase Observations
- Codebase Bloat Audit
- Test Suite Audit
- Documentation Coverage Audit
- ThirdParty Dependencies Audit
- Load Test Baseline
- Gameplay Systems Status
- SparkGame Module Status
- Stub and Abandoned Features
- Memory Integrity System
- Memory Safety Evaluation
- Hardware Acceleration Systems
- Jolt Physics Integration
- GPU/CPU Separation Plan
- Daemon Services Architecture
- Reflection & Polymorphism Refactoring Plan
- SparkBuild In-Tree
- Wine No-JobSystem Breakthrough
- Wine Role and Fallback Tiers