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;
|
|
|
|
|
2018-11-24 05:20:56 +01:00
|
|
|
void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) {
|
|
|
|
ASSERT_MSG(method_call.method < Regs::NUM_REGS,
|
2018-09-08 22:58:20 +02:00
|
|
|
"Invalid KeplerMemory register, increase the size of the Regs structure");
|
|
|
|
|
2018-11-24 05:20:56 +01:00
|
|
|
regs.reg_array[method_call.method] = method_call.argument;
|
2018-09-08 22:58:20 +02:00
|
|
|
|
2018-11-24 05:20:56 +01:00
|
|
|
switch (method_call.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): {
|
2019-04-23 14:02:24 +02:00
|
|
|
const bool is_last_call = method_call.IsLastCall();
|
2019-04-23 00:50:56 +02:00
|
|
|
upload_state.ProcessData(method_call.argument, is_last_call);
|
2018-09-08 22:58:20 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Tegra::Engines
|