Addressed issues

This commit is contained in:
David Marcec 2020-06-05 13:09:52 +10:00
parent 74b4334d51
commit fabdf5d385
5 changed files with 17 additions and 13 deletions

View File

@ -1422,6 +1422,10 @@ public:
return rasterizer; return rasterizer;
} }
const VideoCore::RasterizerInterface& GetRasterizer() const {
return rasterizer;
}
/// Notify a memory write has happened. /// Notify a memory write has happened.
void OnMemoryWrite() { void OnMemoryWrite() {
dirty.flags |= dirty.on_write_stores; dirty.flags |= dirty.on_write_stores;

View File

@ -17,7 +17,7 @@ namespace Tegra {
MacroEngine::MacroEngine(Engines::Maxwell3D& maxwell3d) MacroEngine::MacroEngine(Engines::Maxwell3D& maxwell3d)
: hle_macros{std::make_unique<Tegra::HLEMacro>(maxwell3d)} {} : hle_macros{std::make_unique<Tegra::HLEMacro>(maxwell3d)} {}
MacroEngine::~MacroEngine() {} MacroEngine::~MacroEngine() = default;
void MacroEngine::AddCode(u32 method, u32 data) { void MacroEngine::AddCode(u32 method, u32 data) {
uploaded_macro_code[method].push_back(data); uploaded_macro_code[method].push_back(data);

View File

@ -111,7 +111,7 @@ public:
class MacroEngine { class MacroEngine {
public: public:
MacroEngine(Engines::Maxwell3D& maxwell3d); explicit MacroEngine(Engines::Maxwell3D& maxwell3d);
virtual ~MacroEngine(); virtual ~MacroEngine();
// Store the uploaded macro code to compile them when they're called. // Store the uploaded macro code to compile them when they're called.

View File

@ -2,7 +2,7 @@
// 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 <unordered_map> #include <array>
#include <vector> #include <vector>
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
#include "video_core/macro/macro_hle.h" #include "video_core/macro/macro_hle.h"
@ -78,22 +78,22 @@ static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d,
maxwell3d.CallMethodFromMME(0x8e5, 0x0); maxwell3d.CallMethodFromMME(0x8e5, 0x0);
} }
static const std::unordered_map<u64, HLEFunction> hle_funcs{ static const std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{
{0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, std::make_pair<u64, HLEFunction>(0x771BB18C62444DA0, &HLE_771BB18C62444DA0),
{0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD}, std::make_pair<u64, HLEFunction>(0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD),
{0x0217920100488FF7, &HLE_0217920100488FF7}, std::make_pair<u64, HLEFunction>(0x0217920100488FF7, &HLE_0217920100488FF7),
}; };
HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {}
HLEMacro::~HLEMacro() = default; HLEMacro::~HLEMacro() = default;
std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const { std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const {
auto it = hle_funcs.find(hash); const auto it = std::find_if(hle_funcs.begin(), hle_funcs.end(),
if (it != hle_funcs.end()) { [hash](auto& pair) { return pair.first == hash; });
return std::make_unique<HLEMacroImpl>(maxwell3d, it->second); if (it == hle_funcs.end()) {
} else { return std::nullopt;
return {};
} }
return std::make_unique<HLEMacroImpl>(maxwell3d, it->second);
} }
HLEMacroImpl::~HLEMacroImpl() = default; HLEMacroImpl::~HLEMacroImpl() = default;

View File

@ -20,7 +20,7 @@ using HLEFunction = void (*)(Engines::Maxwell3D& maxwell3d, const std::vector<u3
class HLEMacro { class HLEMacro {
public: public:
HLEMacro(Engines::Maxwell3D& maxwell3d); explicit HLEMacro(Engines::Maxwell3D& maxwell3d);
~HLEMacro(); ~HLEMacro();
std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const; std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const;