From ebc3f079810d2348c450f9b3ea5b8cbf492867b8 Mon Sep 17 00:00:00 2001 From: Krzysztof Jakubowski Date: Sun, 31 Mar 2024 10:37:30 +0200 Subject: [PATCH] Added VPhysicalDeviceType --- include/fwk/vulkan/vulkan_instance.h | 2 ++ src/vulkan/vulkan_instance.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/fwk/vulkan/vulkan_instance.h b/include/fwk/vulkan/vulkan_instance.h index 6f676c2a..64c5af20 100644 --- a/include/fwk/vulkan/vulkan_instance.h +++ b/include/fwk/vulkan/vulkan_instance.h @@ -28,6 +28,7 @@ DEFINE_ENUM(VVendor, intel, nvidia, amd, other); DEFINE_ENUM(VFeature, vertex_array_object, debug, copy_image, separate_shader_objects, shader_draw_parameters, shader_ballot, shader_subgroup, texture_view, texture_storage, texture_s3tc, texture_filter_anisotropic, timer_query); +DEFINE_ENUM(VPhysicalDeviceType, other, integrated_gpu, discrete_gpu, virtual_gpu, cpu); using VFeatures = EnumFlags; DEFINE_ENUM(VDebugLevel, verbose, info, warning, error); @@ -53,6 +54,7 @@ struct VulkanPhysicalDeviceInfo { int findMemoryType(u32 type_bits, VMemoryFlags) const; u64 deviceLocalMemorySize() const; double defaultScore() const; + VPhysicalDeviceType deviceType() const; VkPhysicalDevice handle; VkPhysicalDeviceProperties properties; diff --git a/src/vulkan/vulkan_instance.cpp b/src/vulkan/vulkan_instance.cpp index 9a75bf09..9d3a8e72 100644 --- a/src/vulkan/vulkan_instance.cpp +++ b/src/vulkan/vulkan_instance.cpp @@ -94,6 +94,12 @@ double VulkanPhysicalDeviceInfo::defaultScore() const { return score; } +VPhysicalDeviceType VulkanPhysicalDeviceInfo::deviceType() const { + if(properties.deviceType < count) + return VPhysicalDeviceType(properties.deviceType); + return VPhysicalDeviceType::other; +} + vector vulkanSurfaceExtensions() { vector out; out.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME);