7struct GraphicsBackendInfo;
vk::PhysicalDevice device
vk::PhysicalDevice get_physical_device() const
Get physical device handle.
static QueueFamilyIndices find_queue_families(vk::PhysicalDevice device)
Find queue families on the given physical device.
void query_supported_extensions()
Query and log supported device extensions.
const std::string & get_device_name() const
Name of the selected physical device.
std::array< uint8_t, VK_UUID_SIZE > m_device_uuid
Selected device UUID.
bool graphics_family_presents() const
Whether the graphics queue family passed the surfaceless presentation probe.
const QueueFamilyIndices & get_queue_families() const
Get queue family indices.
bool graphics_family_can_present(vk::SurfaceKHR surface) const
Confirm the graphics family presents to a concrete surface.
void cleanup()
Cleanup device resources.
bool m_supports_mesh_shaders
Whether the device supports mesh shaders.
bool pick_physical_device(vk::Instance instance, const GraphicsBackendInfo &backend_info)
Select a physical device by config selector or score.
VKDevice & operator=(const VKDevice &)=delete
VKDevice(const VKDevice &)=delete
vk::PhysicalDevice m_physical_device
Selected physical device (GPU)
vk::Queue get_preferred_present_queue() const
Queue for the preferred presentation family.
vk::Queue m_compute_queue
Compute queue handle.
bool create_logical_device(vk::Instance instance, const GraphicsBackendInfo &backend_info)
Create the logical device and retrieve queue handles.
vk::Queue m_transfer_queue
Transfer queue handle.
vk::Device m_logical_device
Logical device handle.
bool m_graphics_presents
Graphics family passed the surfaceless presentation probe.
vk::Device get_device() const
Get logical device handle.
std::unordered_map< uint32_t, vk::Queue > m_present_queues
One queue per presentation-capable family.
std::string m_device_name
Selected device name, cached for logging.
vk::Queue get_present_queue(uint32_t family_index) const
Queue for a presentation-capable family.
vk::Queue m_graphics_queue
Graphics queue handle.
vk::Queue get_graphics_queue() const
Get graphics queue.
vk::Queue get_compute_queue() const
Get compute queue (may be same as graphics)
vk::Queue get_transfer_queue() const
Get transfer queue (may be same as graphics)
bool supports_mesh_shaders() const
Check if the device supports mesh shaders.
QueueFamilyIndices m_queue_families
Indices of required queue families.
void wait_idle() const
Wait for the device to become idle.
Manages Vulkan physical device selection and logical device creation.
Configuration for graphics API backend (Vulkan/OpenGL/etc.)
static constexpr uint32_t MAX_TRACKED_FAMILIES
Width of present_family_mask.
bool can_present(uint32_t index) const
Whether family index can present.
std::optional< uint32_t > transfer_family
std::optional< uint32_t > graphics_family
uint32_t present_family_mask
Bit i set when family i passed the surfaceless presentation probe.
std::optional< uint32_t > preferred_present_family() const
Family the engine presents on by default.
std::optional< uint32_t > compute_family
Stores indices of queue families we need.