1.3.72
 
Loading...
Searching...
No Matches
helios::VulkanDevice Class Reference

Manages Vulkan instance, physical device, logical device, and memory allocator. More...

#include <VulkanDevice.h>

Public Member Functions

 VulkanDevice (const VulkanDevice &)=delete
 
VulkanDeviceoperator= (const VulkanDevice &)=delete
 
 VulkanDevice (VulkanDevice &&)=delete
 
VulkanDeviceoperator= (VulkanDevice &&)=delete
 
void initialize (bool enable_validation=false)
 Initialize Vulkan instance, device, and allocator.
 
void shutdown ()
 Shutdown and destroy all Vulkan resources.
 
bool supportsAtomicFloat () const
 Check if device supports atomic float operations.
 
bool isMoltenVK () const
 Check if running on MoltenVK (macOS/iOS)
 
VkInstance getInstance () const
 Get Vulkan instance.
 
VkPhysicalDevice getPhysicalDevice () const
 Get physical device.
 
VkDevice getDevice () const
 Get logical device.
 
VkQueue getComputeQueue () const
 Get compute queue.
 
uint32_t getComputeQueueFamily () const
 Get compute queue family index.
 
VmaAllocator getAllocator () const
 Get VMA allocator.
 
const VkPhysicalDeviceProperties & getDeviceProperties () const
 Get device properties (name, limits, etc.)
 
void printDeviceInfo () const
 Print device information (name, vendor, driver version)
 
void probeComputeCapability ()
 Verify the device can execute compute shaders with storage buffer access.
 

Detailed Description

Manages Vulkan instance, physical device, logical device, and memory allocator.

Handles:

  • Vulkan instance creation with required extensions (MoltenVK-aware)
  • Physical device selection (prefer discrete GPU, fall back to integrated)
  • Logical device creation with compute queue
  • VMA allocator initialization for efficient GPU memory management
  • Feature detection (atomic floats, etc.)

Definition at line 47 of file VulkanDevice.h.

Constructor & Destructor Documentation

◆ ~VulkanDevice()

helios::VulkanDevice::~VulkanDevice ( )

Definition at line 58 of file VulkanDevice.cpp.

Member Function Documentation

◆ getAllocator()

VmaAllocator helios::VulkanDevice::getAllocator ( ) const
inline

Get VMA allocator.

Definition at line 134 of file VulkanDevice.h.

◆ getComputeQueue()

VkQueue helios::VulkanDevice::getComputeQueue ( ) const
inline

Get compute queue.

Definition at line 120 of file VulkanDevice.h.

◆ getComputeQueueFamily()

uint32_t helios::VulkanDevice::getComputeQueueFamily ( ) const
inline

Get compute queue family index.

Definition at line 127 of file VulkanDevice.h.

◆ getDevice()

VkDevice helios::VulkanDevice::getDevice ( ) const
inline

Get logical device.

Definition at line 113 of file VulkanDevice.h.

◆ getDeviceProperties()

const VkPhysicalDeviceProperties & helios::VulkanDevice::getDeviceProperties ( ) const
inline

Get device properties (name, limits, etc.)

Definition at line 141 of file VulkanDevice.h.

◆ getInstance()

VkInstance helios::VulkanDevice::getInstance ( ) const
inline

Get Vulkan instance.

Definition at line 99 of file VulkanDevice.h.

◆ getPhysicalDevice()

VkPhysicalDevice helios::VulkanDevice::getPhysicalDevice ( ) const
inline

Get physical device.

Definition at line 106 of file VulkanDevice.h.

◆ initialize()

void helios::VulkanDevice::initialize ( bool  enable_validation = false)

Initialize Vulkan instance, device, and allocator.

Parameters
enable_validationEnable Vulkan validation layers (for debugging)

Creates instance, selects physical device, creates logical device, and initializes VMA.

Definition at line 62 of file VulkanDevice.cpp.

◆ isMoltenVK()

bool helios::VulkanDevice::isMoltenVK ( ) const
inline

Check if running on MoltenVK (macOS/iOS)

Returns
True if MoltenVK driver detected

Used for platform-specific workarounds (push constant limits, etc.).

Definition at line 92 of file VulkanDevice.h.

◆ printDeviceInfo()

void helios::VulkanDevice::printDeviceInfo ( ) const

Print device information (name, vendor, driver version)

Definition at line 751 of file VulkanDevice.cpp.

◆ probeComputeCapability()

void helios::VulkanDevice::probeComputeCapability ( )

Verify the device can execute compute shaders with storage buffer access.

Dispatches a minimal compute shader that writes to a storage buffer via a descriptor set, waits for completion, and reads back the result. This catches cases where a Vulkan instance and device can be created (e.g., MoltenVK on macOS CI runners) but actual GPU compute fails with VK_ERROR_DEVICE_LOST because the VM exposes only graphics acceleration without compute support.

Exceptions
helios_runtime_errorif the probe dispatch fails or produces wrong results

Definition at line 450 of file VulkanDevice.cpp.

◆ shutdown()

void helios::VulkanDevice::shutdown ( )

Shutdown and destroy all Vulkan resources.

Destroys VMA allocator, logical device, and instance in correct order.

Definition at line 77 of file VulkanDevice.cpp.

◆ supportsAtomicFloat()

bool helios::VulkanDevice::supportsAtomicFloat ( ) const
inline

Check if device supports atomic float operations.

Returns
True if GL_EXT_shader_atomic_float is supported

Used to select optimized shader variant (atomic floats vs atomicCompSwap fallback).

Definition at line 81 of file VulkanDevice.h.


The documentation for this class was generated from the following files: