mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-15 21:42:58 +00:00
shader/control_flow: Use callable template instead of std::function
This commit is contained in:
parent
46c3047283
commit
7b069252f8
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -157,11 +156,11 @@ std::optional<std::pair<s32, u64>> GetBRXInfo(const CFGRebuildState& state, u32&
|
||||||
return std::make_pair(instr.brx.GetBranchExtend(), instr.gpr8.Value());
|
return std::make_pair(instr.brx.GetBranchExtend(), instr.gpr8.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result>
|
template <typename Result, typename TestCallable, typename PackCallable>
|
||||||
std::optional<Result> TrackInstruction(
|
// requires std::predicate<TestCallable, Instruction, const OpCode::Matcher&>
|
||||||
const CFGRebuildState& state, u32& pos,
|
// requires std::invocable<PackCallable, Instruction, const OpCode::Matcher&>
|
||||||
std::function<bool(Instruction, const OpCode::Matcher&)>&& test,
|
std::optional<Result> TrackInstruction(const CFGRebuildState& state, u32& pos, TestCallable test,
|
||||||
std::function<Result(Instruction, const OpCode::Matcher&)>&& pack) {
|
PackCallable pack) {
|
||||||
for (; pos >= state.start; --pos) {
|
for (; pos >= state.start; --pos) {
|
||||||
if (IsSchedInstruction(pos, state.start)) {
|
if (IsSchedInstruction(pos, state.start)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue