Skip to content

Commit

Permalink
Added VPhysicalDeviceType
Browse files Browse the repository at this point in the history
  • Loading branch information
nadult committed Mar 31, 2024
1 parent 8008a75 commit ebc3f07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/fwk/vulkan/vulkan_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<VFeature>;

DEFINE_ENUM(VDebugLevel, verbose, info, warning, error);
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/vulkan/vulkan_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ double VulkanPhysicalDeviceInfo::defaultScore() const {
return score;
}

VPhysicalDeviceType VulkanPhysicalDeviceInfo::deviceType() const {
if(properties.deviceType < count<VPhysicalDeviceType>)
return VPhysicalDeviceType(properties.deviceType);
return VPhysicalDeviceType::other;
}

vector<string> vulkanSurfaceExtensions() {
vector<string> out;
out.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME);
Expand Down

0 comments on commit ebc3f07

Please sign in to comment.