video_core: Make use of ordered container contains() where applicable

With C++20, we can use the more concise contains() member function
instead of comparing the result of the find() call with the end
iterator.
This commit is contained in:
Lioncash 2020-12-07 16:30:36 -05:00
parent 5cd051eced
commit 09fa1d6a73
8 changed files with 13 additions and 16 deletions

View file

@ -1485,9 +1485,7 @@ void ARBDecompiler::Exit() {
}
const auto safe_get_register = [this](u32 reg) -> std::string {
// TODO(Rodrigo): Replace with contains once C++20 releases
const auto& used_registers = ir.GetRegisters();
if (used_registers.find(reg) != used_registers.end()) {
if (ir.GetRegisters().contains(reg)) {
return fmt::format("R{}.x", reg);
}
return "{0, 0, 0, 0}.x";

View file

@ -459,7 +459,7 @@ void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, const std::atomic_bool& stop
ProgramSharedPtr ShaderCacheOpenGL::GeneratePrecompiledProgram(
const ShaderDiskCacheEntry& entry, const ShaderDiskCachePrecompiled& precompiled_entry,
const std::unordered_set<GLenum>& supported_formats) {
if (supported_formats.find(precompiled_entry.binary_format) == supported_formats.end()) {
if (!supported_formats.contains(precompiled_entry.binary_format)) {
LOG_INFO(Render_OpenGL, "Precompiled cache entry with unsupported format, removing");
return {};
}

View file

@ -343,7 +343,7 @@ void ShaderDiskCacheOpenGL::SaveEntry(const ShaderDiskCacheEntry& entry) {
}
const u64 id = entry.unique_identifier;
if (stored_transferable.find(id) != stored_transferable.end()) {
if (stored_transferable.contains(id)) {
// The shader already exists
return;
}