11#ifdef CORRELATION_USE_VULKAN
12#include <vulkan/vulkan.h>
23#ifdef CORRELATION_USE_VULKAN
30inline void checkVkResult(VkResult result, std::string_view message) {
31 if (result != VK_SUCCESS) {
32 throw std::runtime_error(std::string(message) +
33 " (VkResult: " + std::to_string(
static_cast<int>(result)) +
")");
44inline uint32_t findMemoryType(VkPhysicalDevice physical_device, uint32_t type_filter,
45 VkMemoryPropertyFlags properties) {
46 VkPhysicalDeviceMemoryProperties mem_properties{};
47 vkGetPhysicalDeviceMemoryProperties(physical_device, &mem_properties);
49 const auto memory_types =
50 std::span(mem_properties.memoryTypes).subspan(0, mem_properties.memoryTypeCount);
51 for (uint32_t i = 0; i < mem_properties.memoryTypeCount; ++i) {
52 const bool is_type_set = (type_filter & (1U << i)) != 0;
53 const bool has_properties = (memory_types[i].propertyFlags & properties) == properties;
54 if (is_type_set && has_properties) {
59 throw std::runtime_error(
"Failed to find suitable Vulkan device memory type");
Definition VulkanComputeService.hpp:24