2024-03-06 06:26:38 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-06-04 17:42:19 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-03-05 08:01:13 +01:00
|
|
|
#include <functional>
|
2020-06-04 17:42:19 +02:00
|
|
|
#include <memory>
|
2022-03-05 08:01:13 +01:00
|
|
|
#include <unordered_map>
|
|
|
|
|
2020-06-04 17:42:19 +02:00
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Tegra {
|
|
|
|
|
|
|
|
namespace Engines {
|
|
|
|
class Maxwell3D;
|
|
|
|
}
|
|
|
|
|
|
|
|
class HLEMacro {
|
|
|
|
public:
|
2020-12-04 20:39:12 +01:00
|
|
|
explicit HLEMacro(Engines::Maxwell3D& maxwell3d_);
|
2020-06-04 17:42:19 +02:00
|
|
|
~HLEMacro();
|
2020-06-24 04:18:33 +02:00
|
|
|
|
2022-01-25 19:50:10 +01:00
|
|
|
// Allocates and returns a cached macro if the hash matches a known function.
|
|
|
|
// Returns nullptr otherwise.
|
|
|
|
[[nodiscard]] std::unique_ptr<CachedMacro> GetHLEProgram(u64 hash) const;
|
2020-06-04 17:42:19 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Engines::Maxwell3D& maxwell3d;
|
2022-03-05 08:01:13 +01:00
|
|
|
std::unordered_map<u64, std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>>
|
|
|
|
builders;
|
2020-06-04 17:42:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Tegra
|