2018-09-08 22:58:20 +02:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2019-02-16 04:05:17 +01:00
|
|
|
#include "common/assert.h"
|
2018-09-08 22:58:20 +02:00
|
|
|
#include "common/logging/log.h"
|
2018-11-06 21:26:27 +01:00
|
|
|
#include "core/core.h"
|
2018-09-08 22:58:20 +02:00
|
|
|
#include "video_core/engines/kepler_memory.h"
|
2018-11-06 21:26:27 +01:00
|
|
|
#include "video_core/engines/maxwell_3d.h"
|
2019-04-06 00:21:15 +02:00
|
|
|
#include "video_core/memory_manager.h"
|
2018-10-18 02:44:07 +02:00
|
|
|
#include "video_core/rasterizer_interface.h"
|
2019-02-19 02:58:32 +01:00
|
|
|
#include "video_core/renderer_base.h"
|
2019-04-15 18:43:37 +02:00
|
|
|
#include "video_core/textures/decoders.h"
|
2018-09-08 22:58:20 +02:00
|
|
|
|
|
|
|
namespace Tegra::Engines {
|
|
|
|
|
2019-04-23 00:50:56 +02:00
|
|
|
KeplerMemory::KeplerMemory(Core::System& system, MemoryManager& memory_manager)
|
2019-08-30 20:08:00 +02:00
|
|
|
: system{system}, upload_state{memory_manager, regs.upload} {}
|
2018-10-18 02:44:07 +02:00
|
|
|
|
2018-09-08 22:58:20 +02:00
|
|
|
KeplerMemory::~KeplerMemory() = default;
|
|
|
|
|
2020-04-28 03:47:58 +02:00
|
|
|
void KeplerMemory::CallMethod(u32 method, u32 method_argument, bool is_last_call) {
|
|
|
|
ASSERT_MSG(method < Regs::NUM_REGS,
|
2018-09-08 22:58:20 +02:00
|
|
|
"Invalid KeplerMemory register, increase the size of the Regs structure");
|
|
|
|
|
2020-04-28 03:47:58 +02:00
|
|
|
regs.reg_array[method] = method_argument;
|
2018-09-08 22:58:20 +02:00
|
|
|
|
2020-04-28 03:47:58 +02:00
|
|
|
switch (method) {
|
2018-09-08 22:58:20 +02:00
|
|
|
case KEPLERMEMORY_REG_INDEX(exec): {
|
2019-04-23 00:50:56 +02:00
|
|
|
upload_state.ProcessExec(regs.exec.linear != 0);
|
2018-09-08 22:58:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case KEPLERMEMORY_REG_INDEX(data): {
|
2020-04-28 03:47:58 +02:00
|
|
|
upload_state.ProcessData(method_argument, is_last_call);
|
2019-12-27 02:14:10 +01:00
|
|
|
if (is_last_call) {
|
|
|
|
system.GPU().Maxwell3D().OnMemoryWrite();
|
|
|
|
}
|
2018-09-08 22:58:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-20 19:42:14 +02:00
|
|
|
void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount,
|
|
|
|
u32 methods_pending) {
|
2020-04-20 08:16:56 +02:00
|
|
|
for (std::size_t i = 0; i < amount; i++) {
|
2020-04-28 03:47:58 +02:00
|
|
|
CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1);
|
2020-04-20 08:16:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-08 22:58:20 +02:00
|
|
|
} // namespace Tegra::Engines
|