diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-20 22:17:29 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2025-01-01 09:52:03 -0800 |
| commit | 110d32729ecbe5b19df9b2cc76de630334410589 (patch) | |
| tree | 0032af6f60d1b8575bc5bfcbefb8c3faa951d96f /Source/Core/VideoCommon | |
| parent | 6f10acea3fee4d08c4e52e66f862da45ad06d1ed (diff) | |
Simplify `std::find` with `Common::Contains`
In NandPaths.cpp, the `std::initializer_list<char>` of illegal characters has been turned into a `char[]` (similar to the one in GameList.cpp).
The reverse iteration in ResourcePack.cpp seemed to provide no benefits, and doing without it it seemed to have no ill effects.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VideoConfig.cpp | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp index 473cc06690..0001a9081d 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp @@ -7,6 +7,7 @@ #include <array> #include <variant> +#include "Common/Contains.h" #include "Common/Logging/Log.h" #include "Common/VariantUtil.h" @@ -20,7 +21,7 @@ bool IsQualifier(std::string_view value) static constexpr std::array<std::string_view, 7> qualifiers = { "attribute", "const", "highp", "lowp", "mediump", "uniform", "varying", }; - return std::find(qualifiers.begin(), qualifiers.end(), value) != qualifiers.end(); + return Common::Contains(qualifiers, value); } bool IsBuiltInMacro(std::string_view value) @@ -28,7 +29,7 @@ bool IsBuiltInMacro(std::string_view value) static constexpr std::array<std::string_view, 5> built_in = { "__LINE__", "__FILE__", "__VERSION__", "GL_core_profile", "GL_compatibility_profile", }; - return std::find(built_in.begin(), built_in.end(), value) != built_in.end(); + return Common::Contains(built_in, value); } std::vector<std::string> GlobalConflicts(std::string_view source) diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index b53cb3d2ed..21e5905d95 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -9,6 +9,7 @@ #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" +#include "Common/Contains.h" #include "Common/EnumMap.h" #include "Common/Logging/Log.h" #include "Common/MathUtil.h" @@ -585,8 +586,7 @@ void VertexManagerBase::Flush() const auto cache_entry = g_texture_cache->Load(TextureInfo::FromStage(i)); if (cache_entry) { - if (std::find(texture_names.begin(), texture_names.end(), - cache_entry->texture_info_name) == texture_names.end()) + if (!Common::Contains(texture_names, cache_entry->texture_info_name)) { texture_names.push_back(cache_entry->texture_info_name); texture_units.push_back(i); diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 8ca1f4ec63..9c73608b22 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -7,6 +7,7 @@ #include "Common/CPUDetect.h" #include "Common/CommonTypes.h" +#include "Common/Contains.h" #include "Common/StringUtil.h" #include "Core/CPUThreadConfigCallback.h" @@ -213,8 +214,7 @@ void VideoConfig::VerifyValidity() if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; - if (std::find(backend_info.AAModes.begin(), backend_info.AAModes.end(), iMultisamples) == - backend_info.AAModes.end()) + if (!Common::Contains(backend_info.AAModes, iMultisamples)) iMultisamples = 1; if (stereo_mode != StereoMode::Off) |
