From 8984157db505e741dafe96a7865143eb1bbf554a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Feb 2021 20:19:09 +0100 Subject: [PATCH] Vk: sprinkle a bunch of consts here and there. --- src/Magnum/Vk/Device.cpp | 6 +++--- src/Magnum/Vk/Implementation/DriverWorkaround.cpp | 8 ++++---- src/Magnum/Vk/Instance.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Magnum/Vk/Device.cpp b/src/Magnum/Vk/Device.cpp index 0f719eea2..285a01635 100644 --- a/src/Magnum/Vk/Device.cpp +++ b/src/Magnum/Vk/Device.cpp @@ -141,9 +141,9 @@ DeviceCreateInfo::DeviceCreateInfo(DeviceProperties& deviceProperties, const Ext we don't need to bother with String allocations. */ Containers::StringView disabledWorkarounds = args.value("disable-workarounds"); if(!disabledWorkarounds.isEmpty()) { - Containers::Array split = disabledWorkarounds.splitWithoutEmptyParts(); + const Containers::Array split = disabledWorkarounds.splitWithoutEmptyParts(); arrayReserve(_state->encounteredWorkarounds, split.size()); - for(Containers::StringView workaround: split) + for(const Containers::StringView workaround: split) Implementation::disableWorkaround(_state->encounteredWorkarounds, workaround); } @@ -837,7 +837,7 @@ template void Device::initializeExtensions(const Containers::ArrayView< for(const Version version: KnownVersionsForExtensions) { const Containers::ArrayView knownExtensions = Extension::extensions(version); - auto found = std::lower_bound(knownExtensions.begin(), knownExtensions.end(), extension, [](const Extension& a, const T& b) { + const auto found = std::lower_bound(knownExtensions.begin(), knownExtensions.end(), extension, [](const Extension& a, const T& b) { return a.string() < static_cast(b); }); if(found->string() != extension) continue; diff --git a/src/Magnum/Vk/Implementation/DriverWorkaround.cpp b/src/Magnum/Vk/Implementation/DriverWorkaround.cpp index e030c5a24..3df15b989 100644 --- a/src/Magnum/Vk/Implementation/DriverWorkaround.cpp +++ b/src/Magnum/Vk/Implementation/DriverWorkaround.cpp @@ -78,8 +78,8 @@ constexpr Containers::StringView KnownWorkarounds[]{ Moreover, based on the experience with GL, I don't expect there being too many workarounds used heavily (10 at most, maybe?) so I won't bother with some binary search, which needs extra testing effort. */ -Containers::StringView findWorkaround(Containers::StringView workaround) { - for(Containers::StringView i: KnownWorkarounds) +Containers::StringView findWorkaround(const Containers::StringView workaround) { + for(const Containers::StringView i: KnownWorkarounds) if(workaround == i) return i; return {}; } @@ -90,7 +90,7 @@ void disableWorkaround(Containers::Array /* Find the workaround. Note that we'll add the found view to the array and not the passed view, as the found view is guaranteed to stay in scope */ - Containers::StringView found = findWorkaround(workaround); + const Containers::StringView found = findWorkaround(workaround); /* Ignore unknown workarounds */ /** @todo this will probably cause false positives when both GL and Vulkan @@ -105,7 +105,7 @@ void disableWorkaround(Containers::Array Containers::Array> disableAllWorkarounds() { Containers::Array> encounteredWorkarounds; - for(Containers::StringView i: KnownWorkarounds) + for(const Containers::StringView i: KnownWorkarounds) arrayAppend(encounteredWorkarounds, Containers::InPlaceInit, i, true); return encounteredWorkarounds; } diff --git a/src/Magnum/Vk/Instance.cpp b/src/Magnum/Vk/Instance.cpp index dcc30c0ea..3134c5858 100644 --- a/src/Magnum/Vk/Instance.cpp +++ b/src/Magnum/Vk/Instance.cpp @@ -355,7 +355,7 @@ template void Instance::initializeExtensions(const Containers::ArrayVie InstanceExtension::extensions(Version::Vk11), /*InstanceExtension::extensions(Version::Vk12) is empty */ }) { - auto found = std::lower_bound(knownExtensions.begin(), knownExtensions.end(), extension, [](const InstanceExtension& a, const T& b) { + const auto found = std::lower_bound(knownExtensions.begin(), knownExtensions.end(), extension, [](const InstanceExtension& a, const T& b) { return a.string() < static_cast(b); }); if(found->string() != extension) continue;