Add are_extension_features_present to PhysicalDevice

This commit is contained in:
n0F4x 2024-04-30 17:58:02 +02:00 committed by Charles Giessen
parent 91421d34b0
commit 92dc597184
2 changed files with 13 additions and 0 deletions

View File

@ -1508,6 +1508,13 @@ bool PhysicalDevice::enable_features_if_present(const VkPhysicalDeviceFeatures&
return required_features_supported;
}
bool PhysicalDevice::is_features_node_present(detail::GenericFeaturesPNextNode const& node) const {
detail::GenericFeatureChain requested_features;
requested_features.nodes.push_back(node);
return detail::supports_features({}, {}, extended_features_chain, requested_features);
}
bool PhysicalDevice::enable_features_node_if_present(detail::GenericFeaturesPNextNode const& node) {
VkPhysicalDeviceFeatures2 actual_pdf2{};

View File

@ -528,6 +528,11 @@ struct PhysicalDevice {
// Returns true if an extension should be enabled on the device
bool is_extension_present(const char* extension) const;
// Returns true if all of the features are present
template <typename T> bool are_extension_features_present(T const& features) const {
return is_features_node_present(detail::GenericFeaturesPNextNode(features));
}
// If the given extension is present, make the extension be enabled on the device.
// Returns true the extension is present.
bool enable_extension_if_present(const char* extension);
@ -564,6 +569,7 @@ struct PhysicalDevice {
friend class PhysicalDeviceSelector;
friend class DeviceBuilder;
bool is_features_node_present(detail::GenericFeaturesPNextNode const& node) const;
bool enable_features_node_if_present(detail::GenericFeaturesPNextNode const& node);
};