diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_arb_decompiler.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/shader/control_flow.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/shader/decode.cpp | 4 |
8 files changed, 13 insertions, 16 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index e7edd733f..38961f3fd 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -545,7 +545,7 @@ private: | |||
| 545 | bool IsRegionWritten(VAddr start, VAddr end) const { | 545 | bool IsRegionWritten(VAddr start, VAddr end) const { |
| 546 | const u64 page_end = end >> WRITE_PAGE_BIT; | 546 | const u64 page_end = end >> WRITE_PAGE_BIT; |
| 547 | for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) { | 547 | for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) { |
| 548 | if (written_pages.count(page_start) > 0) { | 548 | if (written_pages.contains(page_start)) { |
| 549 | return true; | 549 | return true; |
| 550 | } | 550 | } |
| 551 | } | 551 | } |
diff --git a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp index 78066cc63..3e4d88c30 100644 --- a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp | |||
| @@ -1485,9 +1485,7 @@ void ARBDecompiler::Exit() { | |||
| 1485 | } | 1485 | } |
| 1486 | 1486 | ||
| 1487 | const auto safe_get_register = [this](u32 reg) -> std::string { | 1487 | const auto safe_get_register = [this](u32 reg) -> std::string { |
| 1488 | // TODO(Rodrigo): Replace with contains once C++20 releases | 1488 | if (ir.GetRegisters().contains(reg)) { |
| 1489 | const auto& used_registers = ir.GetRegisters(); | ||
| 1490 | if (used_registers.find(reg) != used_registers.end()) { | ||
| 1491 | return fmt::format("R{}.x", reg); | 1489 | return fmt::format("R{}.x", reg); |
| 1492 | } | 1490 | } |
| 1493 | return "{0, 0, 0, 0}.x"; | 1491 | return "{0, 0, 0, 0}.x"; |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 0b96481f5..eabfdea5d 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -459,7 +459,7 @@ void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, const std::atomic_bool& stop | |||
| 459 | ProgramSharedPtr ShaderCacheOpenGL::GeneratePrecompiledProgram( | 459 | ProgramSharedPtr ShaderCacheOpenGL::GeneratePrecompiledProgram( |
| 460 | const ShaderDiskCacheEntry& entry, const ShaderDiskCachePrecompiled& precompiled_entry, | 460 | const ShaderDiskCacheEntry& entry, const ShaderDiskCachePrecompiled& precompiled_entry, |
| 461 | const std::unordered_set<GLenum>& supported_formats) { | 461 | const std::unordered_set<GLenum>& supported_formats) { |
| 462 | if (supported_formats.find(precompiled_entry.binary_format) == supported_formats.end()) { | 462 | if (!supported_formats.contains(precompiled_entry.binary_format)) { |
| 463 | LOG_INFO(Render_OpenGL, "Precompiled cache entry with unsupported format, removing"); | 463 | LOG_INFO(Render_OpenGL, "Precompiled cache entry with unsupported format, removing"); |
| 464 | return {}; | 464 | return {}; |
| 465 | } | 465 | } |
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 70dd0c3c6..955b2abc4 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | |||
| @@ -343,7 +343,7 @@ void ShaderDiskCacheOpenGL::SaveEntry(const ShaderDiskCacheEntry& entry) { | |||
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | const u64 id = entry.unique_identifier; | 345 | const u64 id = entry.unique_identifier; |
| 346 | if (stored_transferable.find(id) != stored_transferable.end()) { | 346 | if (stored_transferable.contains(id)) { |
| 347 | // The shader already exists | 347 | // The shader already exists |
| 348 | return; | 348 | return; |
| 349 | } | 349 | } |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index f8a1bcf34..970979fa1 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -230,7 +230,7 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa | |||
| 230 | if (!attribute.enabled) { | 230 | if (!attribute.enabled) { |
| 231 | continue; | 231 | continue; |
| 232 | } | 232 | } |
| 233 | if (input_attributes.find(static_cast<u32>(index)) == input_attributes.end()) { | 233 | if (!input_attributes.contains(static_cast<u32>(index))) { |
| 234 | // Skip attributes not used by the vertex shaders. | 234 | // Skip attributes not used by the vertex shaders. |
| 235 | continue; | 235 | continue; |
| 236 | } | 236 | } |
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 5748eab3a..ca12b3793 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -2125,8 +2125,7 @@ private: | |||
| 2125 | OpStore(z_pointer, depth); | 2125 | OpStore(z_pointer, depth); |
| 2126 | } | 2126 | } |
| 2127 | if (stage == ShaderType::Fragment) { | 2127 | if (stage == ShaderType::Fragment) { |
| 2128 | const auto SafeGetRegister = [&](u32 reg) { | 2128 | const auto SafeGetRegister = [this](u32 reg) { |
| 2129 | // TODO(Rodrigo): Replace with contains once C++20 releases | ||
| 2130 | if (const auto it = registers.find(reg); it != registers.end()) { | 2129 | if (const auto it = registers.find(reg); it != registers.end()) { |
| 2131 | return OpLoad(t_float, it->second); | 2130 | return OpLoad(t_float, it->second); |
| 2132 | } | 2131 | } |
diff --git a/src/video_core/shader/control_flow.cpp b/src/video_core/shader/control_flow.cpp index 9120bf705..43d965f2f 100644 --- a/src/video_core/shader/control_flow.cpp +++ b/src/video_core/shader/control_flow.cpp | |||
| @@ -257,7 +257,7 @@ std::pair<ParseResult, ParseInfo> ParseCode(CFGRebuildState& state, u32 address) | |||
| 257 | single_branch.ignore = false; | 257 | single_branch.ignore = false; |
| 258 | break; | 258 | break; |
| 259 | } | 259 | } |
| 260 | if (state.registered.count(offset) != 0) { | 260 | if (state.registered.contains(offset)) { |
| 261 | single_branch.address = offset; | 261 | single_branch.address = offset; |
| 262 | single_branch.ignore = true; | 262 | single_branch.ignore = true; |
| 263 | break; | 263 | break; |
| @@ -632,12 +632,12 @@ void DecompileShader(CFGRebuildState& state) { | |||
| 632 | for (auto label : state.labels) { | 632 | for (auto label : state.labels) { |
| 633 | state.manager->DeclareLabel(label); | 633 | state.manager->DeclareLabel(label); |
| 634 | } | 634 | } |
| 635 | for (auto& block : state.block_info) { | 635 | for (const auto& block : state.block_info) { |
| 636 | if (state.labels.count(block.start) != 0) { | 636 | if (state.labels.contains(block.start)) { |
| 637 | state.manager->InsertLabel(block.start); | 637 | state.manager->InsertLabel(block.start); |
| 638 | } | 638 | } |
| 639 | const bool ignore = BlockBranchIsIgnored(block.branch); | 639 | const bool ignore = BlockBranchIsIgnored(block.branch); |
| 640 | u32 end = ignore ? block.end + 1 : block.end; | 640 | const u32 end = ignore ? block.end + 1 : block.end; |
| 641 | state.manager->InsertBlock(block.start, end); | 641 | state.manager->InsertBlock(block.start, end); |
| 642 | if (!ignore) { | 642 | if (!ignore) { |
| 643 | InsertBranch(*state.manager, block.branch); | 643 | InsertBranch(*state.manager, block.branch); |
| @@ -737,7 +737,7 @@ std::unique_ptr<ShaderCharacteristics> ScanFlow(const ProgramCode& program_code, | |||
| 737 | auto back = result_out->blocks.begin(); | 737 | auto back = result_out->blocks.begin(); |
| 738 | auto next = std::next(back); | 738 | auto next = std::next(back); |
| 739 | while (next != result_out->blocks.end()) { | 739 | while (next != result_out->blocks.end()) { |
| 740 | if (state.labels.count(next->start) == 0 && next->start == back->end + 1) { | 740 | if (!state.labels.contains(next->start) && next->start == back->end + 1) { |
| 741 | back->end = next->end; | 741 | back->end = next->end; |
| 742 | next = result_out->blocks.erase(next); | 742 | next = result_out->blocks.erase(next); |
| 743 | continue; | 743 | continue; |
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index c8f4da6df..ab14c1aa3 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp | |||
| @@ -153,8 +153,8 @@ void ShaderIR::Decode() { | |||
| 153 | const auto& blocks = shader_info.blocks; | 153 | const auto& blocks = shader_info.blocks; |
| 154 | NodeBlock current_block; | 154 | NodeBlock current_block; |
| 155 | u32 current_label = static_cast<u32>(exit_branch); | 155 | u32 current_label = static_cast<u32>(exit_branch); |
| 156 | for (auto& block : blocks) { | 156 | for (const auto& block : blocks) { |
| 157 | if (shader_info.labels.count(block.start) != 0) { | 157 | if (shader_info.labels.contains(block.start)) { |
| 158 | insert_block(current_block, current_label); | 158 | insert_block(current_block, current_label); |
| 159 | current_block.clear(); | 159 | current_block.clear(); |
| 160 | current_label = block.start; | 160 | current_label = block.start; |