kepler_memory.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/assert.h"
  5. #include "common/logging/log.h"
  6. #include "core/core.h"
  7. #include "video_core/engines/kepler_memory.h"
  8. #include "video_core/engines/maxwell_3d.h"
  9. #include "video_core/memory_manager.h"
  10. #include "video_core/rasterizer_interface.h"
  11. #include "video_core/renderer_base.h"
  12. #include "video_core/textures/decoders.h"
  13. namespace Tegra::Engines {
  14. KeplerMemory::KeplerMemory(Core::System& system_, MemoryManager& memory_manager)
  15. : system{system_}, upload_state{memory_manager, regs.upload} {}
  16. KeplerMemory::~KeplerMemory() = default;
  17. void KeplerMemory::CallMethod(u32 method, u32 method_argument, bool is_last_call) {
  18. ASSERT_MSG(method < Regs::NUM_REGS,
  19. "Invalid KeplerMemory register, increase the size of the Regs structure");
  20. regs.reg_array[method] = method_argument;
  21. switch (method) {
  22. case KEPLERMEMORY_REG_INDEX(exec): {
  23. upload_state.ProcessExec(regs.exec.linear != 0);
  24. break;
  25. }
  26. case KEPLERMEMORY_REG_INDEX(data): {
  27. upload_state.ProcessData(method_argument, is_last_call);
  28. if (is_last_call) {
  29. system.GPU().Maxwell3D().OnMemoryWrite();
  30. }
  31. break;
  32. }
  33. }
  34. }
  35. void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount,
  36. u32 methods_pending) {
  37. for (std::size_t i = 0; i < amount; i++) {
  38. CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1);
  39. }
  40. }
  41. } // namespace Tegra::Engines