Added noexcept and NDEBUG guard.

This commit is contained in:
Cody Goodson 2021-06-15 13:38:21 -05:00 committed by Charles Giessen
parent c66158e87c
commit c05a277572
2 changed files with 5 additions and 3 deletions

View File

@ -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<PhysicalDevice> 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<PhysicalDevice> 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)

View File

@ -122,11 +122,11 @@ struct GenericFeaturesPNextNode {
GenericFeaturesPNextNode();
template <typename T>
GenericFeaturesPNextNode(T const& features) {
GenericFeaturesPNextNode(T const& features) noexcept {
*reinterpret_cast<T*>(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<VkStructureType>(0);
void* pNext = nullptr;