diff options
author | Subv <subv2112@gmail.com> | 2018-09-08 22:58:20 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-09-12 20:57:08 +0200 |
commit | bb5eb4f20ac74e06317ed5b0c98282cde1f9e119 (patch) | |
tree | e1b89238165f33c65ff7909eabd846be5f58785c /src/video_core/engines/kepler_memory.cpp | |
parent | Merge pull request #1303 from lioncash/error (diff) | |
download | yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.tar yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.tar.gz yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.tar.bz2 yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.tar.lz yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.tar.xz yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.tar.zst yuzu-bb5eb4f20ac74e06317ed5b0c98282cde1f9e119.zip |
Diffstat (limited to 'src/video_core/engines/kepler_memory.cpp')
-rw-r--r-- | src/video_core/engines/kepler_memory.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp new file mode 100644 index 000000000..66ae6332d --- /dev/null +++ b/src/video_core/engines/kepler_memory.cpp @@ -0,0 +1,45 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/memory.h" +#include "video_core/engines/kepler_memory.h" + +namespace Tegra::Engines { + +KeplerMemory::KeplerMemory(MemoryManager& memory_manager) : memory_manager(memory_manager) {} +KeplerMemory::~KeplerMemory() = default; + +void KeplerMemory::WriteReg(u32 method, u32 value) { + ASSERT_MSG(method < Regs::NUM_REGS, + "Invalid KeplerMemory register, increase the size of the Regs structure"); + + regs.reg_array[method] = value; + + switch (method) { + case KEPLERMEMORY_REG_INDEX(exec): { + state.write_offset = 0; + break; + } + case KEPLERMEMORY_REG_INDEX(data): { + ProcessData(value); + break; + } + } +} + +void KeplerMemory::ProcessData(u32 data) { + ASSERT_MSG(regs.exec.linear, "Non-linear uploads are not supported"); + ASSERT(regs.dest.x == 0 && regs.dest.y == 0 && regs.dest.z == 0); + + GPUVAddr address = regs.dest.Address(); + VAddr dest_address = + *memory_manager.GpuToCpuAddress(address + state.write_offset * sizeof(u32)); + + Memory::Write32(dest_address, data); + + state.write_offset++; +} + +} // namespace Tegra::Engines |