From 193c20491a793bb8b512ec99f66da08dce99fad3 Mon Sep 17 00:00:00 2001 From: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> Date: Sun, 18 Apr 2021 14:14:17 -0600 Subject: [PATCH] Revert "Revert "Cleanup and warning for user provided VkPhysicalDeviceFeatures2."" This reverts commit 38d150101be333c182dfff75031413550d04af5b. --- src/VkBootstrap.cpp | 11 +++++++---- src/VkBootstrap.h | 6 ++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/VkBootstrap.cpp b/src/VkBootstrap.cpp index 60c1bfc..ba40d9a 100644 --- a/src/VkBootstrap.cpp +++ b/src/VkBootstrap.cpp @@ -31,6 +31,7 @@ #include #endif +#include #include namespace vkb { @@ -1264,6 +1265,10 @@ PhysicalDeviceSelector& PhysicalDeviceSelector::set_desired_version(uint32_t maj criteria.desired_version = VK_MAKE_VERSION(major, minor, 0); return *this; } +PhysicalDeviceSelector& PhysicalDeviceSelector::set_required_features(VkPhysicalDeviceFeatures const& features) { + criteria.required_features = features; + return *this; +} #if defined(VK_API_VERSION_1_2) // Just calls add_required_features PhysicalDeviceSelector& PhysicalDeviceSelector::set_required_features_11( @@ -1435,6 +1440,8 @@ detail::Result DeviceBuilder::build() const { final_pnext_chain.push_back(reinterpret_cast(&features_node)); } } + } else { + printf("User provided VkPhysicalDeviceFeatures2 instance found in pNext chain. All requirements added via 'add_required_extension_features' will be ignored."); } if(!user_defined_phys_dev_features_2 && !has_phys_dev_features_2) { @@ -1458,10 +1465,6 @@ detail::Result DeviceBuilder::build() const { device_create_info.enabledExtensionCount = static_cast(extensions.size()); device_create_info.ppEnabledExtensionNames = extensions.data(); - if(!final_pnext_chain.empty()) { - device_create_info.pNext = final_pnext_chain.front(); - } - Device device; VkResult res = detail::vulkan_functions().fp_vkCreateDevice( diff --git a/src/VkBootstrap.h b/src/VkBootstrap.h index f9f2630..dacd29b 100644 --- a/src/VkBootstrap.h +++ b/src/VkBootstrap.h @@ -459,10 +459,8 @@ class PhysicalDeviceSelector { return *this; } #endif - PhysicalDeviceSelector& set_required_features(VkPhysicalDeviceFeatures const& features) { - criteria.required_features = features; - return *this; - } + // Require a physical device which supports the features in VkPhysicalDeviceFeatures. + PhysicalDeviceSelector& set_required_features(VkPhysicalDeviceFeatures const& features); #if defined(VK_API_VERSION_1_2) // Require a physical device which supports the features in VkPhysicalDeviceVulkan11Features. // Must have vulkan version 1.2 - This is due to the VkPhysicalDeviceVulkan11Features struct being added in 1.2, not 1.1