summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2020-12-08 01:55:51 +0100
committerGitHub <noreply@github.com>2020-12-08 01:55:51 +0100
commit3415890dd5c6539a7c7b6e02bf7ce5df4533133c (patch)
treed8293d5f1997e2b59d79d5bfcc629b736565ac13 /src/video_core/shader
parentMerge pull request #5163 from lioncash/concat (diff)
parentvideo_core: Make use of ordered container contains() where applicable (diff)
downloadyuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.tar
yuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.tar.gz
yuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.tar.bz2
yuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.tar.lz
yuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.tar.xz
yuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.tar.zst
yuzu-3415890dd5c6539a7c7b6e02bf7ce5df4533133c.zip
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/control_flow.cpp10
-rw-r--r--src/video_core/shader/decode.cpp4
2 files changed, 7 insertions, 7 deletions
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)
single_branch.ignore = false;
break;
}
- if (state.registered.count(offset) != 0) {
+ if (state.registered.contains(offset)) {
single_branch.address = offset;
single_branch.ignore = true;
break;
@@ -632,12 +632,12 @@ void DecompileShader(CFGRebuildState& state) {
for (auto label : state.labels) {
state.manager->DeclareLabel(label);
}
- for (auto& block : state.block_info) {
- if (state.labels.count(block.start) != 0) {
+ for (const auto& block : state.block_info) {
+ if (state.labels.contains(block.start)) {
state.manager->InsertLabel(block.start);
}
const bool ignore = BlockBranchIsIgnored(block.branch);
- u32 end = ignore ? block.end + 1 : block.end;
+ const u32 end = ignore ? block.end + 1 : block.end;
state.manager->InsertBlock(block.start, end);
if (!ignore) {
InsertBranch(*state.manager, block.branch);
@@ -737,7 +737,7 @@ std::unique_ptr<ShaderCharacteristics> ScanFlow(const ProgramCode& program_code,
auto back = result_out->blocks.begin();
auto next = std::next(back);
while (next != result_out->blocks.end()) {
- if (state.labels.count(next->start) == 0 && next->start == back->end + 1) {
+ if (!state.labels.contains(next->start) && next->start == back->end + 1) {
back->end = next->end;
next = result_out->blocks.erase(next);
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() {
const auto& blocks = shader_info.blocks;
NodeBlock current_block;
u32 current_label = static_cast<u32>(exit_branch);
- for (auto& block : blocks) {
- if (shader_info.labels.count(block.start) != 0) {
+ for (const auto& block : blocks) {
+ if (shader_info.labels.contains(block.start)) {
insert_block(current_block, current_label);
current_block.clear();
current_label = block.start;