From c05a277572afb2713336c2fca716387f3d28a96f Mon Sep 17 00:00:00 2001 From: Cody Goodson Date: Tue, 15 Jun 2021 13:38:21 -0500 Subject: [PATCH] Added noexcept and NDEBUG guard. --- src/VkBootstrap.cpp | 4 +++- src/VkBootstrap.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/VkBootstrap.cpp b/src/VkBootstrap.cpp index 8f6b21b..225fe00 100644 --- a/src/VkBootstrap.cpp +++ b/src/VkBootstrap.cpp @@ -40,7 +40,7 @@ GenericFeaturesPNextNode::GenericFeaturesPNextNode() : fields() {} // zero initializes the array of fields bool GenericFeaturesPNextNode::match( - GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported) { + GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported) noexcept { assert(requested.sType == supported.sType && "Non-matching sTypes in features nodes!"); for (uint32_t i = 0; i < field_capacity; i++) { if (requested.fields[i] && !supported.fields[i]) return false; @@ -1138,6 +1138,7 @@ PhysicalDeviceSelector::PhysicalDeviceSelector(Instance const& instance) { detail::Result PhysicalDeviceSelector::select() const { +#if !defined(NDEBUG) // Validation for(const auto& node : criteria.extended_features_chain) { assert(node.sType != 0 && "Features struct sType must be filled with the struct's " @@ -1147,6 +1148,7 @@ detail::Result PhysicalDeviceSelector::select() const { "Do not pass VkPhysicalDeviceFeatures2 as a required extension feature structure. An " "instance of this is managed internally for selection criteria and device creation."); } +#endif if (!instance_info.headless && !criteria.defer_surface_initialization) { if (instance_info.surface == VK_NULL_HANDLE) diff --git a/src/VkBootstrap.h b/src/VkBootstrap.h index fecbc60..a703050 100644 --- a/src/VkBootstrap.h +++ b/src/VkBootstrap.h @@ -122,11 +122,11 @@ struct GenericFeaturesPNextNode { GenericFeaturesPNextNode(); template - GenericFeaturesPNextNode(T const& features) { + GenericFeaturesPNextNode(T const& features) noexcept { *reinterpret_cast(this) = features; } - static bool match(GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported); + static bool match(GenericFeaturesPNextNode const& requested, GenericFeaturesPNextNode const& supported) noexcept; VkStructureType sType = static_cast(0); void* pNext = nullptr;