Browse Source

Vk: put break / continue on a new line to catch missing coverage.

Likely not all places, just the ones I saw while working on the previous
commit.
pull/680/head
Vladimír Vondruš 10 months ago
parent
commit
f12d9da8ac
  1. 18
      src/Magnum/Vk/Device.cpp
  2. 12
      src/Magnum/Vk/Instance.cpp

18
src/Magnum/Vk/Device.cpp

@ -301,7 +301,8 @@ DeviceCreateInfo& DeviceCreateInfo::addEnabledExtensions(const Containers::Strin
arrayReserve(_state->extensions, _state->extensions.size() + extensions.size()); arrayReserve(_state->extensions, _state->extensions.size() + extensions.size());
for(const Containers::StringView extension: extensions) { for(const Containers::StringView extension: extensions) {
/* If the extension is blacklisted, skip it */ /* If the extension is blacklisted, skip it */
if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension)) continue; if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension))
continue;
/* Keep an owned *allocated* copy of the string if it's not global or /* Keep an owned *allocated* copy of the string if it's not global or
null-terminated -- ideally, if people use string view literals, null-terminated -- ideally, if people use string view literals,
@ -336,7 +337,8 @@ DeviceCreateInfo& DeviceCreateInfo::addEnabledExtensions(const Containers::Array
arrayReserve(_state->extensions, _state->extensions.size() + extensions.size()); arrayReserve(_state->extensions, _state->extensions.size() + extensions.size());
for(const Extension& extension: extensions) { for(const Extension& extension: extensions) {
/* If the extension is blacklisted, skip it */ /* If the extension is blacklisted, skip it */
if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension.string())) continue; if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension.string()))
continue;
arrayAppend(_state->extensions, extension.string().data()); arrayAppend(_state->extensions, extension.string().data());
} }
@ -750,7 +752,8 @@ Result Device::tryCreateInternal(Instance& instance, const DeviceCreateInfo& inf
if(info._state->enabledFeatures) { if(info._state->enabledFeatures) {
Debug{} << "Enabled features:"; Debug{} << "Enabled features:";
for(std::size_t i = 0, max = DeviceFeatures::Size*64; i != max; ++i) { for(std::size_t i = 0, max = DeviceFeatures::Size*64; i != max; ++i) {
if(!(info._state->enabledFeatures & DeviceFeature(i))) continue; if(!(info._state->enabledFeatures & DeviceFeature(i)))
continue;
Debug{} << " " << DeviceFeature(i); Debug{} << " " << DeviceFeature(i);
} }
} }
@ -775,7 +778,8 @@ Result Device::tryCreateInternal(Instance& instance, const DeviceCreateInfo& inf
bool workaroundHeaderPrinted = false; bool workaroundHeaderPrinted = false;
for(const auto& workaround: encounteredWorkarounds) { for(const auto& workaround: encounteredWorkarounds) {
/* Skip disabled workarounds */ /* Skip disabled workarounds */
if(workaround.second()) continue; if(workaround.second())
continue;
if(!workaroundHeaderPrinted) { if(!workaroundHeaderPrinted) {
workaroundHeaderPrinted = true; workaroundHeaderPrinted = true;
@ -794,7 +798,8 @@ Result Device::tryCreateInternal(Instance& instance, const DeviceCreateInfo& inf
if(!missingExtensions[i]) continue; if(!missingExtensions[i]) continue;
for(const Version extensionVersion: KnownVersionsForExtensions) { for(const Version extensionVersion: KnownVersionsForExtensions) {
for(const Extension extension: Extension::extensions(extensionVersion)) { for(const Extension extension: Extension::extensions(extensionVersion)) {
if(extension.index() != i) continue; if(extension.index() != i)
continue;
CORRADE_ASSERT_UNREACHABLE("Vk::Device::tryCreate(): some enabled features need" << extension.string() << "enabled", {}); CORRADE_ASSERT_UNREACHABLE("Vk::Device::tryCreate(): some enabled features need" << extension.string() << "enabled", {});
} }
} }
@ -850,7 +855,8 @@ void Device::initialize(Instance& instance, const Version version, const Contain
of providing a library helper to find the damn thing. See of providing a library helper to find the damn thing. See
DeviceVkTest::wrapExtensionNotFound() for verification of both DeviceVkTest::wrapExtensionNotFound() for verification of both
cases. */ cases. */
if(found == knownExtensions.end() || found->string() != extension) continue; if(found == knownExtensions.end() || found->string() != extension)
continue;
_enabledExtensions.set(found->index(), true); _enabledExtensions.set(found->index(), true);
} }
} }

12
src/Magnum/Vk/Instance.cpp

@ -183,7 +183,8 @@ InstanceCreateInfo& InstanceCreateInfo::addEnabledLayers(const Containers::Strin
arrayReserve(_state->layers, _state->layers.size() + layers.size()); arrayReserve(_state->layers, _state->layers.size() + layers.size());
for(const Containers::StringView layer: layers) { for(const Containers::StringView layer: layers) {
/* If the layer is blacklisted, skip it */ /* If the layer is blacklisted, skip it */
if(std::binary_search(_state->disabledLayers.begin(), _state->disabledLayers.end(), layer)) continue; if(std::binary_search(_state->disabledLayers.begin(), _state->disabledLayers.end(), layer))
continue;
/* Keep an owned *allocated* copy of the string if it's not global or /* Keep an owned *allocated* copy of the string if it's not global or
null-terminated -- ideally, if people use string view literals, null-terminated -- ideally, if people use string view literals,
@ -213,7 +214,8 @@ InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const Containers::S
arrayReserve(_state->extensions, _state->extensions.size() + extensions.size()); arrayReserve(_state->extensions, _state->extensions.size() + extensions.size());
for(const Containers::StringView extension: extensions) { for(const Containers::StringView extension: extensions) {
/* If the extension is blacklisted, skip it */ /* If the extension is blacklisted, skip it */
if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension)) continue; if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension))
continue;
/* Keep an owned *allocated* copy of the string if it's not global or /* Keep an owned *allocated* copy of the string if it's not global or
null-terminated -- ideally, if people use string view literals, null-terminated -- ideally, if people use string view literals,
@ -242,7 +244,8 @@ InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const Containers::A
arrayReserve(_state->extensions, _state->extensions.size() + extensions.size()); arrayReserve(_state->extensions, _state->extensions.size() + extensions.size());
for(const InstanceExtension& extension: extensions) { for(const InstanceExtension& extension: extensions) {
/* If the extension is blacklisted, skip it */ /* If the extension is blacklisted, skip it */
if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension.string())) continue; if(std::binary_search(_state->disabledExtensions.begin(), _state->disabledExtensions.end(), extension.string()))
continue;
arrayAppend(_state->extensions, extension.string().data()); arrayAppend(_state->extensions, extension.string().data());
} }
@ -350,7 +353,8 @@ void Instance::initialize(const Version version, const Containers::StringIterabl
of providing a library helper to find the damn thing. See of providing a library helper to find the damn thing. See
InstanceVkTest::wrapExtensionNotFound() for verification of both InstanceVkTest::wrapExtensionNotFound() for verification of both
cases. */ cases. */
if(found == knownExtensions.end() || found->string() != extension) continue; if(found == knownExtensions.end() || found->string() != extension)
continue;
_extensionStatus.set(found->index(), true); _extensionStatus.set(found->index(), true);
} }
} }

Loading…
Cancel
Save